Output of feedfoward neural network problem.
9 views (last 30 days)
Show older comments
Hi everyone,
I work with the feedfoward neural network model of the toolbox neural network of matlab. I need to change the activation function the output layer by a logsig function insteed of the purelin function.
I write the following code:
NET = feedforwardnet(nbHidden);
NET.layers{2}.transferFcn = 'logsig'; % Change the activation function of the output layer by the 'logsig' function.
[NET,TR] = train(NET,Xtrain,Ytrain); % Ytrain equal to zero or one
And then I apply a test with four input and the expected output is [ 1 0 0 1 ]. But I get: [ 1 0.5 0.5 1 ]. In a more complex test, I have the same problem, the output min value is 0.5 and not 0. Did I miss something in the modification of the activation function?
Remark:
NET.outputs{2}.range
give
[ 0 1 ]
0 Comments
Answers (2)
Pooja Sethia
on 13 Feb 2018
Output of the neural network is the conditional posterior probability of the input. 'logsig' function gives 0< P(i = class| x) < 1. Therefore to get the binary output you need to normalize the probablities to unity sum after training.
0 Comments
See Also
Categories
Find more on Define Shallow Neural Network Architectures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!