dj_db at test_w: -0.6

dj_dw at test_w: [-44.83135362 -44.37384125]

**Expected Output**:

|**dj_db at initial w (zeros)**|-0.5999999999991071|

|**ddj_dw at initial w (zeros):**|[-44.831353617873795

7, -44.37384124953978]|

dj_db at test_w: -0.6

dj_dw at test_w: [-44.83135362 -44.37384125]

**Expected Output**:

|**dj_db at initial w (zeros)**|-0.5999999999991071|

|**ddj_dw at initial w (zeros):**|[-44.831353617873795

7, -44.37384124953978]|

I suggest you to check out the public test by clicking â€śOpenâ€ť > â€śFileâ€ť > â€śpublic_tests.pyâ€ť where you will find the test function `compute_gradient_test`

, and then you know how the X and y are generated for the test case. You can generate the X yourself by copying, pasting and running the first 5 lines of code in the function on your jupyter notebook. Then you can print `X`

out to inspect the content. Since there are only 7 samples in this test case, try to compute, with paper-and-pencil, the gradient for the first sample using (1) your code and (2) the maths formula, and if it doesnâ€™t match, then you have a good lead to find out the problem; if it matches, repeat the comparison for the next sample until you find a mismatch.

But the results approx correct

Thank you, I got it.

1 Like

Itâ€™s great! Nothing is better than you being able to debug your code

Raymond