module mlmodel.extended_features
¶
Short summary¶
module mlinsights.mlmodel.extended_features
Implements new features such as polynomial features.
Classes¶
class 
truncated documentation 

Generates extended features such as polynomial features. Parameters ——— kind: string 
Methods¶
method 
truncated documentation 

Fitting method for the polynomial features. 

Returns feature names for output features for the polynomial features. 

Transforms data to polynomial features. 

Transforms data to polynomial features. 

Compute number of output features. Parameters ——— X : arraylike, shape (n_samples, n_features) … 

Returns feature names for output features. Parameters ——— input_features : list of string, … 

Transforms data to extended features. Parameters ——— X : arraylike, shape [n_samples, n_features] … 
Documentation¶
Implements new features such as polynomial features.

class
mlinsights.mlmodel.extended_features.
ExtendedFeatures
(kind='poly', poly_degree=2, poly_interaction_only=False, poly_include_bias=True)[source]¶ Bases:
sklearn.base.BaseEstimator
,sklearn.base.TransformerMixin
Generates extended features such as polynomial features.
 Parameters
kind (string) –
'poly'
for polynomial features,'polyslow'
for polynomial features in scikitlearn 0.20.2poly_degree (integer) – The degree of the polynomial features. Default = 2.
poly_interaction_only (boolean) – If true, only interaction features are produced: features that are products of at most degree distinct input features (so not
x[1] ** 2, x[0] * x[2] ** 3
, etc.).poly_include_bias (boolean) – 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).

n_input_features_
¶ The total number of input features.
 Type
int

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.
 Type
int

__init__
(kind='poly', poly_degree=2, poly_interaction_only=False, poly_include_bias=True)[source]¶ Initialize self. See help(type(self)) for accurate signature.

_get_feature_names_poly
(input_features=None)[source]¶ Returns feature names for output features for the polynomial features.

fit
(X, y=None)[source]¶ Compute number of output features. :param X: The data. :type X: arraylike, shape (n_samples, n_features)
 Returns
self
 Return type
instance

get_feature_names
(input_features=None)[source]¶ Returns feature names for output features.
 Parameters
input_features (list of string, length n_features, optional) – String names for input features if available. By default, “x0”, “x1”, … “xn_features” is used.
 Returns
output_feature_names
 Return type
list of string, length n_output_features

transform
(X)[source]¶ Transforms data to extended features.
 Parameters
X (arraylike, shape [n_samples, n_features]) – The data to transform, row by row. rns
 –
XP (numpy.ndarray, shape [n_samples, NP]) – The matrix of features, where NP is the number of polynomial features generated from the combination of inputs.