python-numpy-指數(shù)分布實(shí)例詳解
更新時(shí)間:2019年12月07日 08:56:11 作者:云金杞
今天小編就為大家分享一篇python-numpy-指數(shù)分布實(shí)例詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
如下所示:
# 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ù)分布實(shí)例詳解就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Python selenium的這三種等待方式一定要會(huì)!
今天給大家?guī)淼氖顷P(guān)于Python的相關(guān)知識(shí),文章圍繞著selenium三種等待方式展開,文中有非常詳細(xì)的介紹,需要的朋友可以參考下2021-06-06Python爬取國外天氣預(yù)報(bào)網(wǎng)站的方法
這篇文章主要介紹了Python爬取國外天氣預(yù)報(bào)網(wǎng)站的方法,可實(shí)現(xiàn)抓取國外天氣預(yù)報(bào)信息的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-07-07django中的auth模塊與admin后臺(tái)管理方法
這篇文章主要介紹了django中的auth模塊與admin后臺(tái)管理方法,包括auth模塊的常用方法及如何擴(kuò)展auth_user表,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下2022-09-09Python簡(jiǎn)單實(shí)現(xiàn)兩個(gè)任意字符串乘積的方法示例
這篇文章主要介紹了Python簡(jiǎn)單實(shí)現(xiàn)兩個(gè)任意字符串乘積的方法,結(jié)合實(shí)例形式分析了Python針對(duì)字符串、列表的切片、轉(zhuǎn)換、遍歷等相關(guān)操作技巧,需要的朋友可以參考下2018-04-04python 調(diào)試?yán)渲R(shí)(小結(jié))
這篇文章主要介紹了python 調(diào)試?yán)渲R(shí)(小結(jié)),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11Python統(tǒng)計(jì)單詞出現(xiàn)的次數(shù)
最近經(jīng)理交給我一項(xiàng)任務(wù),統(tǒng)計(jì)一個(gè)文件中每個(gè)單詞出現(xiàn)的次數(shù),列出出現(xiàn)頻率最多的5個(gè)單詞。本文給大家?guī)砹藀ython 統(tǒng)計(jì)單詞次數(shù)的思路解析,需要的朋友參考下吧2018-04-04