Filter löschen
Filter löschen

Lag in output from NarNetwork (narnet)

2 Ansichten (letzte 30 Tage)
Kalpesh Patil
Kalpesh Patil am 1 Sep. 2014
Kommentiert: Kalpesh Patil am 8 Sep. 2014
% Solve an Autoregression Time-Series Problem with a NAR Neural Network % Script generated by Neural Time Series app % This script assumes this variable is defined: % % solarTargets - feedback time series.
T = solarTargets;
trainFcn = 'trainlm'; % Levenberg-Marquardt feedbackDelays = 1:6; hiddenLayerSize = 10; net = narnet(feedbackDelays,hiddenLayerSize,'open',trainFcn); net.input.processFcns = {'removeconstantrows','mapminmax'}; [x,xi,ai,t] = preparets(net,{},{},T); net.divideFcn = 'dividerand'; % Divide data randomly net.divideMode = 'time'; % Divide up every value net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100;
net.performFcn = 'mse'; % Mean squared error net.plotFcns = {'plotperform','plottrainstate','plotresponse', ... 'ploterrcorr', 'plotinerrcorr'};
% Train the Network [net,tr] = train(net,x,t,xi,ai);
% Test the Network y = net(x,xi,ai); e = gsubtract(t,y); performance = perform(net,t,y)
% Recalculate Training, Validation and Test Performance trainTargets = gmultiply(t,tr.trainMask); valTargets = gmultiply(t,tr.valMask); testTargets = gmultiply(t,tr.testMask); trainPerformance = perform(net,trainTargets,y) valPerformance = perform(net,valTargets,y) testPerformance = perform(net,testTargets,y)
% View the Network view(net)
% Closed Loop Network netc = closeloop(net); [xc,xic,aic,tc] = preparets(netc,{},{},T); yc = netc(xc,xic,aic); perfc = perform(net,tc,yc)
% Multi-step Prediction [x1,xio,aio,t] = preparets(net,{},{},T); [y1,xfo,afo] = net(x1,xio,aio); [netc,xic,aic] = closeloop(net,xfo,afo); [y2,xfc,afc] = netc(cell(0,5),xic,aic);
% Step-Ahead Prediction Network nets = removedelay(net); [xs,xis,ais,ts] = preparets(nets,{},{},T); ys = nets(xs,xis,ais); stepAheadPerformance = perform(net,ts,ys)
As shown in figure I am observing a lag in targets and output. But same was not observed when code ran for laserTargets series. For sake of understanding a lag only 20 values are plotted.
Help me to understand how to use "narnet".

Akzeptierte Antwort

Greg Heath
Greg Heath am 7 Sep. 2014
The net was trained with 6 delays. Why don't you expect it to show in the plots?
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 Kommentar
Kalpesh Patil
Kalpesh Patil am 8 Sep. 2014
Thank You, for your help sir. But plotted the graphs with delays I have uploaded here, which still shows some a lag. There are some time series which are when predicted by, NAR network shows some lag.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by