In a classification problem, how do you decide on the number of output neurons you have in your neural network? Is the number of neurons equal to the number of classes you have?

Is there a limit on the total number of output neurons that you can have in the output layer? My network seems to have thousands of output neurons. What are the disadvantages of having a large number of neurons?

  • 1
    $\begingroup$ You are right when you say " number of neurons equal to the number of classes you have". $\endgroup$
    – itdxer
    May 19, 2016 at 16:32

1 Answer 1


I am a total novice to this, but my understanding is the following:

input layer - one neuron per input (feature), these are not typical neurons but simply pass the data through to the next layer

hidden layers - simplest structure is to have one neuron in the hidden layer, but deep networks have many neurons and many hidden layers.

output layer - this is the final hidden layer and should have as many neurons as there are outputs to the classification problem. For instance:

  • regression - may have a single neuron
  • binary classification - Single neuron with an activation function
  • multi-class classification - Multiple neurons, one for each class, and a Softmax function to output the proper class based on the probabilities of the input belonging to each class.

Reference: https://machinelearningmastery.com/deep-learning-with-python/

  • 1
    $\begingroup$ @jeffalltogther thank you that makes sense! I looked at the reference you used. The book teaches you how to deep learning. Do you own that book? Do you recommend it for someone who is designing his own model? $\endgroup$
    – M J
    May 19, 2016 at 17:42
  • $\begingroup$ I would recommend it. It is shallow on the technical aspect of Neural Networks and Deep Learning, but extremely practical. It will get you coding in 30 min or less depending on how familiar you are with installing Python libraries for Deep Learning. One of the author's newer references at the time of this post, so mind the typos. $\endgroup$ May 19, 2016 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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