How neural network output is calculated ?
Afficher commentaires plus anciens
For example
function Example_3()
net = feedforwardnet(1);
p = [[2;2] [1;-2] [-2;2] [-1;1]]
t = [1 2 1 2]
net.layers{1}.transferFcn = 'logsig';
net.layers{2}.transferFcn = 'logsig';
net = train(net,p,t);
wb = formwb(net,net.b,net.iw,net.lw);
[b,iw,lw] = separatewb(net,wb);
end
If
iw are -1.60579942154570 and 5.53933429980683
lw is -24.9335783159999
biases are -1.16445538542225 for the hidden neuron
and 7.83599936414935 for the output neuron
I was able able to calculate the correct values when using a perception but not with neural networks for some reason
I calculate the output using logsig(logsig((IW1*Input1)+(IW2*Input2)+bias1)*LW1+bias2)
If I input -1 and 1, how is the output calculated as 1.9994?
Shouldn't the output be between 0 and 1 because of the logsig ?
1 commentaire
Greg Heath
le 6 Fév 2018
When you choose examples, it is worthwhile to 1st consider continuous functions like ones in the help and doc documentation AND include plots of the inputs, targets and targets vs inputs.
Réponse acceptée
Plus de réponses (1)
Greg Heath
le 12 Fév 2018
1 vote
If your outputs are constrained to [ 0, 1 ] use SOFTMAX
If your outputs are constrained to [ -1, 1 ] use TANH
Otherwise use LINEAR
Hope this helps.
Thank you or formally accepting my answer
Greg
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!