In the making of a neural network , what determines how many hidden layers should be included in the network? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

In the making of a neural network , what determines how many hidden layers should be included in the network?

29th Dec 2017, 10:50 AM
Nawwar
Nawwar - avatar
7 Answers
+ 8
The cost of computing power :) Seriously, no actual law on this. A general rule of thumb is that one hidden layer is enough for most of the tasks. Unless the specifics of the problem is included - like CNNs for image recognition, might do better with 4-7 hidden layers than just one, as images might be searched for different properties by each of the filters. Check out the answer marked as best in the thread below - it is a reasonable summary without really scientific/theoretical approach: https://stats.stackexchange.com/questions/181/how-to-choose-the-number-of-hidden-layers-and-nodes-in-a-feedforward-neural-netw
29th Dec 2017, 10:58 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 8
No problem, I had the same doubts exactly with image classifier. Turned out the best approach was to start with one and increment the number until the model's accuracy stopped to increase. If you want to check it out: https://github.com/kuba-siekierzynski/CarL-CNN
29th Dec 2017, 11:22 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
wow , 128*128 is alot of neurons to begin with!
29th Dec 2017, 2:31 PM
Nawwar
Nawwar - avatar
+ 2
More hidden layers, more accuracy but more computational power should be required.
29th Dec 2017, 11:48 AM
Vijay
Vijay - avatar
+ 2
Just want to add one thing, I run the CNN program with one hidden layer on my PC( i3 processor, 4gb ram, inbulid graphics card). The program is to identify the cats n dogs. I have trained 8000 test images of size 128*128 . It took 8 hours to complete. If I want to add another hidden layer, I have to purchase GPU :)
29th Dec 2017, 2:12 PM
Vijay
Vijay - avatar
+ 2
Actually , it is very small size :)
29th Dec 2017, 2:45 PM
Vijay
Vijay - avatar
+ 1
Thank you!
29th Dec 2017, 11:09 AM
Nawwar
Nawwar - avatar