Base classes for feature engineering operations.
Classes
Abstract base class for all feature engineering operations.
__init__( self, )
See Also
Methods
fit
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> 'FeatureMethod'
fit
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> 'FeatureMethod'
Learn feature engineering parameters from data.
Parameters
X
y
Returns
self
fit_transform
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> np.ndarray
fit_transform
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> np.ndarray
Fit to data, then transform it in one step.
Parameters
X
y
Returns
X_transformed
set_params
(self, **params) -> 'FeatureMethod'
set_params
(self, **params) -> 'FeatureMethod'
Set method parameters.
Parameters
**params
Returns
self
Raises
ValueError
Base class for feature selection algorithms.
__init__( self, k: Optional[int] = None, threshold: Optional[float] = None, )
Overview
Parameters
k
threshold
Attributes
_selected_indices
fit.
_feature_scores
See Also
Methods
fit
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> 'FeatureSelector'
fit
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> 'FeatureSelector'
Compute feature scores and select the feature subset.
Parameters
X
y
Returns
self
Raises
ValueError
y is None.
get_support
(self, indices: bool=False) -> np.ndarray
get_support
(self, indices: bool=False) -> np.ndarray
Get a mask or indices of the selected features.
Parameters
indices
True, return the integer indices of the selected features; otherwise return a boolean mask over all features.
Returns
support
(n_features,), or integer indices of shape (n_selected,) if indices is True.
Base class for feature extraction and dimensionality reduction.
__init__( self, n_components: Optional[int] = None, )
Parameters
n_components
Methods
fit
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> 'FeatureExtractor'
fit
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> 'FeatureExtractor'
Learn extraction parameters from data.
Parameters
X
y
Returns
self
inverse_transform
(self, X: np.ndarray) -> np.ndarray
inverse_transform
(self, X: np.ndarray) -> np.ndarray
Reverse the transformation (if possible).
Parameters
X
Returns
X_original
Raises
NotImplementedError
Base class for expanded feature construction.
__init__( self, )
Methods
fit
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> 'FeatureConstructor'
fit
(self, X: np.ndarray, y: Optional[np.ndarray]=None) -> 'FeatureConstructor'
Learn construction parameters from data.
Parameters
X
y
Returns
self
Functions
Register a feature selector class with the component registry.
Parameters
name
tags
version
author
Returns
decorator
FeatureSelector component.
>>> from tuiml.base.features import feature_selector, FeatureSelector
>>> @feature_selector(tags=["statistical", "univariate"])
... class ChiSquaredSelector(FeatureSelector):
... pass
Register a feature extractor class with the component registry.
Parameters
name
tags
version
author
Returns
decorator
FeatureExtractor component.
>>> from tuiml.base.features import feature_extractor, FeatureExtractor
>>> @feature_extractor(tags=["dimensionality_reduction"])
... class PCAExtractor(FeatureExtractor):
... pass
Register a feature constructor class with the component registry.
Parameters
name
tags
version
author
Returns
decorator
FeatureConstructor component.
>>> from tuiml.base.features import feature_constructor, FeatureConstructor
>>> @feature_constructor(tags=["polynomial"])
... class PolynomialFeaturesGenerator(FeatureConstructor):
... pass