Getting your matrix dimensions right

for above neural network.

1 - Number of x and hidden units

2 - Non-vectorized Implementations

2.1 - Dimentions of and parameter

Patterns

when

: (2,4)

: (1,2)

Formula to check the dimensions of parameter w,

2.2 - Dimentions of parameter

is a (3,1) vector, so has to be a (3,1) vector

General rules are

so Formula to check the dimensions of parameter b,

2.3 - Dimentions of dw and db

2.4 - Dimention of

Since so the dimensions of and are the same.

3 - Vectorized Implementations

3.1 - Non vectorized

Dimentions of , :

3.2 - Vectorized

Since so the dimension is

Since , so the dimension is

is still but python will broadcast it to

Dimentions of , :

Dimentions of , :