Art. Neural Network (ANN): How to get a binary output response

3 views (last 30 days)
Hello,
my questions concerns the use of the ANN via: 'output = net(x)'. In my case I use a pattern net with binary outputs (1,0). Thus my network gives me (correct) output probabilities between 0 and 1. But I want to have direct decisions of the network, wether the output is 1 or 0. Is this possible?
I know that I can do that myself using a simple threshold function (e.g.: … if output > 0.5…) or using more complex algorithms afterwards, but I think there should be a way to get this directly, doesn't it?
Thank you for your help!

Accepted Answer

Greg Heath
Greg Heath on 26 Nov 2011
If you have c classes/categories and the targets are the columns of the c-dimensional unit matrix, then the outputs are estimates of the input conditional posterior probabilities for each class.
The input is assigned to the class corresponding to the maximum output regardless of the type of activation function when one of the following are used:
softmax: 0 < P(i=c|x) < 1, sum(i=1:c){P(i=c|x)} = 1
logsig: 0 < P(i=c|x) < 1
purelin: sum(i=1:c){P(i=c|x)} = 1
Typically, the most important goal is correct classification and not necessarily the best estimate of the posteriors.
Use softmax if the best posterior estimates are desired. Otherwise use logsig and normalize to a unity sum after training. Since the estimates using purelin can be negative and/or exceed unity, you can dream up a number of ways to make them look appealing. But why bother when you can just as easily use the other functions?
Hope this helps.
Greg

More Answers (0)

Community Treasure Hunt

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

Start Hunting!