Neural Network transfer function
显示 更早的评论
Hello,
I have this problem. I am new at Neural Networks, so I am tried to make a simple multilayer perceptron to estimate a Humps function. I used Matlab function and I succeeded, the estimation was pretty good. Later, I used the weights and the transfer function of the neurons in order to obtain the same result, nevertheless, the results were different. I would like to know if someone have had the same problem. Here is my code:
x = 0:.05:2;
y=humps(x);
P=x;
T=y;
net = feedforwardnet(10);
% train net
net.divideParam.trainRatio = 1; % training set [%]
net.divideParam.valRatio = 0; % validation set [%]
net.divideParam.testRatio = 0; % test set [%]
net= train(net,P,T);
view(net)
T_ann = net(P);
% General Transfer function calculation
weight_1 = net.IW{1};
weight_2 = net.LW{2,1};
T_modelo = ones(1,length(P));
for j=1:length(P)
T_modelo(j)=purelin(sum(tansig(P(j)*weight_1').*weight_2));
end
figure(1) plot(P,T,'Color','b') hold on plot(P,T_ann,'Color','r') hold on plot(P,T_modelo,'Color','g') grid; xlabel('time (s)');
ylabel('output');
title('humps function');
%legend('Real','ANN');
legend('Real','ANN','ANN_2');
Thank you very much.
JDC
回答(1 个)
Greg Heath
2016-9-1
You forgot that the inputs and targets are automatically normalized before learning and the output is automatically denormalized.
This has been explained in several previous posts of both the NEWSGROUP and ANSWERS.
Try searching using the searchword
DENORMALIZATION
Hope this helps.
Thank you for formally accepting this answer
Greg
类别
在 帮助中心 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!