C1 W2: Help, I've encountered an error although my code seems to be right

Please do not post your code on the forum. That’s not allowed by the Code of Conduct.
It’s fine to post any error messages or asserts.
If a mentor needs to see your code, we’ll contact you with instructions.

Im so sorry about that

No problem. I’ll provide some hints shortly.

Thanks for the help!

A few issues here in the model() function:

  1. To initialize with zeros, use the function you created for that. And for reference, when you initialize a matrix, it should almost never use hard-coded values. Your code will always be tested using different sizes of data set. A hard-coded value will never pass those tests.
  2. Why are you getting the ‘m’ value, which you don’t need here?
  3. Indentation is vital in python. Some of your code is indented too far.
  4. Don’t hard-code print_cost to False here. It’s a variable.
  5. Y_prediction_test should use the test set, not the training set.

doodles :slight_smile:

nice way of explaining Tom

I should get a stylus so I can write text on images better. I’m really bad at writing with a mouse.

I understood your doodling.

Hope the post creator also understands. It is explained well with doodles and text. So that should not be problem.

He can always ask if he has doubts.

Once should find different creatives ways of learning and helping each other, and simple ways are the best ways just like doodles

Thank you so much I fixed the code and all cases have passed. Your explanation made it simpler to understand indeed.

@tejesh_reddy, that’s great news!

1 Like