"Number of Neurons and Number of Layers in Hidden LayerThe 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."
If the data is less complex and has fewer dimensions or features, then neural networks with 1–2 hidden layers would work.
If data has large dimensions or features, 3–5 hidden layers can be used to get an optimum solution.
It should be remembered that increasing hidden layers would also increase the complexity of the model, and choosing hidden layers such as 8, 9, or two digits may sometimes lead to overfitting.
Choosing Nodes in Hidden Layers
1. The number of hidden neurons should be between the number of features in the (input + output) layers.
2. The most appropriate number of hidden neurons is sqrt(input layer features * output layer features).