本文簡要介紹 python 語言中 numpy.random.Generator.standard_normal
的用法。
用法:
random.Generator.standard_normal(size=None, dtype=np.float64, out=None)
從標準正態分布(平均值=0,標準差=1)中抽取樣本。
- out: 浮點數或 ndarray
形狀為
size
的已繪製樣本的浮點數組,如果未指定size
,則為單個樣本。
參數:
返回:
注意:
對於來自 的隨機樣本,請使用以下之一:
mu + sigma * rng.standard_normal(size=...) rng.normal(mu, sigma, size=...)
例子:
>>> rng = np.random.default_rng() >>> rng.standard_normal() 2.1923875335537315 # random
>>> s = rng.standard_normal(8000) >>> s array([ 0.6888893 , 0.78096262, -0.89086505, ..., 0.49876311, # random -0.38672696, -0.4685006 ]) # random >>> s.shape (8000,) >>> s = rng.standard_normal(size=(3, 4, 2)) >>> s.shape (3, 4, 2)
Two-by-four 來自 的樣本數組:
>>> 3 + 2.5 * rng.standard_normal(size=(2, 4)) array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], # random [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) # random
相關用法
- Python numpy Generator.standard_t用法及代碼示例
- Python numpy Generator.standard_cauchy用法及代碼示例
- Python numpy Generator.standard_exponential用法及代碼示例
- Python numpy Generator.standard_gamma用法及代碼示例
- Python numpy Generator.shuffle用法及代碼示例
- Python numpy Generator.multivariate_normal用法及代碼示例
- Python numpy Generator.bytes用法及代碼示例
- Python numpy Generator.choice用法及代碼示例
- Python numpy Generator.random用法及代碼示例
- Python numpy Generator.logseries用法及代碼示例
- Python numpy Generator.uniform用法及代碼示例
- Python numpy Generator.normal用法及代碼示例
- Python numpy Generator.poisson用法及代碼示例
- Python numpy Generator.power用法及代碼示例
- Python numpy Generator.geometric用法及代碼示例
- Python numpy Generator.laplace用法及代碼示例
- Python numpy Generator.vonmises用法及代碼示例
- Python numpy Generator.noncentral_f用法及代碼示例
- Python numpy Generator.gamma用法及代碼示例
- Python numpy Generator.multivariate_hypergeometric用法及代碼示例
- Python numpy Generator.weibull用法及代碼示例
- Python numpy Generator.gumbel用法及代碼示例
- Python numpy Generator.pareto用法及代碼示例
- Python numpy Generator.noncentral_chisquare用法及代碼示例
- Python numpy Generator.negative_binomial用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.random.Generator.standard_normal。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。