Polynomial Features

../../../../_images/polynomial.svg

Generate a new feature matrix consisting of all polynomial combinations of the features with less than a given degree

Configuration:

  • degree

    The degree of the polynomial features. Default = 2.

  • interaction_only

    If true, only interaction features are produced: features that are products of at most degree distinct input features (so not x ** 2, x * x ** 3, etc.).

  • include_bias

    If True (default), then include a bias column, the feature in which all polynomial powers are zero (i.e. a column of ones - acts as an intercept term in a linear model).

Attributes:

  • n_input_features_

    The total number of input features.

  • n_output_features_

    The total number of polynomial output features. The number of output features is computed by iterating over all suitably sized combinations of input features.

  • powers_

    powers_[i, j] is the exponent of the jth input in the ith output.

Input ports:

Output ports:
model : model
Model
degree (degree)
The degree of the polynomial features. Default = 2.
interaction_only (interaction_only)
If true, only interaction features are produced: features that are products of at most degree distinct input features (so not x ** 2, x * x ** 3, etc.).
include_bias (include_bias)
If True (default), then include a bias column, the feature in which all polynomial powers are zero (i.e. a column of ones - acts as an intercept term in a linear model).

Some of the docstrings for this module have been automatically extracted from the scikit-learn library and are covered by their respective licenses.

class node_preprocessing.PolynomialFeatures[source]