How to set up weights/bias of the NARX neural network
Show older comments
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
More Answers (0)
Categories
Find more on Deep Learning Toolbox 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!