scikit-learn/scikit-learn — pull request #2585 by jakevdp (2013-11-12 01:25:47+00:00)
Title: ENH: add PolynomialFeatures preprocessor

This is a simple pre-processor that creates mixed polynomial features of any given degree. This is something I use often in tutorials, and this will make the process much more streamlined.

What this PR contains:

- A new ``sklearn.preprocessing.PolynomialFeatures`` transformer class
- A ``sklearn.preprocessing.polynomial_features`` function
- Tests of the new functionality
- A modified polynomial interpolation example which uses this in a pipeline rather than using ``np.vander`` to construct the features by hand.

Note that full polynomial features are more general than ``np.vander``, because they'll work for more than one-dimensional input (see the docstring for an example).

This doesn't support sparse yet: we'll have to think about how to most efficiently implement that.