Where is the problem in my neural network script? I cannot update the weights and biases after training.
이전 댓글 표시
I am trying to design a custom neural network model to solve a problem. Here is the script:
net= network;
net.numInputs = 1;
net.inputs{1}.size = 1;
net.numLayers = 2;
net.layers{1}.size = 5;
net.layers{2}.size = 1;
net.inputConnect(1,1) = 1;
net.inputConnect(2,1) = 0;
net.biasConnect(1) = 1;
net.biasConnect(2) = 0;
net.layerConnect(2,1) = 1;
net.layers{1}.transferFcn = 'logsig';
net.layers{2}.transferFcn = 'purelin';
net.inputWeights{1,1}.initFcn = 'initzero';
net.inputWeights{1,1}.learn = 1;
net.inputWeights{1,1}.learnFcn = 'learngd';
net.layerWeights{2,1}.initFcn = 'initzero';
net.layerWeights{2,1}.learn = 1;
net.layerWeights{2,1}.learnFcn = 'learngd';
net.biases{1}.initFcn = 'initzero';
net.biases{1}.learn = 1;
net.biases{1}.learnFcn = 'learngd';
net.outputConnect = [0 1];
net.initFcn = 'initlay';
net.trainFcn = 'traingd';
net.performFcn = 'sse';
And here is the the diagram for the neural network:

Before I trained the network, I typed
net.IW{1}; net.b{1}; net.LW{2,1}
in the command window and checked that the values were all initially zero. However, when I trained the network, say
train(net, 0.1, 1)
Even though there was a pop-up window showing the process,

it seemed that the weights and biases did not update as I typed net.IW{1}, net.b{1} and net.LW{2,1}. Also, the output was always zero, no matter what value I input using
sim()
Could anyone help me to indicate the problem in the script or the procedure in training? Thank you.
댓글 수: 1
Greg Heath
2016년 2월 2일
Choose a MATLAB example.
help nndatasets
doc nndatasets
Post all code and results.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!