借助於numpy.random.vonmises()方法,我們可以從von mises分布中獲取隨機樣本,並使用此方法將隨機樣本作為numpy數組返回。

馮·米塞斯(Von Mises)發行
用法:numpy.random.vonmises(mu, kappa, size=None)
Return:以numpy數組形式返回隨機樣本。
範例1:
在此示例中,我們可以看到,通過使用numpy.random.vonmises()方法,我們能夠從von mises分布中獲取隨機樣本並返回numpy數組。
Python3
# import numpy
import numpy as np
import matplotlib.pyplot as plt
# Using vonmises() method
gfg = np.random.vonmises(5, 3, 5000)
plt.hist(gfg, bins = 50, density = True)
plt.show()
輸出:
範例2:
Python3
# import numpy
import numpy as np
import matplotlib.pyplot as plt
# Using vonmises() method
gfg = np.random.vonmises(5, 13, 10000)
plt.hist(gfg, bins = 100, density = True)
plt.show()
輸出:
相關用法
- Python numpy.gcd()用法及代碼示例
- Python numpy.fv()用法及代碼示例
- Python numpy.pmt()用法及代碼示例
- Python numpy.irr()用法及代碼示例
- Python numpy.lcm()用法及代碼示例
- Python numpy.npv()用法及代碼示例
- Python numpy.exp()用法及代碼示例
- Python numpy.ptp()用法及代碼示例
- Python numpy.any()用法及代碼示例
- Python numpy.all()用法及代碼示例
- Python np.nanmax()用法及代碼示例
- Python numpy.less()用法及代碼示例
- Python numpy.std()用法及代碼示例
- Python numpy.inner()用法及代碼示例
- Python numpy.pv()用法及代碼示例
- Python numpy.mean()用法及代碼示例
- Python numpy.sum()用法及代碼示例
- Python numpy.fix()用法及代碼示例
- Python numpy.log()用法及代碼示例
- Python numpy.var()用法及代碼示例
注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 numpy.random.vonmises() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。