How to get the transfer function equation for the implemented neural network

1 次查看(过去 30 天)
I have implemented neural network of two layers and hidden layer size is 3. for both layers activation function is purelin. When I calculate theoretically output of neural network it is not matching with output provided by neural network of matalab. Plz let me know where i am doing wrong. Thanks

采纳的回答

Greg Heath
Greg Heath 2016-11-9
You have to obtain xsettings and tsettings from x and t.
Then apply them to x2 and t2.
Hope this helps.
Thank you for formally accepting my answer
Greg

更多回答(1 个)

Greg Heath
Greg Heath 2016-9-14
编辑:Greg Heath 2016-9-14
I misplaced my turban and crystal ball. Therefore I cannot tell you where you have gone wrong.
OH! It just occurred to me!
1. Why don't you post your code?
2. Include any comments and error messages that result when you try
to run your code.
3. Include the results of running your code on data in the help
and doc documentation. e.g.,
help fitnet
doc fitnet
Thank you for formally accepting my answer
Greg
PS. Have you included
a. the normalization of input and target
b. The denormalization of the output
Hope this helps.
Greg
  6 个评论
jalpa shah
jalpa shah 2016-11-5
Dear Greg, I have tried your tutorial code and pasted the code which i have tried. In code for lines (1), (2) and (3), when I put X and t instead of x2 and t2 then ya from equation and y are matching. But when I put x2 and t2 then yn and ya both are coming as 0.678 from equations and y2 from simulation of net coming as 4.3997. Means y2 output from simulation does not match with ya calculated from equation.
can you please tell me why its happening like this? your help will be appreciated. thanks
x= [9.71771231870987,9.83342660442415,9.97628374728129]
t= [4.39863796358009,4.69563206044186,4.91324004903954]
x2= [9.62398374728130]
t2= [4.09380849773465]
net = fitnet;
rng( 4151941 )
[ net tr y e ] = train( net, x, t );
y2=sim(net,x2);
% THE ANALYTIC I/O RELATIONSHIP
xn = mapminmax(x2); %.....(1)
[ tn, tsettings ] = mapminmax(t2); %....(2)
[p,N]= size(x2); %......(3)
b1 = net.b{1} ; % [ H 1 ]
IW = net.IW{ 1 ,1 }; % [ H I ]
b2 = net.b{2} ; % [ O 1 ]
LW = net.LW{ 2, 1 }; % [ O H ]
whos b1 IW b2 LW
B1 = repmat( b1 , 1, N ) ;
B2 = repmat( b2 , 1, N ) ; % For O > 1
yn = B2 + LW * tanh( B1 + IW * xn );
ya = mapminmax.reverse(yn,tsettings);
end

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by