How fitnet normalize/change the input?
8 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Shashank Gupta
on 30 Dec 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.
0 Comments
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!