Choosing the number of hidden layers in a multi layer neural network.

21 views (last 30 days)
Hello, I am Deepti tryping to build a neural network using matlab. I am new to neural networks as well as MATLAB. I would like to know how to choose or predict the number of hidden layers for a multilayer neural network. Kindly help me out.

Accepted Answer

BN
BN on 19 Jan 2020
Edited: BN on 19 Jan 2020
Dear Deepti,
There is no rule to decide the number of hidden layers. It can be estimated through trial and error (experiment). Usually, one or two hidden layer(s) works well with simple to moderate problems.
Recent research in deep learning neural networks indicates that numerous hidden layers can be suitable for a complex object such as face recognition problems.
So I recommend you in the first, just using one hidden layer and look at if it is gain you min MSE (net.performFcn), it is suitable for regular researchers.
Please attention that the numbers of neurons in hidden layer is different with number of hidden layer terms. If your question is about number of neurons in hidden layer, I gonna tell you that although the number of neurons in hidden layers usually estimated through trial and error test too but there is a formula that presented to make it easy to estimate:
(Number of inputs + number of outputs) ^ 0.5 + (1 to 10). Use trial and error and find the 1 to 10 number and so optimal number of hidden layer neurons for the min MSE.
You can implement neural network using GUI
nnstart
Or using neural network code (I recommend it). In this case you can search and find so many example codes of neural network and learn from them.
You can read the blown article it is usegul:

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!