How to Decide no. of units of a layer

my question is how to decide the no. of units to be used in a layer of classification neural network?
As i have seen that for digit recognition classification problem, there was 25 units in layer-1, 15 units in layer-2 and 10 units in layer-3. But how can we decide no. of units, layers needed for any other problem?


Unfortunately there is no formula to predict how to configure the NN for every problem. We usually get to a better (NOT the best) NN by trials and errors and through this process we keep evaluating our current choice of NN architecture with a cv set. Since you are posting this question in the course 2 week 2 category, I would suggest you to also go over the videos in week 3 when the time comes, and get some tastes of how we evaluate the goodness of a model candidate in terms of overfitting and underfitting.