C1_W3_Lab02_Logistic Regression Error Code

I’m stuck at Exercise 3 in this practice lab.
I am getting the expected outputs in
#compute and display costs and gradient with non-zero w
but I’m also getting this error:
ValueError Traceback (most recent call last)
in
8
9 # UNIT TESTS
—> 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)
52
—> 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}"

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I don’t understand what that means. Any assistance greatly appreciated.

It means your code doesn’t return the correct value for dj_db when it’s checked by the unit test.

Further, since it cites the “truth value of an array”, it’s likely that your dj_db is actually an array, when it should be a scalar.

Thank you. Got it sorted out.