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!