It seems that auto-grader has an issue with the result of “compute_cost” function.

Assumed correct result (according to the notebook) is “cost = 0.6930587610394646”. Also my code reaches “cost = 0.6926858869721941”.

However the auto-grader gives an error that “Expected: 0.5447066599017815 got: 1.0493608309109266” which neither the expected nor calculated value are as in the notebook!

It can be seen better in the screenshot!

You are getting the expected output for `compute_cost_test_case`

and failing `compute_cost_test`

. Please fix your code.

As Balaji points out, there are two completely separate test cases there. Those errors mean your code is incorrect. The first output value may look “close enough”, but an error in the third decimal place is not a rounding error: it’s a real mistake. The 0.692xxxx value is what you get if you literally take the sample code they gave you as the complete solution. It’s not and they even mentioned that in the instructions, although perhaps the way they phrased it was a little too subtle. Compare that code to the mathematical formula for the cost and ask yourself two questions:

- What happened to the factor of 1/m?
- Why is there only one term? What happened to the Y = 0 term?

1 Like