简体   繁体   中英

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)

Tried everything Can anyone help

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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