Hi there,
I am wondering if there is a problem with Exercise 2 of the assignment in week 3, or if I am missing something here.
From my understanding, the layers’ sizes should be n_x = 2 (2 coordinates), n_h = 4 and n_y = 1 (red: 0 or blue: 1). I encoded it using the shapes of X and Y to retrieve the input and output layers sizes, but the expected output says that it should be n_x = 5, n_h = 4 and n_y = 2.
Please let me know if there is a problem with the expected outputs or if I am missing something here.
Cheers,
Thomas
You should get n_x and n_y from the input parameters of the function.
The code we are writing here is “general” in the sense that it can handle different input dimensions. That is just a “unit test” for the layer_sizes function. There is no reason that the dimensions used in that test case have to agree with the dimensions of the “real” data that we will be using. If I recall correctly, they even make a comment to that effect in the notebook text for this test case.
Hi there,
Thanks, I did not realise that we were in an independent function.
I got mixed up with Exercise 1 where no function is used, and so I reused the shapes calculated previously.
Cheers,
Thomas
1 Like
I got tripped up on this as well. I saw the expected output and it really confused me for a while vs. the proposed network structure. It would help to clarify that the test is unrelated to the network.
The relevant point is the one I made in one of my earlier replies on this thread: we are always trying to write general code here. That’s the point of functions, right? They are reusable and give you code modularity, which is a huge win when you start building real systems. If we were ok with making everything hard-coded, then we wouldn’t implement it with functions: we’d just write the code “in place” the one way we wanted it.