SelectionPipeline
- class lightautoml.pipelines.selection.base.SelectionPipeline(features_pipeline=None, ml_algo=None, imp_estimator=None, fit_on_holdout=False, **kwargs)[source]
Bases:
object
Abstract class, performing feature selection. Instance should accept train/valid datasets and select features.
- property is_fitted
Check if selection pipeline is already fitted.
- Return type
- Returns
True
for fitted pipeline and False for not fitted.
- property selected_features
Get selected features.
- property in_features
Input features to the selector.
Raises exception if not fitted beforehand.
- property dropped_features
Features that were dropped.
- __init__(features_pipeline=None, ml_algo=None, imp_estimator=None, fit_on_holdout=False, **kwargs)[source]
Create features selection pipeline.
- Parameters
features_pipeline (
Optional
[FeaturesPipeline
]) – Composition of feature transforms.ml_algo (
Union
[MLAlgo
,Tuple
[MLAlgo
,ParamsTuner
],None
]) – Tuple (MlAlgo, ParamsTuner).imp_estimator (
Optional
[ImportanceEstimator
]) – Feature importance estimator.fit_on_holdout (
bool
) – If use the holdout iterator.**kwargs – Not used.
- perform_selection(train_valid)[source]
Select features from train-valid iterator.
Method is used to perform selection based on features pipeline and ml model. Should save
_selected_features
attribute in the end of working.- Raises
NotImplementedError. –
- fit(train_valid)[source]
Selection pipeline fit.
Find features selection for given dataset based on features pipeline and ml model.
- Parameters
train_valid (
TrainValidIterator
) – Dataset iterator.
- select(dataset)[source]
Takes only selected features from giving dataset and creates new dataset.
- Parameters
dataset (
LAMLDataset
) – Dataset for feature selection.- Return type
- Returns
New dataset with selected features only.