Week 3 5.2 Section problem

Hello everyone!
Need help with the problem in section 5.2 - Test the Model on the Planar Dataset.

Until this section, all tests were passed, but here, when I call

parameters = nn_model(X, Y, n_h = 4, num_iterations = 10000, print_cost=True)

it returns operands could not be broadcast together with shapes (1,400) (1,3)

And I’m not sure I really understand whats the problem is

You are referencing the global variables t_X and t_Y inside your nn_model function. That is a mistake. You should only reference the actual formal parameters of the function. That’s why it doesn’t work when you run the real training: you end up accessing the wrong X and Y values.

If you are not familiar with the concept of the “scope” of a variable, you might want to go read up on that idea on some of the python tutorial sites out there. python’s scoping model is not anything weird: it’s one of the “flavor vanilla” models.

Geeez, cannot believe Im THAT bling :rofl: Thank you so much for your help!