C2W3 Final assignment exercise 5 expected output accuracy

Hello,
After filling out the code (redacted) for exercise 5, and running the test code, I get an error, and notice the accuracy at the 5th decimal point and later doesn’t match. Is this expected behavior?

Your code for compute_cost() is not accurate enough.

These particular tests (by some unreasonable logic) is checking your result to 12 decimal places.

So I suspect your code for compute_cost() is doing some extra mathematical work, which is causing some small roundoff or truncation errors.

1 Like

Thanks for the reply. That is odd; I’ve tried using the various numpy helper functions instead of the regular operators for multiplication/summation. Any other ideas?

I re ran all the notebook cells from the top down, and changing the code to the numpy versions for mult/addition seems to have increased the accuracy, oddly. Thanks

1 Like

The assignment designers assumed you’d be using numpy.

1 Like