Numpy
Creation
Andrew Ng Tips
Andrew Ng, call.reshape to document the size you expect things to be, its cheap
Don't use rank 1 arrays like
np.random.randn(5)
usenp.random.randn(5,1)
, rank 1 won't act as col or row
Info
x.shape[0]
Operations
Broadcasting
(m, n) +-/* (1,n) => (m,n)
if either row or col is 1, than that will be expanded to the proper size
Common ops
Reducers
Axis:
0 is vertical, column
1 is horizontal, row
default is all in 2D
keepdims keeps it as a matrix instead of collapsing to a 1D vector i.e (x, 1) instead of (x,)
Reshaping
Normalize
For normalizing machine learning stuff
Last updated