Week 3 assignment

Hi Everyone,
Initially in the exercise 1 when 1 give the command to know the size of training set I got the output as
The shape of X is: (2, 400)
The shape of Y is: (1, 400)

But when in exercise 2 when i have to know the size of input layer I gave the command as ‘n_x=X.shape[0]’
and the output was-
n_x = 5

But as the shape of X is (2,400) so it should get 2 as an output why this isn’t so please help.

X is not the same in exercise 1 and exercise 2, in exercise 1 it is the result of executing X, Y = load_planar_dataset() in the exercise 2 it is the result of t_X, t_Y = layer_sizes_test_case().

You can check the shape of X and t_X in both cases.

1 Like

Ok I got your point , thankyou sir.

I understand, I had the same mistake at the beginning. However, the code starts like this:
def layer_sizes(X, Y)
Shouldn’t it be:
def layer_sizes(t_X, t_Y)?

Thank you for your reply,


Hi @petril48, the names of the input parameters of a function are “somewhat irrelevant”. A simple example to show it:

# let's define a simple function
def calculate_square(x):
       return x*x

# you could have
x = 2

# but you could also have something like
# the name of the variable is not important here
a = 3

# the name is only important when you call the function using the 
# parameter's name, for example
a = 3