I'm trying to separate classes in 3D space, the data are as in the sketch below:

enter image description here

There are 3 classes: 0,1,2; and with the look into the sketch, it seems that I need 3 planes to separate the classes, thus how many hidden layers should be in the DNN? Any roughly how many neurons in each layer?

Some say the number of hidden layers is roughly the number of separation times, so I put 3 hidden layers and it worked! But any reasons behind that simple measure?


1 Answer 1


You need to perform Hyperparameter Tuning to identify -

  1. Number of hidden layers.
  2. Number of neurons in each of the hidden layers.
  3. Dropout
  4. The activation function you use in each of your hidden layers.

There parameters are only related to how you build your model. There are others that relate to training like batch size, number of epochs and so on. Your model's performance ultimately depends on how well you tune your hyperparameters.

Also note that hyperparameter tuning is a trial and error task because it depends on several factors that may not be obvious to us. With experience, experts do build certain thumb rules about what may be the right choice, but there is no way to generalize it. "Some say the number of hidden layers is roughly the number of separation times" - is just another thumb rule. You simply need to find out what best suits your scenario.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .