无法从Sklearn进口预测

发布于 2025-02-12 08:19:20 字数 216 浏览 1 评论 0原文

我正在错误

Importerror:无法从中导入名称为“预测” 'sklearn.linear_model'(/opt/opt/anaconda3/lib/python3.8/site-packages/sklearn/linear_model/ init .py .py)

尝试了一切!谁能帮忙!

I am getting error

ImportError: cannot import name 'predict' from
'sklearn.linear_model'(/opt/anaconda3/lib/python3.8/site-packages/sklearn/linear_model/init.py)

Tried everything ! Can anyone help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲欢浪云 2025-02-19 08:19:20

预测不是sklearn.linear_model模块的一部分。这是模块内线性模型的一种方法。例如:

from sklearn.linear_model import LinearRegression

regressor = LinearRegression()
regression.fit(X, y)
regression.predict(X)

predict is not part of the sklearn.linear_model module. It's a method of the linear models that are within the module. For example:

from sklearn.linear_model import LinearRegression

regressor = LinearRegression()
regression.fit(X, y)
regression.predict(X)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文