ImportError cannot import name train test split from sklearn linear model

0 votes

Hi Guys,

I am trying to use train_test_split module, but it shows me the bellow error.

$ from sklearn.linear_model import train_test_split
ImportError                               Traceback (most recent call last)
<ipython-input-31-93e0e15982ab> in <module>()
----> 1 from sklearn.linear_model import train_test_split
ImportError: cannot import name 'train_test_split' from 'sklearn.linear_model' (C:\Users\Anaconda3\lib\site-packages\sklearn\linear_model\__init__.py)
Apr 13, 2020 in Machine Learning by MD
• 95,460 points
8,438 views

1 answer to this question.

0 votes

Hi@MD,

I think in your version, linear_model  don't have train_test_split module. You can use different package which contain this module.

$ from sklearn.model_selection import train_test_split

Hope this will help.

answered Apr 13, 2020 by akhtar
• 38,260 points

Related Questions In Machine Learning

0 votes
1 answer

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

Hi@akhtar, You got this error because LinearRegression is ...READ MORE

answered Apr 24, 2020 in Machine Learning by MD
• 95,460 points
24,941 views
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,137 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,260 views
0 votes
0 answers

derivion logistic regresion from odds function

Feb 7, 2020 in Machine Learning by GANJI
• 120 points
688 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,963 views
+1 vote
1 answer

ROC curve use

ROC curve is basically used to reflect ...READ MORE

answered Oct 30, 2018 in Data Analytics by kurt_cobain
• 9,350 points
855 views
+2 votes
2 answers
0 votes
1 answer

How to save machine learning model?

Hi@akhtar, To save your Machine Learning model, you ...READ MORE

answered Apr 13, 2020 in Machine Learning by MD
• 95,460 points
877 views
0 votes
1 answer

How to import one Machine Learning model?

Hi@akhtar, To import one pre-created ML model, you ...READ MORE

answered Apr 13, 2020 in Machine Learning by MD
• 95,460 points
818 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