Output of feedfoward neural network problem.

조회 수: 9 (최근 30일)
Rémi Souriau
Rémi Souriau 2018년 1월 25일
답변: Rémi Souriau 2018년 2월 13일
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 ]

답변 (2개)

Pooja Sethia
Pooja Sethia 2018년 2월 13일
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 2018년 2월 13일
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.

Community Treasure Hunt

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

Start Hunting!

Translated by