Course 1- week 2- Exercise 6- Optimize

Hi all,
I am getting wrong value error for my code. not sure whats wrong?
can you please help with this?

{moderator edit - solution code removed}

AssertionError Traceback (most recent call last)
7 print("Costs = " + str(costs))
----> 9 optimize_test(optimize)

~/work/release/W2A2/ in optimize_test(target)
63 assert type(costs) == list, “Wrong type for costs. It must be a list”
64 assert len(costs) == 2, f"Wrong length for costs. {len(costs)} != 2"
—> 65 assert np.allclose(costs, expected_cost), f"Wrong values for costs. {costs} != {expected_cost}"
67 assert type(grads[‘dw’]) == np.ndarray, f"Wrong type for grads[‘dw’]. {type(grads[‘dw’])} != np.ndarray"

AssertionError: Wrong values for costs. [array(5.80154532), array(0.32434521)] != [5.80154532, 0.31057104]

You wanted to update b, not db.

1 Like

In the same exercise, I did not understand how to propagate the gradient and the costs, or why am I getting the error “NameError: name ‘w’ is not defined” if w and b were copied from the previous exercise

Hi, Julia.

This means that you missed running one of the above cells. Try using shift+enter key from the beginning after saving your work. Hope, things would get resolved.

Thanks, I changed the computer I was working in and didn’t occur to me I had to run the above cells.

Thank you! I was having the same problem.