Criteria for deciding number of layers in training model?

I have two queries.

  1. On what base do we decide the number of layers in model training?
  2. On which base do we decide the number of neurons in each layer?

I will be very thankful to you to solve my confusion.

Hi @Muhammad_Abrar_Hussa

This topic is discussed in this thread.
Also if you confused about some thing in the thread, feel free to ask it

Regards,
Abdelrahman

2 Likes

In addition to @AbdElRhaman_Fakhry 's thread suggestion, I would also like to add that there are several options:

  1. You can get started with a known model which has been created by some researchers, and this model proposes already a certain amount of layers, and nodes inside of each layer.
  2. You can start from scratch.
    2.1 Assuming you are a very experienced ML designer, may be you’ll get started with a configuration that, from experience, it is the best layout for the task at hand.
    2.2 Assuming you are a novice, you may start with your best guess. For instance, 2 hidden layers, each with 4 nodes.

This post includes more details on this topic.

Hi @Muhammad_Abrar_Hussa I just want to add this resource that I think it could help to have a systematic way of tuning the hyperparameters:

Short answer:
Experimentation.