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 in Machine Learning by MD
• 23,050 points
150 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 by akhtar
• 10,580 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 in Machine Learning by MD
• 23,050 points
202 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 in Machine Learning by MD
• 23,050 points
136 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 in Machine Learning by MD
• 23,050 points
208 views
0 votes
0 answers

derivion logistic regresion from odds function

Feb 7 in Machine Learning by anil
• 120 points
39 views
0 votes
0 answers

NameError: name '_train' is not defined

Mar 29 in Machine Learning by anonymous
• 120 points
88 views
0 votes
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,310 points
105 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 in Machine Learning by MD
• 23,050 points
70 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 in Machine Learning by MD
• 23,050 points
44 views