ML course WL programming task error

When creating a post, please add:

  • Week # must be added in the tags option of the post.
  • Link to the classroom item you are referring to:
  • Description (include relevant info but please do not post solution code or your entire notebook)

Getting the error in Week 2 programming test:

=======================

AssertionError Traceback (most recent call last)
in
6 print(‘Gradient at initial w, b (zeros):’, tmp_dj_dw, tmp_dj_db)
7
----> 8 compute_gradient_test(compute_gradient)

~/work/public_tests.py in compute_gradient_test(target)
60 dj_dw, dj_db = target(x, y, initial_w, initial_b)
61 #assert dj_dw.shape == initial_w.shape, f"Wrong shape for dj_dw. {dj_dw} != {initial_w.shape}"
—> 62 assert dj_db == -2, f"Case 2: dj_db is wrong: {dj_db} != -2"
63 assert np.allclose(dj_dw, -10.0), f"Case 1: dj_dw is wrong: {dj_dw} != -10.0"
64

AssertionError: Case 2: dj_db is wrong: -0.6640625 != -2

========

UNQ_C2

Sharing grade cell codes is against community guidelines.

Hi @umaidshafeeq

This assertion error indicates that there is a problem in your implementation of computing derivatives. Make sure that your code logic is correct!

Hope it helps! feel free to ask if you need further assistance.

I recommend you start by carefully inspecting your code in compute_gradient() for correct indentation.

If you have copied the “hint” code, it probably has indentation errors. Look for any code text that is in a red font. That indicates an indentation error.