Logistic_Regression_with_a_Neural_Network_mindset "wrongly classified"

Hi folks. I had a question about the lab “Logistic_Regression_with_a_Neural_Network_mindset”. In particular, running the cell labeled “# Example of a picture that was wrongly classified.”

With that header, I assumed it was expected itself to present such a case. Maybe we are supposed to go look for one? Because the default one, index 1, is once, twice, three times a cat:

  1. it looks like a cat to me
  2. it is labeled as a cat
  3. it is predicted as a cat

Example of a picture that was wrongly classified.

index = 1
plt.imshow(test_set_x[:, index].reshape((num_px, num_px, 3)))
print ("y = " + str(test_set_y[0,index]) + “, you predicted that it is a "” + classes[int(logistic_regression_model[‘Y_prediction_test’][0,index])].decode(“utf-8”) + “" picture.”)

y = 1, you predicted that it is a “cat” picture.

In other courses, there was code to scan for mismatches. I may put that in myself. But is this expected? Maybe it’s just luck that my model happened to categorize this one correctly? My percentages were normal.

My model in JSON:
cat_model.txt (658.1 KB)

I added this. First mismatching index was five, a butterfly:
indexes = [i for i in range(len(test_set_y[0])) if test_set_y[0,i] != int(logistic_regression_model[‘Y_prediction_test’][0,i])]
index = indexes[0]

I got the same result for test image 1 that you show, so I think what is happening here is just that they are just being lazy. Note that they say:

Using the code below (and changing the index variable) you can look at predictions on pictures of the test set.

So it looks like they are expecting you to do the work of finding a sample for which the prediction is incorrect. It would be simple enough for them to write the code to select incorrect predictions. Or at the very least they could change the index given to one that is known to be incorrect. Maybe in some earlier incarnation of this assignment index = 1 was actually incorrectly predicted. I’ll file an enhancement request suggesting that.

I had noticed this before, but didn’t take any action on it. Thanks for bringing it to everyone’s attention!