How to choose the number of neurons in the hidden layer of neural network?

Illustration
mr.amit_singh - 2021-07-16T11:24:53+00:00
Question: How to choose the number of neurons in the hidden layer of neural network?

Hi, i'm using the neural network for classification using nnstart and i have dataset (input) with a size of 9*981 and i want to know how to choose the number of neurons in the hidden layer for it ?  

Expert Answer

Profile picture of John Michell John Michell answered . 2025-11-20

Use trial and error with the training subset goal
 
 
 MSEtrngoal = 0.01*var(trntarget,1)        % 1-D target
 or
 MSEtrngoal = 0.01*mean(var(trntarget',1)) % Otherwise
Start with the MATLAB default H = 10 and design ~10 nets for each setting of H. Each of the 10 is initialized with a different setting of random initial weights.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!