Reputation: 93
I tried to import cross_validation by using the following statement in python 2
from sklearn import cross_validation
but I am receiving the following error
cannot import name cross_validation
Upvotes: 1
Views: 2234
Reputation: 411
cross_validation
was removed in SKlearn 0.20. You can now import it as,
from sklearn.model_selection import cross_validate
Basically all the cross validation related functions are moved under model_selection in SKlearn.
EDIT :
To import train_test_split,
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
Upvotes: 3