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

1 vue (au cours des 30 derniers jours)
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}

Réponse acceptée

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH le 4 Déc 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 commentaires
Halsey
Halsey le 4 Déc 2019
thank you so much!
Alessia Li Noce
Alessia Li Noce le 9 Avr 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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by