标签:根据 span rand and 之间 2.3 int 函数 dom
(1)numpy.random.rand(d0,d1,…,dn)
rand函数根据给定维度生成[0,1)之间的数据,包含0,不包含1
dn表格每个维度
返回值为指定维度的array
(2)
print(np.random.rand(2,4))
生成一个2行4列的0到1之间的数组
[[0.16965512 0.97445517 0.51992353 0.73377611]
[0.91446815 0.65995296 0.67720307 0.34809015]]
print(np.random.rand(4,3,2))
[[[0.10401912 0.82232074]
[0.68653479 0.07301172]
[0.59939558 0.58055146]]
[[0.03088151 0.88140311]
[0.4033945 0.47251058]
[0.2284928 0.70175964]]
[[0.44053464 0.20180619]
[0.15514924 0.90906066]
[0.17861751 0.68839029]]
[[0.31387288 0.90869563]
[0.14992 0.60987398]
[0.63666834 0.73750431]]]
numpy.random.randn(d0,d1,…,dn)
print(np.random.randn(2,4))
[[-3.76215048e-04 8.66687229e-01 -2.38559669e-01 1.75060171e+00]
[ 1.57466855e+00 8.17036401e-01 -1.05382851e+00 -1.72285071e+00]]
numpy.random.randn()和numpy.random.rand()
标签:根据 span rand and 之间 2.3 int 函数 dom
原文地址:https://www.cnblogs.com/bigdata-stone/p/10209146.html