ImportError: cannot import name 'LinearRegression' from 'sklearn'

Machine Learning

Hi Guys,

I am trying to create one Machine Learning model using sklearn. I installed this model but I am getting this below error.

from sklearn import LinearRegression
ImportError: cannot import name 'LinearRegression' from 'sklearn'

1
Answers

Replies

You have received this error as the LinearRegression is present in the sklearn.model_selection module. To rectify the error, you will need to use the below code.



from sklearn.linear_model import LinearRegression



You need to make sure that the sklearn module is installed in your system.

 
 

If you want to unleash your potential in this competitive field, please visit the Machine Learning course page for more information, where you can find the Machine Learning tutorials and Machine Learning frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.
Protected by Astra Security