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

M
mr.amit_singh · Jul 16, 2021 · 2.4K views
Question
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 PhD Expert
Answered Sep 12, 2026
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.
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!