Question about neural network weights/biases initialization
Show older comments
Hi,
I'm creating a feedforward backpropagation network this way:
net = fitnet(7);
Then I set some parameters:
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'random'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 185/289;
net.divideParam.valRatio = 35/289;
net.divideParam.testRatio = 69/289;
net.initFcn = 'initlay';
net.layers{1}.initFcn = 'initnw';
net.layers{2}.initFcn = 'initnw';
net.inputWeights{1,1}.initFcn = 'rands';
net.layerWeights{1,1}.initFcn = 'rands';
net.biases{1,1}.initFcn = 'rands';
net.trainFcn = 'trainlm'; % Levenberg-Marquardt
net.performFcn = 'mse'; % Mean squared error
After that, I initialite the network as follows:
net=init(net);
And when I want to access the weights and biases matrix:
net.IW{1,1}
net.LW{1,1}
net.b{1,1}
I just get the following answer:
Empty matrix: 7-by-0
I don't want to start training the net with all the weights set to zero. They should be random values, shouldn't they? How can I get them set to random values? Didn't I already do it when setting
net.inputWeights{1,1}.initFcn = 'rands'?
Thank you in advance
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!