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

Antworten (1)

Greg Heath
Greg Heath am 1 Sep. 2016

0 Stimmen

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

1 Kommentar

Julius_DC
Julius_DC am 1 Sep. 2016
Hello Greg,
I checked the information you suggested. It helped me a lot and I solved the problem. Thank you very much.
Greetings,
Sorry for my english grammar mistakes.
Julius DC

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 31 Aug. 2016

Kommentiert:

am 1 Sep. 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by