This is my code, and I get parameters in line parameters = initialize_parameters(n_x, n_h, n_y) before it’s referenced as you see below,
but I keep encountering an error such UnboundLocalError: local variable ‘parameters’ referenced before assignment
Can you please take a look?
====================. MY CODE ==========================
{moderator edit - solution code removed}
============== Error mesage ====================
UnboundLocalError Traceback (most recent call last)
in
----> 1 nn_model_test(nn_model)
~/work/release/W3A1/public_tests.py in nn_model_test(target)
261
262 t_X, t_Y = nn_model_test_case()
→ 263 parameters = target(t_X, t_Y, n_h, num_iterations=10000, print_cost=True)
264
265 print("W1 = " + str(parameters[“W1”]))
in nn_model(X, Y, n_h, num_iterations, print_cost)
34 # Forward propagation. Inputs: “X, parameters”. Outputs: “A2, cache”.
35 # A2, cache = …
—> 36 A2, cache = forward_propagation(X, parameters)
37
38
UnboundLocalError: local variable ‘parameters’ referenced before assignment