Lab C2 W1: Why does layer 1 have 25 units?

When creating a post, please add:

It’s a 3 layer NN in which the first layer has 25 units, and the second has 15. The first times they are addressed, I don’t think we saw the data that was associated, but it was a useful example to demonstrate different levels of complexity with NNs.

But now that I’m on the Practice Lab for Week 1 of Course 2, I’m seeing the same NN shape this time for a specific use case: determining whether an image is a handwritten 1 or 0. What is it about this use case or data that would dictate that the first layer should have 25 units and the second layer 15 units. Is that arbitrary? Is that a complicated thing that we’ll learn later?

This seems to be one of the few bits of configuration that we need to pass to TF. It seems important for me to know how to determine what values to pass (or even how many layers to configure for that matter). If there was an explanation, I missed it.

Thanks.

1 Like

Hi @chucci ,

Prof Ng didn’t go into details on the design of a neural network. It is the job of a NN architect to design how many layers and how many units on each layer. Experience helps. Here is a thread on stackoverflow discussed the same issue.

Yes, the StackExchange article that Kic links gives has a great discussion of this question. I haven’t taken the MLS series, so I’m not sure what Prof Ng says there, but it is a considered an “introductory” level course I think. In the DLS specialization, which is more advanced and looks only at Deep Neural Networks, Prof Ng spends quite a bit of time in DLS Course 2 on how to design a network to solve a given problem and how to approach tuning networks in a systematic way. It’s not a simple question, so he spends essentially a whole week of the course on this and then the topic also comes up in DLS Course 3 looking more at questions like how to assess whether you have enough training data and the like.

So it’s a great and important question, but one which doesn’t have a simple answer. Please “hold that thought” and keep going to hear more from Prof Ng in DLS.

1 Like