Hello there,
I’m having trouble when initializing my parameters. The error message refers to global variables, as follows:
However, the only variables that I have used to define W1, b1, W2, b2 are n_h, n_x and n_y, which are the arguments of this function. Perhaps I don’t fully understand the concept of global variables?
I’d appreciate it if you could point me in the right direction.
UPDATE: Even though my values for the initialize_parameters function don’t match the expected output, I was able to correctly implement the forward_propagation function, and the results perfectly match the expected output. I still don’t understand what happened above.
Thanks.
The thing about global variables is just a suggestion and turns out to be a red herring in this case. The better clue is that all your values are positive. That probably means you used the wrong random function: e.g. rand instead of randn. They literally wrote the correct code for you in the instructions: please compare what you wrote to what they show.
1 Like
Thanks so much for the quick reply, that’s exactly what happened. I was so focused on finding a mistake in the variables that I completely missed the ‘n’ in the np.random.randn function.
Hopefully this might help someone else in the future, who may be as lost as I was with the global variables error message.
1 Like