“sklearn.linear_模型”没有属性“泊松回归器”

2024-10-02 14:19:14 发布

您现在位置:Python中文网/ 问答频道 /正文

from sklearn import linear_model
p_model = linear_model.PoissonRegressor()

在这之后,我得到了一个吼叫错误:

AttributeError                            Traceback (most recent call last)
<ipython-input-151-56a5434ffcb5> in <module>
----> 1 p_model = linear_model.PoissonRegressor()

AttributeError: module 'sklearn.linear_model' has no attribute 'PoissonRegressor'

我不确定如何修复此错误


Tags: fromimportmostmodel错误ipythonsklearncall
1条回答
网友
1楼 · 发布于 2024-10-02 14:19:14

根据documentationPoissonRegressor()是对sklearn(版本0.23)的一个相对较新的添加

您的版本可能不是最新的,因此请尝试升级整个库:

pip install  upgrade scikit-learn

conda update scikit-learn
# you can also try `conda install scikit-learn=0.24`

取决于您正在使用的软件包管理器

相关问题 更多 >