C2 W1 assignment question

{removed by mentor}

Hello,

I got a little confused in week 1’s assignment exercise 2. I understand we are taking the dot product of a_in and w here and then applying the sigmoid function, but why do we define a_in as a 1D array in this line of code:
x_tst = 0.1np.arange(1,3,1).reshape(2,)
Shouldn’t we write 0.1
np.arange(1,3,1).reshape(2,1) and make it 2D since w is 2D? I know the code works when we say reshape(2,) as well but I don’t understand why it works.

Hi @Meltem_Durdu,

This is all about whether the operation you use on W and a_in will produce the expected result. I recommend you to read about np.dot, and try to dot arrays of shapes that you are concerned, and even better if you try different combinations of shapes to dot with. In this way you will know how the operation (np.dot) behaves in different situations.

Good luck!
Raymond

PS: I am removing the screenshot since it is not allowed to share solution.

A post was split to a new topic: C2_W1_Assignment question