Dims Dims - 19 days ago 15
Python Question

ImportError: No module named model_selection

I am trying to use

train_test_split
function and write:

from sklearn.model_selection import train_test_split


and this causes

ImportError: No module named model_selection


Why? And how to overcome?

Answer

I guess you have the wrong version of scikit-learn, a similar situation was described here on GitHub. Previosly, you had to use cross_validation.

To upgrade to at least version 0.18, do:

pip install -U scikit-learn

Hope this helps!