问题
I have read posts and articles that talk about finding the right number of hidden layer and number of neurons in each hidden layer for a classification problem. However, I couldn't find any relevant information for regression?
Can someone help explain the calculation of right number of hidden layer and neurons in them?
回答1:
The is no calculation for the "right" number of hidden layers and neurons in them.
Trying to find the best model by tuning the number of hidden layers and neurons in them is a very difficult optimization problem. The best model is one that has the highest accuracy (in case of classification) or minimum loss (in case of repression) etc. To find such a model, the current approach is using trail and error or deciding on parameters from past experience.
Parameter optimization is a new field of research where algorithms are used to try and find the best hyper parameters (hidden layers, neurons, learning_rates etc.) that results in the best model.
Here's an research paper that makes use of Particle Swarm Optimization (PSO) to try and find optimal hyper parameters.
回答2:
As @skillsmuggler pointed out:
There is no calculation or formula or find out the number of layers/neurons, its sort of a trail and error with parameter customization and optimization.
There is one parameters that I think could have an impact on the number of layers/neurons and its the size of the dataset. If the dataset size is relatively small the size of your network should not be "large" (based on my practice) or your module will get overfit pretty quickly.
You can read the 'How to prevent Overfitting in your Deep Learning Models' for more information.
来源:https://stackoverflow.com/questions/59447801/how-to-find-the-number-of-hidden-layers-and-neurons-in-each-hidden-layer-for-reg