Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Rank 1 array:
- vector.shape = (n,) # Not a row, not a column either, can't .T it
- dataframe[column] => (n,)
- dataframe[[column]] => (n,1)
- vector.flatten # produce a rank 1 array
- vector.reshape(-1, 1) # produces a column vector. With -1, numpy calculate itself the length of the column
- np.expand_dims(image, 2) # Add a 3rd dimension, from (a,b) to (a,b,1)
- # Check size
- assert(w.shape == (dim, 1))
- # Check type
- assert(isinstance(b, float) or isinstance(b, int))
- # Warning with reshape
- a.reshape(a.shape[0], -1).T != a.reshape(-1, a.shape[0]) # not sure why, but when it reshapes, it has do to it in some order, which might not be the one we want
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement