Week 3 Lab 1: Planar Data classification output layer

Hi,

In programming assignment, we are trying to classify given data in two categories, so the Neural network is expected to have two neuron in output layer right? layer_sizes_test_case() gives n_y as ‘2’, but later initialize_parameters_test_case() provides n_y as ‘1’. What do these two functions exactly mean?

There are two equivalent methods for handling a dataset with only two labels.

  • We can define them as True and False, then we only need one output.
  • Or we could define two outputs, one for each label, and then accept whichever of them has the highest activation as the prediction.
1 Like

Also note that we are trying to write our supporting functions to be general. So, for example, the test cases don’t always use the same dimensions as our “real” data that we’re actually going to feed to the function. E.g. in the general case, they don’t always want to have n_y = 1, so the test makes sure you wrote the code correctly and didn’t hard code n_y to always be 1.

1 Like

Thanks !!