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

1 Ansicht (letzte 30 Tage)
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}

Akzeptierte Antwort

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH am 4 Dez. 2019
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 Kommentare
Alessia Li Noce
Alessia Li Noce am 9 Apr. 2021
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by