【numpy】查詢手冊

所有函數見:
函數查詢中文.
函數查詢

以下重點寫常用到的一些函數:

正態分佈

f(x)=12πσexp((xμ)22σ2) f(x)=\frac{1}{2\pi\sqrt σ} exp(− \frac{(x−μ)^2}{2 σ^2})

#從某一分佈(由均值和標準差標識)中獲得樣本
mu, sigma = 0, .1
s = np.random.normal(loc=mu, scale=sigma, size=1000)

或者可以

import scipy.stats as st
mu, sigma = 0, .1
s = st.norm(mu, sigma).rvs(1000)

可以作圖
畫出曲線

import seaborn as sns
sns.distplot(s)

畫直方圖

import matplotlib.pyplot as plt
plt.hist(s, 30, normed=True)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章