本文簡要介紹 python 語言中 numpy.random.RandomState.wald
的用法。
用法:
random.RandomState.wald(mean, scale, size=None)
從 Wald 或逆高斯分布中抽取樣本。
隨著尺度接近無窮大,分布變得更像高斯分布。一些參考文獻聲稱 Wald 是一個逆高斯,平均值等於 1,但這絕不是普遍的。
首先研究了與布朗運動相關的逆高斯分布。 1956 年 M.C.K. Tweedie 之所以使用逆高斯這個名稱,是因為在單位距離內覆蓋的時間與單位時間內覆蓋的距離之間存在反比關係。
注意
新代碼應改為使用
default_rng()
實例的wald
方法;請參閱快速入門。- mean: 浮點數或類似數組的浮點數
分布均值,必須 > 0。
- scale: 浮點數或類似數組的浮點數
比例參數,必須 > 0。
- size: int 或整數元組,可選
輸出形狀。例如,如果給定的形狀是
(m, n, k)
,則繪製m * n * k
樣本。如果 size 為None
(默認),如果mean
和scale
都是標量,則返回單個值。否則,將抽取np.broadcast(mean, scale).size
樣本。
- out: ndarray 或標量
從參數化 Wald 分布中抽取樣本。
參數:
返回:
注意:
Wald 分布的概率密度函數為
如上所述,逆高斯分布首先源於對布朗運動建模的嘗試。它也是 Weibull 在可靠性建模以及股票收益和利率過程建模方麵的競爭對手。
參考:
Brighton Webs Ltd., Wald Distribution,https://web.archive.org/web/20090423014010/http://www.brighton-webs.co.uk:80/distributions/wald.asp
Chhikara, Raj S. 和 Folks, J. Leroy,“逆高斯分布:理論:方法和應用”,CRC 出版社,1988 年。
維基百科,“Inverse Gaussian distribution”https://en.wikipedia.org/wiki/Inverse_Gaussian_distribution
1:
2:
3:
例子:
從分布中繪製值並繪製直方圖:
>>> import matplotlib.pyplot as plt >>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, density=True) >>> plt.show()
相關用法
- Python numpy RandomState.weibull用法及代碼示例
- Python numpy RandomState.standard_exponential用法及代碼示例
- Python numpy RandomState.bytes用法及代碼示例
- Python numpy RandomState.uniform用法及代碼示例
- Python numpy RandomState.standard_gamma用法及代碼示例
- Python numpy RandomState.seed用法及代碼示例
- Python numpy RandomState.power用法及代碼示例
- Python numpy RandomState.standard_normal用法及代碼示例
- Python numpy RandomState.geometric用法及代碼示例
- Python numpy RandomState.random_sample用法及代碼示例
- Python numpy RandomState.gumbel用法及代碼示例
- Python numpy RandomState.logseries用法及代碼示例
- Python numpy RandomState.noncentral_chisquare用法及代碼示例
- Python numpy RandomState.chisquare用法及代碼示例
- Python numpy RandomState.poisson用法及代碼示例
- Python numpy RandomState.randn用法及代碼示例
- Python numpy RandomState.vonmises用法及代碼示例
- Python numpy RandomState.gamma用法及代碼示例
- Python numpy RandomState.zipf用法及代碼示例
- Python numpy RandomState.triangular用法及代碼示例
- Python numpy RandomState.f用法及代碼示例
- Python numpy RandomState.shuffle用法及代碼示例
- Python numpy RandomState.rayleigh用法及代碼示例
- Python numpy RandomState.randint用法及代碼示例
- Python numpy RandomState.permutation用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.random.RandomState.wald。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。