Export a neural network trained with MATLAB in other programming languages

Status
Not open for further replies.

Mr.Khiros

Junior Member level 3
Joined
Aug 25, 2013
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
176
I trained a NN with matlab using the following code :
PHP:
  p = [-1 -1 2 2; 0 5 0 5];
    t = [-1 -1 1 1];
    net = newff(p,t,3);
    net = train(net,p,t);
    y = sim(net,p)


Now i'm tring to use the weights & bias calculated by matlab in order to use them to creat a NN in other programming languages, so i used the NN parameters to calculate the output as 'sim function' do :

PHP:
   input = [-1;0]
    y1 = tansig(netsum(dotprod(net.IW{1} , input) , net.b{1}));
    Results = purelin(netsum(dotprod(net.LW{2} ,y1) ,net.b{2})) 
    Y = sim(net,[-1;0])

By this way i do not the same result ?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…