MLPipeline
- class lightautoml.pipelines.ml.base.MLPipeline(ml_algos, force_calc=True, pre_selection=None, features_pipeline=None, post_selection=None)[source]
Bases:
object
Single ML pipeline.
Merge together stage of building ML model (every step, excluding model training, is optional):
Pre selection: select features from input data. Performed by
SelectionPipeline
.Features generation: build new features from selected. Performed by
FeaturesPipeline
.Post selection: One more selection step - from created features. Performed by
SelectionPipeline
.Hyperparams optimization for one or multiple ML models. Performed by
ParamsTuner
.Train one or multiple ML models: Performed by
MLAlgo
. This step is the only required for at least 1 model.
- Parameters:
ml_algos (
Sequence
[Union
[MLAlgo
,Tuple
[MLAlgo
,ParamsTuner
]]]) – Sequence of MLAlgo’s or Pair - (MlAlgo, ParamsTuner).force_calc (
Union
[bool
,Sequence
[bool
]]) – Flag if single fold of ml_algo should be calculated anyway.pre_selection (
Optional
[SelectionPipeline
]) – Initial feature selection. IfNone
there is no initial selection.features_pipeline (
Optional
[FeaturesPipeline
]) – Composition of feature transforms.post_selection (
Optional
[SelectionPipeline
]) – Post feature selection. IfNone
there is no post selection.
- fit_predict(train_valid)[source]
Fit on train/valid iterator and transform on validation part.
- Parameters:
train_valid (
TrainValidIterator
) – Dataset iterator.- Return type:
- Returns:
Dataset with predictions of all models.
- predict(dataset)[source]
Predict on new dataset.
- Parameters:
dataset (
LAMLDataset
) – Dataset used for prediction.- Return type:
- Returns:
Dataset with predictions of all trained models.