Neural Network simulation for the output value is different from the output value obtained by using calculations, why?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Greg Heath
2015-7-4
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 个评论
Greg Heath
2015-7-8
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?
更多回答(0 个)
另请参阅
类别
在 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!