简体   繁体   English

无法从 sklearn 导入预测

[英]cannot import predict from sklearn

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) ImportError:无法从“sklearn.linear_model”(/opt/anaconda3/lib/python3.8/site-packages/sklearn/linear_model/ init .py)导入名称“predict”

Tried everything Can anyone help什么都试过了 谁能帮忙

predict is not part of the sklearn.linear_model module. predict不是sklearn.linear_model模块的一部分。 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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM