How to set up weights/bias of the NARX neural network

I want to set up the range of weights of NARX network in [-0.8,0.8], how can i set up it? The number of the output neurons is 2.
my code is that
ID=1:2; FD=1:2; H=[7,15];
net=narxnet(ID,FD,H);
[inputs,inputstates,layerstates,targets]=preparets(net,T,{},P);
net.inputs{1}.processFcns = {'mapstd','removeconstantrows','mapminmax'};
net.inputs{2}.processFcns = {'mapstd','removeconstantrows','mapminmax'};
net.initFcn='initlay';
net.layers{2}.initFcn='initwb';
net.layers{3}.initFcn='initwb';
net.layerWeights{2,1}.initFcn='randsmall';
net.layerWeights{3,2}.initFcn='randsmall';
This method can initialize weights to be [-0.1,0.1].And it's right.
But when i want to use the following method to get the initial range [-0.8,0.8],it's wrong. The code is shown in below.
net=narxnet(ID,FD,H);
[inputs,inputstates,layerstates,targets]=preparets(net,T,{},P);
net.inputs{1}.processFcns = {'mapstd','removeconstantrows','mapminmax'};
net.inputs{2}.processFcns = {'mapstd','removeconstantrows','mapminmax'};
net.initFcn='initlay';
net.layers{2}.initFcn='initwb';
net.layers{3}.initFcn='initwb';
net.layerWeights{2,1}.initFcn=tonndata(0.8*rands(25,7));
net.layerWeights{3,2}.initFcn=tonndata(0.8*rands(2,25));
*How can i do it?*

 Accepted Answer

You are concentrating on the wrong stuff. The most important things are (assuming a SINGLE hidden layer)
1. Obtain a good set of crosscorrelation delays for ID (e.g., using NNCORR)
2. Obtain a good set of autocorrelation delays for FD (e.g., using NNCORR)
3. Given ID and FD, find the smallest successful value for H considering
~ 10 different random weight initialization trials for each H candidate.
MATLAB defaults will take care of the rest. Search for my openloop examples
greg nncorr narxnet
greg narxnet
Then consider closing the feedback loop
greg closeloop
Hope this helps.
Thank you for formally accepting my answer
Greg

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Asked:

on 26 Jan 2015

Edited:

on 27 Jan 2015

Community Treasure Hunt

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

Start Hunting!