[Edited for new changes]
I spotted an error in the output of week 3 assignment. Specifically, when calculating the layer’s size, the returning output did not match the actual output. Here’s the corresponding assignment output, where the text suggested the size of input/output layer is 5/2 correspondingly.
However, the size of the input/output layer shall be 2/1 correspondingly:
{Moderator Edit: Solution Code Removed}
This annotation did not prevent me from getting the 100 scores, but it can be misleading for people working through those exercise.
Oh, I see. You are using the global variables in the function. Don’t do that. Also, the test function uses the different X and Y, not the same as defined in the early cell.
You had a different question before, your layer test had a different output than the expected output which I see now you got it eventually.
But now the question however is that annotation in the previous cell mislead you but didn’t prevent you from getting 100 scores. As mentioned by Saif, for this particular assignment the layer size test is not defined by the cell mentioned but by this
def layer_sizes(X, Y):
“”"
Arguments:
X – input dataset of shape (input size, number of examples)
Y – labels of shape (output size, number of examples)
Returns:
n_x -- the size of the input layer
n_h -- the size of the hidden layer
n_y -- the size of the output layer
"""
# YOUR CODE STARTS HERE
#(≈ 3 lines of code)
n_x =
n_h =
n_y =
# YOUR CODE ENDS HERE
return (n_x, n_h, n_y)
but probably you got confused by the hint given before this cell
Hint : Use shapes of X and Y to find n_x and n_y. Also, hard code the hidden layer size to be 4.
and as you must put the right code or change to the right code, you clear the test and scored 100.
P.S No one are suppose to share their any part of code in the graded cell as it is against the community guidelines. Kindly remove the codes in your snippets.
Also next time when have a query or you post a question, choose the appropriate Specialisation, Course and then week in topic section. (if you add the assignment name it can be more helpful) to get a faster response from the mentors in their respective community.
Is it correct to say that t_X and t_Y is different from the shape of X, and Y, hence the difference (5/2 vs 2/1)? Also, as shown on my page, my question is posted under Deep learning specialization-neural networks and deep learn, and I labelled ‘week 3’ in my title, is this not the right place to post? Trying to figure out the guide so I can post more appropriately next time.
The layer_sizes(X,Y) function should be a generic function, meaning that the input arguments defined in this function can have different value passed to it when making a call to the function.
For the unit test, t_X and t_Y were assigned a set of values which is different from X and Y. The key to getting this function to work for any X and Y is how your code access the input_size and output_size. If you read the comment at the start of this function, it clearly stated:
Arguments:
X – input dataset of shape (input size, number of examples)
Y – labels of shape (output size, number of examples)
you did select the specialisation and course correctly, but while selecting the course section if you had typed week 3, you would have got the specific weeks’ related posts for the issue you encountered or in case you want to post. Sometimes some of the week have two assignments. So that part of assignment name you can mentioned in your post, but while selecting the specialisation and then course, if you select week, it is more helpful for you and mentors to respond promptly.
As @Kic mentioned layer_size X, Y are generic function.
the exercise above this layer_size where you mentioned X.shape and Y.shape is a separate section and only mentioned so you understand how to apply the function.