1
$\begingroup$

When predicting a poly-neuron output in neural nets, say, predicting multiple handwritten digits and giving an output neuron vector (0.1,...,0.9,0.1,...), many use sth like softmax (or sth like the energy dependent probability exponential formula in statistical mechanics) to normalize the output vector such that all the components of the output vector sum up to 1, and that the normalized output vector becomes a probability vector. I doubt the necessity of this normalization, for without which I can equally well predict as per the biggest vector component. Is there anything I overlooked?

$\endgroup$
1
$\begingroup$

You are correct, but this is not called normalization. You can simply use the highest probability output for category. This is what softmax does for you. For example 2 output neurons can have 0.1 for dog and 0.9 for cat as the loss. Softmax will it just convert it to [0,1] meaning no dog but a cat is on the image.

$\endgroup$
  • $\begingroup$ What I mean by normalization is that softmax makes the components of the probability vector sum up to 1, which I don't deem a must. That's clear, I won't use softmax for this sheer aesthetic piece of pleasure. $\endgroup$ – feynman Nov 11 '18 at 9:23
  • $\begingroup$ You can do that as well. But if your loss is for example categorical_crossentropy then a softmax is needed because crossentropy requires a one-hot output. $\endgroup$ – Manngo Nov 11 '18 at 19:59
  • $\begingroup$ @ Manngo Sorry I don't get what you mean by categorical. If I have several digits to recognize, is that what you mean? $\endgroup$ – feynman Nov 12 '18 at 11:11
  • $\begingroup$ categorical_crossentropy loss requites data encoded as on-hot method as categories like [0,0,0,0,1,0,0,0]. This is what softmax does. $\endgroup$ – Manngo Nov 13 '18 at 10:23
0
$\begingroup$

Yes, you have overlooked something. Let me explain this with an example:

When training a neural network, you use the loss function as a signal to backpropagation. Now let us say that you have a network which outputs three categories: Cat, Dog, and Toad. Let's say the prediction of the network in an iteration is [0.7, 0.6, 0.3], although the data is, in fact, an image of a dog, meaning the truth is: [0 1 0].

Without a softmax layer, you cannot really tell much the network got the prediction wrong. In this example you might think the difference is 0.7 - 0.6 = 0.1, however after running a softmax, you realize that it is in fact 0.03, since the network was very strong in differentiating between the Toad category vs. Dog and Cat, so the loss is not as big as it seems.

Now as an experiment, run a neural network without the softmax layer and see for yourself, how severe it can affect the training. Not only that, but normalization of the input batches also makes a huge difference in training a network.

$\endgroup$
  • $\begingroup$ i got ur point. but i think whether it b softmax or my original idea of outputting a vector tag of 3 scalar components, the magnitude of the numbers or the relative differences between numbers are all artificially controllable or tunable? as long as i keep this in mind, i wont really care about, in ur softmax case, how big 0.7-0.6=0.1 is. if i stick to outputting a trinary vector tag, i'll train the network so that the contrasts between the numbers r huge enough. would u agree? $\endgroup$ – feynman Mar 4 '19 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.