what is neural network sim function?

18 Ansichten (letzte 30 Tage)
Wang Xiaomeng
Wang Xiaomeng am 16 Okt. 2023
Beantwortet: Wang Xiaomeng am 25 Okt. 2023
I set the input layer with 2 neurons and a hidden layer with 3 neurons in Matlab ANN, and trained the model.
Why are these two methods lead to differernt output:
1.
z1 = IW * I' + b1; % Output of the first hidden layer
a1 = logsig(z1); % Apply the sigmoid activation function
z2 = LW1 * a1 + b2; % Final output
output = logsig(z2); % Apply the sigmoid activation function
2.
output = sim(net, I')
I really want to use the first method, but it seems something wrong with it.

Akzeptierte Antwort

Wang Xiaomeng
Wang Xiaomeng am 25 Okt. 2023
Thank you very much for your help.

Weitere Antworten (1)

Ayush Aniket
Ayush Aniket am 25 Okt. 2023
Hi Wang,
As per my understanding, the neural network analytical equations are not giving you the same result as through “simfunction. The reason behind this is that the "net” object returned by the feedforwardnet” neural network function in MATLAB uses pre-processing and post-processing functions to process the input and output data.
To achieve the same output through the “sim” function, you can add these lines to your code:
normalized_I' = mapminmax('apply', I', net.inputs{1}.processSettings{1}); %we are applying the same pre-processing as in the feedforwardnet
output = mapminmax('reverse', output, net.outputs{2}.processSettings{1});%we are applying the same post-processing as in the feedforwardnet
To read more about the process functions please refer to the following documentation page:
Hope it helps.

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by