Wrong dj-db at initial w (zeros):

I got -0.2 at initial w (zeros), but the correct answer is -0.1.
This has affected my implementation of cost and gradient descent for non zero values of w. Below is the resulting error
ssertionError Traceback (most recent call last)
—> 10 compute_gradient_test(compute_gradient)

~/work/public_tests.py in compute_gradient_test(target)
51 dj_db, dj_dw = target(X, y, test_w, test_b)
—> 53 assert np.isclose(dj_db, 0.28936094), f"Wrong value for dj_db. Expected: {0.28936094} got: {dj_db}"
54 assert dj_dw.shape == test_w.shape, f"Wrong shape for dj_dw. Expected: {test_w.shape} got: {dj_dw.shape}"
55 assert np.allclose(dj_dw, [-0.11999166, 0.41498775, -0.71968405]), f"Wrong values for dj_dw. Got: {dj_dw}"

AssertionError: Wrong value for dj_db. Expected: 0.28936094 got: 0.8995208066624646

Please help me out

It seems your code is not computing the correct value.

Common errors are incorrect indentation within a for-loop, and adding b too many times when computing z_bw.

Thank you @TMosh.

Let me check for indentation errors and adding b many times in z_wb


Hello TMosh
I have checked for indentation error and my results are now double the expected:
dj_db at initial w (zeros):-0.2 dj_dw at initial w (zeros):[-24.01843317858231, -22.525684411027196]

Expected Output:

dj_db at initial w (zeros) -0.1
ddj_dw at initial w (zeros): [-12.00921658929115, -11.262842205513591]
Please assist me.


Thanks my mentor TMosh.
(attachment deleted)

I am sorry about that. Please how do send it privately? Can i have your email please?

Thanks, I will try that now.