Welcome to the Simplilearn Community

Want to join the rest of our members? Sign up right away!

Sign Up

ImportError: cannot import name 'cross_validation' from 'sklearn

Adonis

Member
What is the reason why I cannot import "from sklearn import cross_validation"?
 

Attachments

  • Snip20210711_5.png
    Snip20210711_5.png
    75.4 KB · Views: 0

Adonis

Member
The answer should be:
from sklearn import model_selection
X_train, X_test, Y_train, Y_test = model_selection.train_test_split(X_features,Y_target)

Then:
print (X_train.shape, X_test.shape, Y_train.shape, Y_test.shape)
 
Top