ImportError: No module named sklearn.cross_validation

Total
0
Shares

I am using python 2.7 in Ubuntu 14.04. I installed scikit-learn, numpy and matplotlib with these commands:

sudo apt-get install build-essential python-dev python-numpy 
python-numpy-dev python-scipy libatlas-dev g++ python-matplotlib 
ipython

But when I import these packages:

from sklearn.cross_validation import train_test_split

It returns me this error:

ImportError: No module named sklearn.cross_validation

What I need to do?


Solution

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

Source: StackOverflow.com

Leave a Reply

Your email address will not be published. Required fields are marked *