Need help regarding getting weight, bias and layer input matrix at each iteration
3 ビュー (過去 30 日間)
古いコメントを表示
I am new in neural network and using feedforward nn for xor gate and the network has one input layer(with 2 inputs), first layer(hidden layer with 5 neurons) & second layer (output layer with 1 neuron).
I need all matrixes associated with the network at each iteration. The final weight and bias matrixes can be found by using net.IW{1,1}, net.LW{2,1}, net.b{1}, net.b{2} but i need these matrixes at each iteration or epoch.
How can i get the weight and bias matrixes (at each epoch) between (i) input layer and first layer, (ii) first layer and output layer? Also need the first layer's output matrix.
My purpose is to convert all the weight matrixes in to Canonnical Signed Digit (CSD) matrixes and multiply them with the corresponding input matrixes (which are in decimal) to see the improvement of performence.
For CSD, i use the code from this link: http://www.mathworks.com/matlabcentral/fileexchange/9730-canonical-signed-digits
Is there any way to get these matrixes (at each epoch) and is it possible to multiply the CSD weight matrixes with corresponding decimal input matrixes in each epoch?
Please help me. Thankyou.
0 件のコメント
採用された回答
Greg Heath
2011 年 12 月 3 日
You only need 2 hidden neurons.
For best performance use bipolar [-1 1] inputs and TANSIG hidden nodes.
Use TANSIG for bipolar outputs and LOGSIG for unipolar [0 1]
Nepochs = 1
net.trainParam.epochs = Nepochs;
net.trainParam.show = inf; % Do your own plotting
Nloops = 100
for i = 1:Nloops
[net tr Y E] = train(net,p,t);
% Extract weights and multiply to obtain hidden node output. Since verything else that you want is in the LHS, that calculation may not be necessary. Store and/or plot whatever info you want from the LHS
%To see what is available set Nloops = 1 and remove the semicolon
end
WARNING:
You will not get the same performance as Nepochs = 100, Nloops = 1 because TRAIN reinitializes internal training parameters at each call.
Hope this helps.
Greg
その他の回答 (1 件)
Greg Heath
2011 年 12 月 6 日
Please reread the comments after the line
[net tr Y E] = ...
Since you have the updated net, you can obtain the updated weights and other info.
Have you done as suggested...i.e. remove the semicolon to see what info is available in net and tr?
Hope this helps.
Greg
参考
カテゴリ
Help Center および File Exchange で Sequence and Numeric Feature Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!