Output of feedfoward neural network problem.

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 ]

Réponses (2)

Pooja Sethia
Pooja Sethia le 13 Fév 2018

0 votes

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.
Rémi Souriau
Rémi Souriau le 13 Fév 2018

0 votes

I have two classes (0 or 1) for one output. I do not get how do you want normalize the output.
I finally found another topic on the same issue.

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by