python-numpy-指數(shù)分布實例詳解
更新時間:2019年12月07日 08:56:11 作者:云金杞
今天小編就為大家分享一篇python-numpy-指數(shù)分布實例詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
如下所示:
# Seed random number generator np.random.seed(42) # Compute mean no-hitter time: tau tau = np.mean(nohitter_times) # Draw out of an exponential distribution with parameter tau: inter_nohitter_time inter_nohitter_time = np.random.exponential(tau, 100000) # Plot the PDF and label axes _ = plt.hist(inter_nohitter_time, bins=50, normed=True, histtype='step') _ = plt.xlabel('Games between no-hitters') _ = plt.ylabel('PDF') # Show the plot plt.show()
指數(shù)分布的擬合
# Create an ECDF from real data: x, y x, y = ecdf(nohitter_times) # Create a CDF from theoretical samples: x_theor, y_theor x_theor, y_theor = ecdf(inter_nohitter_time) # Overlay the plots plt.plot(x_theor, y_theor) plt.plot(x, y, marker='.', linestyle='none') # Margins and axis labels plt.margins(0.02) plt.xlabel('Games between no-hitters') plt.ylabel('CDF') # Show the plot plt.show()
以上這篇python-numpy-指數(shù)分布實例詳解就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Python簡單實現(xiàn)兩個任意字符串乘積的方法示例
這篇文章主要介紹了Python簡單實現(xiàn)兩個任意字符串乘積的方法,結(jié)合實例形式分析了Python針對字符串、列表的切片、轉(zhuǎn)換、遍歷等相關(guān)操作技巧,需要的朋友可以參考下2018-04-04Python統(tǒng)計單詞出現(xiàn)的次數(shù)
最近經(jīng)理交給我一項任務(wù),統(tǒng)計一個文件中每個單詞出現(xiàn)的次數(shù),列出出現(xiàn)頻率最多的5個單詞。本文給大家?guī)砹藀ython 統(tǒng)計單詞次數(shù)的思路解析,需要的朋友參考下吧2018-04-04