python-numpy-指数分布实例详解
作者:云金杞 时间:2022-01-14 07:00:32
如下所示:
# 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()
指数分布的拟合
# 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()
来源:https://blog.csdn.net/qq_26948675/article/details/79602546
标签:python,numpy,指数分布
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python用pyecharts画矩形树图实例
2022-12-20 21:42:04
![](https://img.aspxhome.com/file/2023/0/90310_0s.png)
php微信公众号开发之快递查询
2023-11-11 03:30:36
Django中Forms的使用代码解析
2022-03-20 08:06:56
![](https://img.aspxhome.com/file/2023/9/84079_0s.png)
CSS教程:轻松解决表格的nobr问题
2008-10-29 11:55:00
python实现根据图标提取分类应用程序实例
2022-07-23 16:22:39
python实现打砖块游戏
2023-11-09 21:27:15
ASP初学者学习ASP指令
2008-10-14 17:27:00
详解python logging日志传输
2021-04-20 20:43:08
Silverlight VS Flash,谁更强?
2008-11-07 11:04:00
python语言的优势是什么
2022-04-15 18:45:25
bpython 功能强大的Python shell
2022-05-08 22:12:06
![](https://img.aspxhome.com/file/2023/9/100909_0s.png)
python使用__slots__让你的代码更加节省内存
2023-03-15 06:33:57
![](https://img.aspxhome.com/file/2023/5/77805_0s.jpg)
JMail(4.3版本)发信asp代码
2007-08-03 12:40:00
Python遍历文件夹和读写文件的实现代码
2023-07-28 12:13:10
![](https://img.aspxhome.com/file/2023/4/60514_0s.jpg)
纯CSS圆角框2-透明圆角化背景图片
2009-12-11 19:10:00
![](https://img.aspxhome.com/file/UploadPic/200912/11/3-72s.png)
总结Python连接CS2000的详细步骤
2023-04-21 20:26:33
![](https://img.aspxhome.com/file/2023/7/70197_0s.png)
keras实现theano和tensorflow训练的模型相互转换
2023-04-18 05:49:26
![](https://img.aspxhome.com/file/2023/1/89081_0s.jpg)
对django views中 request, response的常用操作详解
2021-02-21 15:00:51
Python中requests库的用法详解
2022-04-12 07:05:16
解决oracle用户连接失败的解决方法
2011-01-04 19:35:00