class lightautoml.automl.base.AutoML(reader, levels, timer=None, blender=None, skip_conn=False, return_all_predictions=False)[source]

Bases: object

Class for compile full pipeline of AutoML task.

AutoML steps:

  • Read, analyze data and get inner LAMLDataset from input dataset: performed by reader.

  • Create validation scheme.

  • Compute passed ml pipelines from levels. Each element of levels is list of MLPipelines prediction from current level are passed to next level pipelines as features.

  • Time monitoring - check if we have enough time to calc new pipeline.

  • Blend last level models and prune useless pipelines to speedup inference: performed by blender.

  • Returns prediction on validation data. If crossvalidation scheme is used, out-of-fold prediction will returned. If validation data is passed it will return prediction on validation dataset. In case of cv scheme when some point of train data never was used as validation (ex. timeout exceeded or custom cv iterator like TimeSeriesIterator was used) NaN for this point will be returned.


Common usecase - create custom pipelines or presets.

>>> reader = SomeReader()
>>> pipe = MLPipeline([SomeAlgo()])
>>> levels = [[pipe]]
>>> automl = AutoML(reader, levels, )
>>> automl.fit_predict(data, roles={'target': 'TARGET'})


There are several verbosity levels:

  • 0: No messages.

  • 1: Warnings.

  • 2: Info.

  • 3: Debug.

fit_predict(train_data, roles, train_features=None, cv_iter=None, valid_data=None, valid_features=None, verbose=0)[source]

Fit on input data and make prediction on validation part.

  • train_data (Any) – Dataset to train.

  • roles (dict) – Roles dict.

  • train_features (Optional[Sequence[str]]) – Optional features names, if cannot be inferred from train_data.

  • cv_iter (Optional[Iterable]) – Custom cv iterator. For example, TimeSeriesIterator.

  • valid_data (Optional[Any]) – Optional validation dataset.

  • valid_features (Optional[Sequence[str]]) – Optional validation dataset features if can’t be inferred from valid_data.

  • verbose (int) – Controls the verbosity: the higher, the more messages. <1 : messages are not displayed; >=1 : the computation process for layers is displayed; >=2 : the information about folds processing is also displayed; >=3 : the hyperparameters optimization process is also displayed; >=4 : the training process for every algorithm is displayed.

Return type



Predicted values.

predict(data, features_names=None, return_all_predictions=None)[source]

Predict with automl on new dataset.

  • data (Any) – Dataset to perform inference.

  • features_names (Optional[Sequence[str]]) – Optional features names, if cannot be inferred from train_data.

  • return_all_predictions (Optional[bool]) – if True, returns all model predictions from last level

Return type



Dataset with predictions.


Get feats that automl uses on inference.

Return type



Features names list.


Collect info about models in automl.

Return type

Dict[str, int]


Dict with models and its runtime numbers.