Why do we have two neurons in the output layer?
What does each neuron mean?
If our classifier is a binary classifier, will we have only one neuron in the output layer?
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.Sign up to join this community
If you want multiple things out of your network you need multiple output nodes. In the case of multiclass classification you want multiple outputs, one for each class. These represent the probability distribution over the different classes. For binary you can get away with only one output because the other class has
1-P as the probability. You could say the same for multiclass that you need one less, however this is commonly parameterized with a softmax which needs all values for the denominator.
Other cases might be for example one output per pixel, for example for image segmentation.
Neural networks can be used for classification and regression tasks. They are also used for transcription and clustering. Each of them can have their own characteristics. For classification tasks you may have different classes. The trained network should flag the output with the greatest value among other outputs which corresponds to the appropriate input. In regression tasks, there are different situations. Suppose that you are given the input feature containing age, gender, height and other related things and you try to find the size of foot and size of length of hands simultaneously. I mean you have numerous inputs and numerous outputs. As an other example, in detection tasks, you are asked the place of the desired object. If you want to do that using neural networks, the output of your system consists of the center of the detected item, the height and the width of the detected item, which is a regression task.
The interpretation of outputs for regression tasks is like estimating a real value, this is why linear activation functions are used as the last layers' activation. For classification tasks it is like finding the probability. The probability that your network finds depends on the activation function used in the last layer. If your classes are mutually exclusive, and each input should have just one label, for
OCR tasks each image of number refers to just a single number so classes are mutually exclusive, the activation should be
Softmax and it represents the probability of belonging to each class. If the input may contain different classes, e.g. an image containing both cat and dog, you can use
Sigmoid activation which each output represents the chance of existing of each class. You can also take a look at here.