How fitnet normalize/change the input?

7 vues (au cours des 30 derniers jours)
Javier Guallart
Javier Guallart le 21 Déc 2020
I'm trying to create a neural network that fits my data. I have my input and target data and the net achieves to fit it. But, as I wants to export the matrices (weights and bias) to another different environment, I want to know what operations the net is using to go from the input to the output when I evaluate an input.
X = importdata('INPUT.txt', ',', 0);
target = importdata('OUTPUT.txt', ',', 0);
net = fitnet(20);
net.layers{1}.transferFcn = 'poslin';
[net,tr] = train(net, X, target);
w1 = net.IW{1};
w2 = net.LW{2};
b1 = net.b{1};
b2 = net.b{2};
ej = X(:,1);
sol1 = w2*poslin(w1*ej+b1)+b2;
sol2 = net(ej);
See the last two lines. Why those values are not the same?

Réponses (1)

Shashank Gupta
Shashank Gupta le 30 Déc 2020
Hi Javier,
Yes your intution is correct. fitnet have some preprocessing and postprocessing involved. These processing functions are captured in the layer properties of the network.
For example, You can see the preprocessing of input by accessing Input layer, Giving a code snapshot for you to try.
% Process function
net.inputs{1}.processFcns
% Process function parameters.
net.inputs{1}.processParams{1}
and the same way you can access processing function for every layer(also output layer).
Try doing it, you will be able to get the correct answer.
Cheers.

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