Output equation of fitnet
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have trained my neural networks as follows
hiddenLayerSize=[20];
net=fitnet(hiddenLayerSize, 'trainlm');
net.divideParam.trainRatio=90/100;
net.divideParam.valRatio=5/100;
net.divideParam.testRatio=5/100;
[net, tr, Y, E, Xf, Af]=train(net,train_input_hz,train_output_hz);
net.trainParam.epochs = 100;
b1 = net.b{1};
b2 = net.b{2};
IW = net.IW{1,1};
LW = net.LW{2,1};
And I did find from various post that the output for the network is given as follows
%% Test the network
x_ref = [0.5 0.5 0.5];
y2_ref = b2 + LW*tanh(b1+IW*x_ref')
y_ref = net(x_ref')
while the reults of this do not match:
y2_ref = -0.2391
y_ref = 1.4543e+03
Is there a mistake in y2_ref = b2 + LW*tanh(b1+IW*x_ref') ? while y_ref is correct
0 commentaires
Réponses (1)
Ayush Aniket
le 26 Déc 2024
The reason behind the discrepancy between the output of the trained neural network and the analytical equation you are using is that the "net” object used by the “fitnet” neural network function in MATLAB uses pre-processing and post-processing functions to process the input and output data. You should add the following lines of code to apply the same process functions:
normalized_x_ref' = mapminmax('apply', x_ref', net.inputs{1}.processSettings{1}); %we are applying the same pre-processing as in the feedforwardnet
y2_ref = mapminmax('reverse', y2_ref, net.outputs{2}.processSettings{1});%we are applying the same post-processing as in the feedforwardnet
Refer to the following documentation page to read more about the process functions:
Additionally, take care of any non-linearity function used before the output layer.
0 commentaires
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox 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!