Question

I'm not able to import the following modules in an ipython notebook:

from sklearn.preprocessing import PolynomialFeatures

from sklearn.pipeline import make_pipeline

The following error pops up

ImportError: cannot import name PolynomialFeatures

The same error also appears for make_pipeline.

I'm a newbie in scikit-learn, please help out.

I'm using the miniconda installation of python and the version number for scikit-learn is 0.14.1.

Was it helpful?

Solution

Polynomial Features is included for next version of scikit-learn and is not available in 0.14.1. Please update to 0.15-git if you want to use it. The same holds for make pipeline.

To get the bleeding edge version:

git clone git://github.com/scikit-learn/scikit-learn.git

python setup.py build_ext --inplace

Please read: http://scikit-learn.org/stable/developers/index.html#git-repo

OTHER TIPS

You have to check your current version of scikit:

import sklearn
print sklearn.__version__

if it is less than 0.15.0, then you have to upgrade it. In addition to an excellent answer of Abhishek, you can follow official installation process (which is described for various OS).

If you are using pyCharm, it can be done even simpler: File -> Settings -> Project Interpreter and then select your package and click upgradeenter image description here

(I selected another one, be cause my scikitlearn is the newest)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top