Common used functions import numpy as np We use numpy.random package to generate an array of random values instead of looping through the random generation of one variable. np.random.randn() Return a sample (or samples) from the “standard normal” distribution.
2020-11-23
x = np.array([[1, 2], [3, 4]]) print(x) print(x.shape) [[1 2] [3 4]] (2, 2) x1 = np.tile(x, (1, 2)) print(x1) print(x1.shape) [[1 2 1 2] [3 4 3 4]] (2, 4) Numpy tile Reference numpy tile documentation
2020-11-22
View in nbviewer: Numpy 1D Array
2020-08-31
View the summary in nbviewer: Numpy basics Universial function Aggregations Broadcasting Boolean masking Fancy indexing Sorting Structured array
2020-08-31
TL;DR Stack of Numpy array Prepare Data import numpy as np x1 = np.array([[[9, 3, 7, 3], [2, 1, 1, 2], [1, 4, 2, 5]], [[5, 5, 2, 5], [7, 7, 6, 1], [6, 7, 2, 3]]]) x1 array([[[9, 3, 7, 3], [2, 1, 1, 2], [1, 4, 2, 5]], [[5, 5, 2, 5], [7, 7, 6, 1], [6, 7, 2, 3]]]) x2 = np.
2020-08-16