Neural Network simulation for the output value is different from the output value obtained by using calculations, why?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
mun1013
am 4 Jul. 2015
Kommentiert: Greg Heath
am 8 Jul. 2015
Input data - 3 x 150 (3 inputs , 150 data), Target - 1 x 150 ( 1x50 each for 0, 0.5 and 1.0 respectively), Sample = [20 50 60]; newff(...); % create custom network, [net,tr] = train(net,Inputs,Targets); % train the network, Output = net(Sample') %Predict the output value for the sample (input data). The training stopped at about 10 iterations.
But the output value obtained from Output = net(Sample') is totally different from the output value obtained by using the following calculations,
For example - Calculate (back-propagate) hidden layer and output layer errors, δA = outA (1 – outA) (δαWA + δβWA) Change hidden layer weights, WA_new = WA_old + ηδA inλ Change output layer weights, WB_old = WB_old + ηδα outA and so on.
By using Output = net(Sample') , it was 0.975 . However, from calculations, the value was 0.777 for 1 iteration . The target for this sample is 1.0.
Does anyone know about this? Thanks.
0 Kommentare
Akzeptierte Antwort
Greg Heath
am 4 Jul. 2015
Insufficent information
1. What do the 3 target values represent?
2. Your analytic calculations make no sense
a. Samples should be 3-D columns
b. yn = B2 + LW*tanh(B1 + IW*xn)
for normalized inputs and targets. See
http://www.mathworks.com/matlabcentral/newsreader/view_thread/341631#936181
Hope this helps.
Thank you for formally accepting my answer
Greg
2 Kommentare
Greg Heath
am 8 Jul. 2015
2. I don't understand this equation - yn = B2 + LW*tanh(B1 + IW*xn)?
It is the default normalized output assuming defaults of FITNET or FEEDFORWARDNET and the default normalized input. tanh is the same as the default tansig. So the only thing you have to do is
a. Normalize input, x, and target, t, to [ -1 1] (xn and tn) using MAPMINMAX b. Obtain the weights B2, LW, B1, and IW from net.b{2}, net.LW,net.b{1} and net.LW c. Plug into the equation for yn d. Unnormalize yn using tsettings from MAPMINMAX e. It as been known for decades that if you normalize to [-1,1] (mapminmax) or mean=0,std=1 (mapstd or zscore) and use tanh(tansig) for hidden layers and a constant output layer function (purelin) that training speed is optimum. Both the specialized regression function FITNETand the general FEEDFORWARDNET use these defaults.
Using logsig for each layer,
Ij = IW*Input_data;
Q = 1./(1+exp(-Ij));
Ik = LW*Q;
Output = 1./(1+exp(-Ik));
Did you account for biases and normalization?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!