ModuleNotFoundError: No module named 'sklearn.cross_validation'

Viewed 416

I am facing an issue with the following error:

ModuleNotFoundError: No module named 'sklearn.cross_validation'

When I checked the packages installed with pip freeze i could see scikit-learn installed.

What shall I do?

Thanks

1 Answers

It must relate to the renaming and deprecation of cross_validation sub-module to model_selection. Try substituting cross_validation to model_selection

train_test_split is now in model_selection. Just type:

from sklearn.model_selection import train_test_split
Related