随机抽样 (numpy.random

简单随机数据

rand \(d0,d1,…,dn) 给定形状中的随机值。
randn \(d0,d1,…,dn) 从“标准正态”分布中返回一个(或多个)样本。
randint (低) [, high, size, dtype] ) 从返回随机整数 low (包括) high (排他性)。
random_integers (低) [, high, size] ) np.int类型的随机整数,介于 lowhigh 包括在内。
random_sample \ [size] ) 返回半开区间内的随机浮点数[0.0,1.0]。
random \ [size] ) 返回半开区间内的随机浮点数[0.0,1.0]。
ranf \ [size] ) 返回半开区间内的随机浮点数[0.0,1.0]。
sample \ [size] ) 返回半开区间内的随机浮点数[0.0,1.0]。
choice (a) [, size, replace, p] ) 从给定的一维数组生成随机样本
bytes (长度) 返回随机字节。

排列

shuffle [(x)] 通过改变序列的内容来修改序列。
permutation [(x)] 随机排列序列,或返回排列范围。

分布

beta (a,b) [, size] ) 从β分布中提取样本。
binomial (n,p) [, size] ) 从二项式分布中提取样本。
chisquare (DF) [, size] ) 从卡方分布中提取样本。
dirichlet α(α) [, size] ) 从Dirichlet分布中提取样本。
exponential \ [scale, size] ) 从指数分布中提取样本。
f \(DfNum,Dfden)[, size] ) 从F分布中提取样本。
gamma [形状] [, scale, size] ) 从伽马分布中提取样本。
geometric (P) [, size] ) 从几何分布中提取样本。
gumbel \ [loc, scale, size] ) 从Gumbel分布中提取样本。
hypergeometric \(Ngood、NBAD、NSample)[, size] ) 从超几何分布中提取样本。
laplace \ [loc, scale, size] ) 从拉普拉斯或双指数分布中提取具有指定位置(或平均值)和刻度(衰减)的样本。
logistic \ [loc, scale, size] ) 从物流配送中抽取样本。
lognormal \ [mean, sigma, size] ) 从对数正态分布中提取样本。
logseries (P) [, size] ) 从对数序列分布中提取样本。
multinomial \(n,pVal\) [, size] ) 从多项式分布中提取样本。
multivariate_normal \(平均值,COV [,大小,…) 从多元正态分布中随机抽取样本。
negative_binomial (n,p) [, size] ) 从负二项分布中提取样本。
noncentral_chisquare \(DFNoC) [, size] ) 从非中心卡方分布中提取样本。
noncentral_f \(dfnum,dfden,非[, size] ) 从非中心F分布中提取样本。
normal \ [loc, scale, size] ) 从正态(高斯)分布中随机抽取样本。
pareto (a) [, size] ) 从指定形状的Pareto II或Lomax分布中提取样品。
poisson \ [lam, size] ) 从泊松分布中提取样本。
power (a) [, size] ) 提取样本 [0, 1] 从正指数a-1的幂分布。
rayleigh \ [scale, size] ) 从瑞利分布中提取样本。
standard_cauchy \ [size] ) 从模式为0的标准柯西分布中提取样本。
standard_exponential \ [size] ) 从标准指数分布中提取样本。
standard_gamma [形状] [, size] ) 从标准伽马分布中提取样本。
standard_normal \ [size] ) 从标准正态分布(平均值=0,标准偏差=1)中提取样本。
standard_t (DF) [, size] ) 从标准学生t分布中抽取样本 df 自由度。
triangular \(左,模式,右[, size] ) 从间隔的三角形分布中提取样本 [left, right] .
uniform \ [low, high, size] ) 从均匀分布中提取样品。
vonmises (Mu,Kappa) [, size] ) 从von mises分布中提取样本。
wald \(平均值,比例[, size] ) 从瓦尔德分布或逆高斯分布中提取样本。
weibull (a) [, size] ) 从威布尔分布中提取样本。
zipf (a) [, size] ) 从Zipf分布中提取样本。

随机发生器

RandomState \ [seed] ) 梅森捻线机伪随机数发生器的容器。
seed \ [seed] ) 给发电机播种。
get_state () 返回表示生成器内部状态的元组。
set_state (状态) 从元组设置生成器的内部状态。