Lag in output from NarNetwork (narnet)
조회 수: 1 (최근 30일)
이전 댓글 표시
% 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".

댓글 수: 0
채택된 답변
Greg Heath
2014년 9월 7일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!