Final exercise in logistic regression

I used a normal for loop implementation and it works fine. I tried to use vectorized and I got the result dj_db = -0.6 and expected result should be as shown-0.9999999999991071 I think the AssertionError because that. Is there way to got a whole digits of number without a round it up, Or maybe my code has problem in calculation ?

You do not need a whole-digit result. The issue isn’t due to rounding. There is likely a mistake in your code for the vectorized version.

The compute_gradient_test() function checks your code with an entirely different set of conditions.
Your code is failing one of those tests.

All of the tests use a small threshold around the expected result, to avoid issues due to calculation accuracy issues with different methods.

1 Like