C2_W1_Lab02_CoffeeRoasting_TF the network learned graphics

Can anybody explain when the number of neuron in Layer1 is 2 or 4 (not just right 3), the graphic will turn to what? Further more, if we should construct a network, how can we make sure the number of neurons should we have? Only rely on draw a plot, we can have 3 decision line, then we select 3?

Hi @Peixin_Guo, Welcome back to the community!!

For illustration purposes, only three units have been used in this example to show how each unit is responsible for different regions. Using only two units may prevent the neural network from learning different regions for this particular example. On the other hand, using four units may be able to capture complex decision boundaries, but there is a higher risk of overfitting.

You cannot rely on the plots because it is difficult to visualize a large neural network. Therefore, if you want to determine the optimal number of neurons in the hidden layers, you should try different numbers of neurons and evaluate the model’s performance. You will learn more about model evaluation in week 3.


Hi, @Mujassim_Jamal :slight_smile:
Thank you for your answer, I understand