ImportError: no module named sklearn.preprocessing

I have successfully installed scikit-learn on Ubuntu following these instructions .

However, I get this error when starting a program that uses it:

Traceback (most recent call last):
  File "begueradj.py", line 10, in <module>
    from sklearn.preprocessing import normalize
ImportError: No module named sklearn.preprocessing

How to fix it?

+6
source share
3 answers

The instructions in this tutorial that you are associated with are deprecated for Ubuntu 14.04.

Ubuntu 14.04 package is called python-sklearn (previously python-scikits-learn):

sudo apt-get install python-sklearn  

The package python-sklearnis located in the default repositories in Ubuntu 14.04, as well as in other currently supported versions of Ubuntu.

+6
source

:

   sudo apt-get install python-sklearn  
0

normalize is a preprocessing method. Therefore, you need to import preprocessing.

In your code, you can call the preprocessing.normalize () method.

from sklearn import preprocessing
preprocessing.normailze(x,y,z)

If you want to make short code, you can use import x from y as z syntax

from sklearn import preprocessing as prep
prep.normalize(x,y,z) 
-2
source

All Articles