weight and bias values i get from trained neural network is mistake?

1 次查看(过去 30 天)
Hi, i try to get the weight and bias from the neural network that i train.
ActFunc_Hid and ActFunc_Out depends on any activation function i set on hidden and outer layer.
However, when i trained the neural network, i test it again by output = sim(net, a), where a is new input. the shown output is not the same as what i calculate manually based on the weight and bias value got from the trained neural network.
Is there any mistake in my code?
net=newff(input, output, 1,{ActFunc_hid ActFunc_Out});
[net tr]=train(net,input,output);
w1 = net.IW{1}
w2 = net.LW{2}
b1 = net.b{1}
b2 = net.b{2}

采纳的回答

JESUS DAVID ARIZA ROYETH
It is not the same because Matlab does a normalization procedure of the variables so if you want to do it manually it would be like this:
xoffset = net.inputs {1} .processSettings {1} .xoffset;
gain = net.inputs {1} .processSettings {1} .gain;
ymin = net.inputs {1} .processSettings {1} .ymin;
y1 = bsxfun (@ times, bsxfun (@ minus, x, xoffset), gain);
y1 = bsxfun (@ plus, y1, ymin);
y1 is the true entrance to the neural network
  2 个评论
Alessia Li Noce
Alessia Li Noce 2021-4-9
Hi,sorry for bring it up after all this time, for the output is the same procedure? I'm doing also a manually implementation and I want to replicate the pre/post processing of newff, which use the mapminmax

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by