how to define the size of feedback delays and number of hidden layer in narnet ?

6 views (last 30 days)
Hello
I am using NN to predict a single time series. My code is
targetSeries = tonndata(T,false,false);
% Create a Nonlinear Autoregressive Network
feedbackDelays = 1:20;
hiddenLayerSize = 5;
net = narnet(feedbackDelays,hiddenLayerSize);
% Prepare the Data for Training and Simulation
[inputs,inputStates,layerStates,targets] = preparets(net,{},{},targetSeries);
% Setup Division of Data for Training, Validation, Testing
% For a list of all data division functions type: help nndivide
net.divideFcn = 'divideblock'; % Divide data block
net.divideMode = 'time'; % Divide up every value
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,inputs,targets,inputStates,layerStates);
netc = closeloop(net);
N=240; % multistep ahead
NetworkInput=targetSeries;
for i=1:N;
[xc,xic,aic,tc]=preparets(netc,{},{},NetworkInput);
yc=netc(xc,xic,aic);
NetworkInput(1,end+1)=yc(1,end);
end
My time series is a quasi-periodic signal with a main peaks near 115 time units (with a slower modulation of the successive peaks). My idea is to perform cross-validation to test the impacts of feedbackDelays and hiddenlayerSize, but are they objective methods to define these parameters ? Another question : is it possible to use narnet to forecast a non-linear trend ?
Thank you in advance
Vincent

Accepted Answer

Greg Heath
Greg Heath on 14 Apr 2014
Estimate the significant autocorrelation lags using nncorr or fft.
Estimate the number of hidden nodes by trial and error.
Search using
greg nncorr narnet Ntrials

More Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!