ImportError cannot import name LinearRegression from sklearn

0 votes

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'
Apr 24, 2020 in Machine Learning by akhtar
• 38,260 points
24,806 views

1 answer to this question.

0 votes

Hi@akhtar,

You got this error because LinearRegression is present in sklearn.model_selection module. To modify your code as follows.

from sklearn.linear_model import LinearRegression

Hope this will help.

answered Apr 24, 2020 by MD
• 95,460 points
that's not the solution.

Still not working.

Hi@AntiModi,

Did you install sklearn module in your system? If yes, then try the below-given command.

from sklearn.linear_model import LinearRegression
I have installed sklearn still linearRegression is not importing.

@There,

open folder /.local/lib/python2.7/site-packages/sklearn/linear_model and open file coordinate_descent.py and delete from . import cd_fast after this import error will be removed

Related Questions In Machine Learning

0 votes
1 answer

ImportError: cannot import name 'train_test_split' from 'sklearn.linear_model

Hi@MD, I think in your version, linear_model  don't have train_test_split ...READ MORE

answered Apr 13, 2020 in Machine Learning by akhtar
• 38,260 points
8,376 views
0 votes
0 answers

derivion logistic regresion from odds function

Feb 7, 2020 in Machine Learning by GANJI
• 120 points
666 views
+1 vote
1 answer
0 votes
0 answers

NameError: name '_train' is not defined

Mar 30, 2020 in Machine Learning by anonymous
• 120 points
2,937 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

ImportError: cannot import name minimum_spanning_tree

Hi@akhtar, I think there may be problem in ...READ MORE

answered Apr 20, 2020 in Machine Learning by MD
• 95,460 points
2,120 views
0 votes
1 answer

Tensorflow ImportError: cannot import name'abs' error

Hi@akhtar, You may get this error, if you ...READ MORE

answered Apr 23, 2020 in Machine Learning by MD
• 95,460 points
6,202 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP