How does feedforwardnet(x) work in matlab.

8 ビュー (過去 30 日間)
levi ackerman
levi ackerman 2022 年 4 月 22 日
回答済み: Steven Lord 2023 年 5 月 10 日
Hey there,
I am training a small neural network using trainlm and would like to use those weights. However after training I have observed that the manually feedforwarding the neural network gives a different answer as compared to net(x).
net = feedforwardnet(3, 'trainlm');
net.layers{1}.transferFcn = 'tansig';
x = 0:0.2:10;
y = x.*x - 3*x + 2;
net = train(net, x, y);
y_pred = net(x);
w0 = net.IW{1,1};
w1 = net.LW{2,1};
b0 = net.b{1,1};
b1 = net.b{2,1};
y_temp = w1*tanh(w0*x + b0) + b1;
there is a lot of difference between y_temp & y_pred. I would like to know how do i correct that. Thanks in advance.
  1 件のコメント
Alex Evenhouse
Alex Evenhouse 2023 年 5 月 10 日
Did you find a solution? I have a similar problem.

サインインしてコメントする。

回答 (1 件)

Steven Lord
Steven Lord 2023 年 5 月 10 日
Are you taking into account the pre-processing and post-processing functions?

Community Treasure Hunt

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

Start Hunting!

Translated by