MATLAB: How to define the size of feedback delays and number of hidden layer in narnet

Deep Learning Toolboxforecastingnarnetneural networktime series

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

Best Answer

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