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
JESUS DAVID ARIZA ROYETH 2019년 12월 4일
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