problem with closeloop narx

1 次查看(过去 30 天)
I am spanish and i can't writte well english but i will try explain my problem. I want to create a RED NARX for predict values of future. I imported two records (inputs) and (targets). I prepared data with command preparets and i create the narxnet with one delay and 16 hiddenlayers. After, i train narxnet and simulated the data i got the outputs. But this outputs are delayed and i want values in future for example one day. I must use closeloop for obtain data in future. My problem is how iterate twice with closeloop because i does not got targets in future. how as would be the code of this part (closeloop) for iterate two times.
Many thanks
  2 个评论
Greg Heath
Greg Heath 2013-1-31
I hope you mean one hidden layer with 16 hidden nodes.
Greg
FRANCISCO
FRANCISCO 2013-1-31
Yes, my code is: xlsread p xlsread t
p1=p' t1=t'
inputSeries = tonndata(pn,true,false); targetSeries = tonndata(tn,true,false);
% Create a Nonlinear Autoregressive Network with External Input
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
% Prepare the Data for Training and Simulation [inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);
% Train the Network [net,tr] = train(net,inputs,targets,inputStates,layerStates);
% Test the Network outputs = net(inputs,inputStates,layerStates); errors = gsubtract(targets,outputs);
okei ,I get up here
% Closed Loop Network netc = closeloop(net); [xc,xic,aic,tc] = preparets(netc,inputSeries,{},targetSeries); yc = netc(xc,xic,aic);
well, now, for re-iterate i must introduce (yc) in function preparets for simulate again close loop?? As would this comand?? [xc,xic,aic,tc] = preparets(netc,yc,{},{});?? because targets now i have not. This is my problem, i do not know the target in (t+1) and ,how can i predict the next value with closeloop?. Many thanks and sorry for my english

请先登录,再进行评论。

采纳的回答

Shashank Prasanna
Shashank Prasanna 2013-1-30
This is what an open loop looks like during training:
Since it is NARX you will have one y(t) as the target and x(t) as the eXogenous input.
When you close the loop as follows:
you will ONLY need to provide the eXogenous inputs, y(t) will be predicted by the output.
Scroll down to see the code of how this is done:
If you don't have an eXogenous input x(t) then you need to be using NAR network.
  1 个评论
FRANCISCO
FRANCISCO 2013-1-31
Sorry for taking so long is that I lie a little mathworks page. Many thanks for your reply Benji Bowbow. i have one last question. I train the narxnet and simulated the network. After, i close loop and simulate the network again. For iterated the network two times i introduce this previous outputs in close loop and simulate again. I am going to explain with code.
%import data%
xlsread p xlsread t
p1=p' t1=t'
inputSeries = tonndata(pn,true,false); targetSeries = tonndata(tn,true,false);
% Create a Nonlinear Autoregressive Network with External Input
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
% Prepare the Data for Training and Simulation [inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);
% Train the Network [net,tr] = train(net,inputs,targets,inputStates,layerStates);
% Test the Network outputs = net(inputs,inputStates,layerStates); errors = gsubtract(targets,outputs);
okei ,I get up here
% Closed Loop Network netc = closeloop(net); [xc,xic,aic,tc] = preparets(netc,inputSeries,{},targetSeries); yc = netc(xc,xic,aic);
well, now, for re-iterate i must introduce (yc) in function preparets for simulate again close loop?? As would this comand?? [xc,xic,aic,tc] = preparets(netc,yc,{},{});?? because targets now i have not

请先登录,再进行评论。

更多回答(1 个)

Greg Heath
Greg Heath 2013-3-13
You can iterate as long as you have exogeneous inputs. If your last exogeneous input value is at t = tf, your last predicted output is at t = tf + LDB where
LDB = max([ID,FD])
is the length of your delay buffer.
However, there is a limited amount of good predictions beyond the end of the training series caused by the accumulation of prediction errors. Therefore, it is imperative that you do not overtrain an overfit (Nw > Ntrneq) openloop net.
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 个评论
FRANCISCO
FRANCISCO 2013-3-13
Good, I could give an example using code to view more clearly, for example get the ten values. taking as input the exogenous variables today (one day)?. I'm a little busy and I do not know how to make the prediction.
Thank you very much for your reply

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by