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);

“这是我在 MATLAB 中的代码”

在 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]

但是我在 Microsoft Excel 中使用相同的权重来证明模型。

然后在 Excel 中预测:

1.000892957

0.046416854

0.153997283

-0.99993138

为什么他们不相等?

4

0 回答 0