How can we determine the number of neurons in a neural network? Is there any specific rule for that or is it a trail and error method? Can you please provide some references?
There is no rule on how to choose. You can use trial and error until you get what you expect, but this is difficult and time consuming. You can use different algorithms to do it for you (I used GA and PSO) or statistics. I'll leave a couple of papers for you to have a look.
As Alicia said, it is mostly trial and error. In my case, i tried various combinations of Layers and Neurons until the increase in complexity didn't increase significantly the classification score.
I think that the number of neurons in the input layer depends on the training data (dimension of the feature vectors) .. concerning the number of hidden layers and the number of neurons in each layer,as alicia and leonardo said, there isn't a specific rule for that ... they are usually determined empirically through a cross-validation methodology.
For number of input layer neurons, we can safely select number of columns or features in our dataset.
There are multiple options have been suggested but still better model could be achieved by trial and error. I have come across multiple such formulas suggested by others which helps in choosing right number.