Week 2 - Python and Vectorization

Vectorization

• $Z = W^TX+b , W \in \mathcal R^{n_x} , X \in \mathcal R^{n_x}$
• if non-verctorized:
• if vectorized:
• it is much faster

Vectorizing Logistic Regression

• b is real number, it will be automatically changed to vector to be added each element of matrix (python broadcasting)

A note on python/numpy vectors

• to simplify code and to avoid bug, don't use rank 1 array