Unit test error when computing cost with non-zero w and b

When creating a post, please add:

I’m getting the following error when running the compute cost for w and b being non-zero for exercise # UNQ_C2

The compute cost for wand and b zero is working as well and the test for the first exercise # UNQ_C1 is also passing.

Can somebody help me understand what is wrong in my code ?
I can’t see see anything missing in the code, I did use all the hints provided and still getting this error in the specific unit test for non zero values for w and b

To make things a bit more confusing for me… when I did implement the code for UNQ_C3 (Compute gradient) and run it I get the right numbers as expected

but it fails in the Unit Test for that exercise as in the image bellow.

The most common error in this assignment is in not using the correct indentation within the for-loops.

Also be careful that you don’t just copy-and-paste the code from the hint sections. The text in the hints has some embedded formatting that the Python parser doesn’t like. You can see if your code has this issue by looking whether any of your code statements are show in a red font.

You should re-type the code from the hints, don’t copy-and-paste it.

Thank you for your input @TMosh,
I triple checked the indentation and I retyped the whole code to make sure there was no embedded formatting, even though there were not red font in my code.

In the end it was a formula that I added for z_wb that was wrong. I misunderstood the comments in the hint.
Still, I appreciate you taking the time to provide some hints here as well.

2 Likes