Contents
The number of hidden neurons should be between the size of the input layer and the size of the output layer. The number of hidden neurons should be 2/3 the size of the input layer, plus the size of the output layer. The number of hidden neurons should be less than twice the size of the input layer.
two hidden layers
In fact, there is a theoretical finding by Lippmann in the 1987 paper “An introduction to computing with neural nets” that shows that an MLP with two hidden layers is sufficient for creating classification regions of any desired shape.
How does a feed forward neural network work?
A feed-forward neural network applies a series of functions to the data. The exact functions will depend on the neural network you’re using: most frequently, these functions each compute a linear transformation of the previous layer, followed by a squashing nonlinearity.
What should the number of hidden neurons be?
The number of hidden neurons should be 2/3 the size of the input layer, plus the size of the output layer. The number of hidden neurons should be less than twice the size of the input layer. These three rules provide a starting point for you to consider.
What happens when there are too many neurons in a neural network?
An inordinately large number of neurons in the hidden layers can increase the time it takes to train the network. The amount of training time can increase to the point that it is impossible to adequately train the neural network. Obviously, some compromise must be reached between too many and too few neurons in the hidden layers.
The first layer transforms the inputs into something that the second layer can use so that the whole network can perform XOR. Slide 61 from this talk –also available here as a single image–shows (one way to visualize) what the different hidden layers in a particular neural network are looking for.