C2_W1_Assignment - How is number of units decided in each layer

Hello @Mentors,

I have completed the assignment but had a query. We have this image which tells us the number units to be defined in each layer 1, layer 2 and layer 3.

My query is how did we conclude on 25 units for layer1 and then 15 units for layer2 and 1 unit for layer3. What I am thinking is if I had to execute this exercise independently then how would I have gone about. Also why did we stick to only 3 layers and not 5 or more?

It would help if you could clarify and provide guidelines to be followed if we have to do something similar on different data with different sample size etc.

The number of layers, and the size of each layer, is found through experimentation.

The main guide is that for efficient training and predictions, you want to add as little complexity as possible - only what is necessary to get good enough results.

1 Like

In this case what kind of experiments we did that we reached to 25 units for layer 1 and then 15 units for layer 2 and 1 for layer 3? and why only 3 layers.
Please help understand this better so that we can use this understanding.

Start with one hidden layer.
Start with a small number of hidden layer units.
Train the system.
Measure the system performance using a test set or a validation set. There is more discussion of this later in the Specialization.
If you don’t get good enough performance, then increase the number of hidden layer units and try again.
If you can’t get good enough performance with one hidden layer (or if you’re teaching a class about how NN’s work), then add a second hidden layer and start the process over.

There really isn’t a cookbook procedure for this.

Okay thank you !!
Looking forward to the coming weeks.