This is a draft cheat sheet. It is a work in progress and is not finished yet.
Numbers
|
Generates an array of zeros, the dimensions are given by tuple. |
|
Generates an array filled with 1, the dimensions are given by tuple. |
np.random.*
|
Uniformly samples numbers from [0, 1] into an array of size tuple. |
|
Samples values from a Gaussian distribution with mean 0 and variance 1 into an array of size tuple. Note: Each dimension is a separate argument. |
Instance methods of np.array
mean() |
Mean |
var() |
Variance |
Matrices
|
Generates a matrix with the diagonal list and zeros elsewhere. |
|
Extracts the diagonal of the given matrix or two-dimensional array. |
|