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!