I do think I understand what you are getting at in terms of local and global (or last used vs. default)
For the definition of the model function, because the default value assigned to num_iterations is 2000 and the default value assigned to learning_rate is 0.5, those are the values that will be used by default by the call to the optimize function were I to write optimize(w, b, X, Y).
And if I assign values to those two parameters in the call to optimize, I am hardcoding and, as you say, that will not end well.
So that leaves simply calling optimize by naming all the parameters without assigning values to num_iterations and learning_rate ; for the test this will pass the values as specified in public_tests.py.
So when I use those same values in the call to optimize within my cell that defines model, why would model_test(model) throw the same error I have been getting pretty much all along:
AssertionError Traceback (most recent call last)
in
1 from public_tests import *
2
----> 3 model_test(model)
~/work/release/W2A2/public_tests.py in model_test(target)
131 assert type(d[‘w’]) == np.ndarray, f"Wrong type for d[‘w’]. {type(d[‘w’])} != np.ndarray"
132 assert d[‘w’].shape == (X.shape[0], 1), f"Wrong shape for d[‘w’]. {d[‘w’].shape} != {(X.shape[0], 1)}"
→ 133 assert np.allclose(d[‘w’], expected_output[‘w’]), f"Wrong values for d[‘w’]. {d[‘w’]} != {expected_output[‘w’]}"
134
135 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.00156082]
[-0.00157362]
[-0.00216182]
[ 0.00229691]] != [[ 0.08639757]
[-0.08231268]
[-0.11798927]
[ 0.12866053]]
I really do apologize for my inability to grasp this. I know it must be very frustrating for you in your role as a helpful tutor (having taught and tutored math).