In doing numpy.random function usage summary, after encountering add.
See the following article:
https://www.numpy.org/devdocs/user/quickstart.html
https://github.com/iamseancheney/python_for_data_analysis_2nd_chinese_version
1.numpy.random.random(size = None)
. 1 Import numpy AS NP 2 '' ' . 3 np.random.random (size = None) . 4 Number specified array size ranks, return [0,1) floats 5 ' '' 6 # obtain a single value . 7 z_train = NP. random.random () . 8 Print (z_train) . 9 10 # to obtain an array of 1 * 1 . 11 m_train = np.random.random (1 ) 12 is Print (m_train) 13 is 14 # to obtain an array of 2 * 15 x_train = np.random. Random (2 ) 16 Print (x_train) . 17 18 is #4 * 3 array obtained, the attention of a single, unitary size . 19 y_train np.random.random = ((3,4- )) 20 is Print (y_train) 21 is 22 is # obtain a floating point number between [-1,1) 23 is p_train = (np.random.random (2) -0.5) * 2 24 Print (p_train)
2.numpy.random.randn()
. 1 Import numpy AS NP 2 '' ' . 3 numpy.random.randn (D0, D1, ..., DN) . 4 returns one or a set of samples, with a standard normal distribution, desirably 0 and variance. 1 . 5 DN is dimension 6 '' ' . 7 . 8 # return a single value . 9 Print (np.random.randn ()) 10 . 11 # returns an array of 1 * 1 12 is Print (np.random.randn (1 )) 13 is 14 # return 3 * 3 array 15 Print (np.random.randn (3,3 )) 16 . 17 # returns 3D array 18 is Print (np.random.randn (3,3,3))