C1-W1: number of perceptrons in hidden layers

as I understand from prof Andrew that the only one how can decide number of perceptron’s in hidden layer is the developer himself. my question is when I decide to chose number of perceptron’s in hidden layer greater than the number of layer before? and if I decide to chose number of perceptron’s smaller than it (layer before) is there is any ratio should I consider ?

Typically the hidden layers are smaller than the input layer.

There are some rules of thumb, but they are not widely agreed on. These are just starting points:

  • Try the square-root of the number of input features.
  • Try the mean between the number of input and output units.

Thank for your answer @TMosh
just I want to ask you about what you mean about square root of number of input and mean between input and output could you please give me an example for more understanding.

Examples:
If there are 400 input features, then start with 20 units in the hidden layer.
If there are 20 input features and 10 output units, then start with 15 units in the hidden layer.

These are just rules of thumb as a starting point. Adjust the size of the hidden layer as required to get “good enough” results.

thank @TMosh I’m really appreciate your effort to help me