When we vectorize the forward propagation step, we do the following calculation:

Z = w(transpose)*X +b

Here I understand that X is a n_x*m dimension matrix. But I do not quite understand the dimension of w

When we vectorize the forward propagation step, we do the following calculation:

Z = w(transpose)*X +b

Here I understand that X is a n_x*m dimension matrix. But I do not quite understand the dimension of w

Imagine first the situation with only one example, and 3 variables (x1 x2 x3 for â€śage, fortune, number of childrenâ€ť for example)

The role of w and b is to produce a set of linear (afine) combinations of those 3 variables (represented by the output nodes)

Suppose you want 2 output nodes. It means you will have 2 affine combinations to represent :

Y1 = w11x1 + w12x2 + w13x3 + b1

Y2 = w21x1 + w22x2 + w23x3 + b1

Therefore you need a 2x3 or 3x2 matrix, depending on how you will write this (with line vectors or column vectors for x and y)

With m examples, the same matrix will output m Y vectors, 1 for each example.

Hope that helps! Have a nice day!

1 Like

Thank you, Nicolas. I get it now