Z matrix first row after multiplying A with W[layer 1]

How does X.W give the Z matrix, can you explain to me more? I am unable to understand how the first row became Z1 Z2 Z3 Z4.

Hi, first assume that you have an input of shape (2,3). It means that you have 2 examples and each example has 3 features. Then in hidden layer lets say you have 4 neurons. So the shape of weight matrix will be (3,4).
w=[[w11 w12 w13 w14]
[w21 w22 w23 w24]
[w31 w32 w33 w34]]

Now we are multiplying input*W. It will give us a shape (2,4). Lets say this output matrix is z.
so the z matrix is nothing but matrix multiplication of input and W.
Therefore,
z=[[z11 z12 z13 z14]
[z21 z22 z23 z24]]

For each input example there is corresponding row in z.
Therefore,
z= [[x11 x12 x13] * [[w11 w12 w13 w14]
[x21 x22 x23]] [w21 w22 w23 w24]
[w31 w32 w33 w34]]

So lets picturize z11 now:
z11=x11w11 + x12w21 + x13*w31

Therefore, z[i][j] is nothing but ith example of input(x) * jth column of w.

z= [[x11 x12 x13]] ******** [[w11 w12 w13 w14]

   [x21 x22 x23]]    [w21 w22 w23 w24]

                     [w31 w32 w33 w34]]

Please find the necessary indentation. And instead of multiple **** , it signifies matrix multiplication.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like