将泊松曲线拟合到数据

问题描述

我正在尝试使用 Seaborn 中的 distplot 将泊松曲线拟合到我的数据集。我想绘制直方图、泊松 pmf 的散点图和预期的泊松曲线。 我已经使用

将数据拟合为正态分布
#!/bin/bash

qemu-system-x86_64 \
-m 2048 \
-vga virtio \
-accel hvf \
-display default,show-cursor=on \
-usb \
-device usb-tablet \
-drive file=./win10.qcow2,if=virtio \
-cdrom Win10_20H2_v2_English_x64.iso

这会产生一个很好的情节

fit=stats.norm

enter image description here

现在我想将拟合更改为泊松曲线。我试过了

fig,ax = plt.subplots(figsize=(15,10))

sb.distplot(a=counts1[:,0],bins=np.arange(8)-0.5,fit=stats.norm,hist=True,kde=False,hist_kws = {'label':'Measured Counts'},fit_kws = {'label':'Gaussian Fit'})

plt.scatter(counts1[:,poisson.pmf(counts1[:,counts1_means[0]),label='Poisson pmf')
plt.text(4,0.3,r'$\mu$ = %.4f' % (counts1_means[0]),bBox=dict(alpha=0.25))

plt.legend();

但是我收到此错误

AttributeError: 'poisson_gen' 对象没有属性 'fit'

我应该使用什么拟合来在我的图上获得泊松曲线?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)