0
TrainInput = [0 0; 0 1; 1 0; 1 1]';             
TrainTarget = [0; 1; 1; 0]';               

net = newff(TrainInput, TrainTarget, 2, {'tansig' 'purelin'});         
net.divideFcn = ''; 

net.trainParam.lr = 0.01;

net = init(net);         %# init                   
net = train(net, TrainInput, TrainTarget);  

Predict = net(TrainInput);

"This is my code in MATLAB"

Predict in MATLAB:

3.45168338355961e-12

0.999999999996918

1.00000000000490

1.32027722088424e-12

net.IW{1,1} = 
    -2.0053   -2.1062
    -1.9156   -1.9577

net.LW{2,1} =
    1.0728   -1.0657

net.b{1,1} =
    2.1195
    -1.6549

net.b =
    [2x1 double]
    [   -1.0320]

But I use same weight in Microsoft Excel for prove model.

Then Predict in Excel:

1.000892957

0.046416854

0.153997283

-0.99993138

Why aren't they equal?

double-beep
  • 5,031
  • 17
  • 33
  • 41

0 Answers0