W2_A2_EX-8_Y_prediction_train

Hello, I am in the last step of the evaluation. My Y_prediction has worked correctly so far in exercise 7, as well as every other function. In exercise 8, the Y_prediction_test is working well, but the Y_prediction_train does not, and I don’t understand why. It’s been several hours and I haven’t figured out why it works with the test but not with the train, being the same sigmoid.

Hi @Miquel_Ferre ,

Please download your notebook in ipynb format and attach to a direct message to me, I will have a look for you.

Hi @Miquel_Ferre ,

The call to predict() should be X_test first, follow by X_train. In your case, your code made the call to predict() with X_train first. This order of call is different from the test because the dataset used is different, resulting the error as reported.

Hi @Miquel_Ferre ,

In the predict() function, the testing of the activation output should be against the threshold of >0.5 for 1, otherwise 0. But your code is done in a very different way. Please see the implementation instruction to verify.

Thank you, you are right! Actually it was one of the points in which I didn’t make sense.