Error in exercise 8 dw value

All my previous exercises resulted in the correct output so i don’t know why this is giving an incorrect error. I would really appreciate if someone could help me out

My code for exercise 8

{moderator edit - solution code removed}

AssertionError Traceback (most recent call last)
1 from public_tests import *
----> 3 model_test(model)

~/work/release/W2A2/ in model_test(target)
121 assert type(d[‘w’]) == np.ndarray, f"Wrong type for d[‘w’]. {type(d[‘w’])} != np.ndarray"
122 assert d[‘w’].shape == (X.shape[0], 1), f"Wrong shape for d[‘w’]. {d[‘w’].shape} != {(X.shape[0], 1)}"
→ 123 assert np.allclose(d[‘w’], expected_output[‘w’]), f"Wrong values for d[‘w’]. {d[‘w’]} != {expected_output[‘w’]}"
125 assert np.allclose(d[‘b’], expected_output[‘b’]), f"Wrong values for d[‘b’]. {d[‘b’]} != {expected_output[‘b’]}"

AssertionError: Wrong values for d[‘w’]. [[ 0.14449502]
[-0.1429235 ]
[ 0.21265053]] != [[ 0.08639757]
[ 0.12866053]]

The problem is that when you call optimize from model, you are “hard-coding” the parameters for learning rate and number of iterations. That means you will always get the same answer regardless of what values are passed into the model function at the top level: you will always do 100 iterations with a learning rate of 0.009. That is why that test fails (it passes in different values and thus expects different answers).

You are also hard-coding the value of print_cost, which is a bug but doesn’t cause any tests to fail.

The key point here is that calling a function is a completely different thing than defining a function. You have just “copy/pasted” the definition of the function as the call. That does not work, because it forces the use of the declared default values every time.

Understood , I corrected my code and passed the tests.
Thanks a lot.