Neural network with softmax output function giving sum(output)~=1
Show older comments
Hi, I have an issue with training neural network with softmax output transferFcn. I have trained NN using code appended below:
net = feedforwardnet(6,'trainscg');
net.layers{2}.transferFcn='softmax';
net.trainParam.epochs = 100;
net.divideParam.trainRatio = 1.0;
net.divideParam.testRatio = 0.0;
net.divideParam.valRatio = 0.0;
net.trainParam.lr = 0.1;
net.trainParam.goal = 0.001;
net.trainParam.showWindow=0;
net = train(net,normX',outputLabels); %
where normX = 26,000 X 7 and outputLabels = 2 X 26,000. Output can be 0 or 1.
when I simulate network with same input data, I am getting output for 2 output units in the range of [0,1] but their sum is not equal to one. I have read and have also searched on web that using softmax one can get sum(output activation) = 1.
Please help me with this issue. Let me know if you need further information.
Thanks Regards Anshul
Accepted Answer
More Answers (2)
Categories
Find more on Deep Learning Toolbox 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!