class AutoBase(target_metric: etna.metrics.base.Metric, horizon: int, metric_aggregation: Literal['median', 'mean', 'std', 'percentile_5', 'percentile_25', 'percentile_75', 'percentile_95'] = 'mean', backtest_params: Optional[dict] = None, experiment_folder: Optional[str] = None, runner: Optional[] = None, storage: Optional[optuna.storages._base.BaseStorage] = None, metrics: Optional[List[etna.metrics.base.Metric]] = None)[source]


Base Class for Auto and Tune, implementing core logic behind these classes.

Initialize AutoBase class.

  • target_metric (etna.metrics.base.Metric) – Metric to optimize.

  • horizon (int) – Horizon to forecast for.

  • metric_aggregation (Literal['median', 'mean', 'std', 'percentile_5', 'percentile_25', 'percentile_75', 'percentile_95']) – Aggregation method for per-segment metrics. By default, mean aggregation is used.

  • backtest_params (Optional[dict]) – Custom parameters for backtest instead of default backtest parameters.

  • experiment_folder (Optional[str]) – Name for saving experiment results, it determines the name for optuna study. By default, isn’t set.

  • runner (Optional[]) – Runner to use for distributed training. By default, LocalRunner is used.

  • storage (Optional[optuna.storages._base.BaseStorage]) – Optuna storage to use. By default, sqlite storage is used with name “etna-auto.db”.

  • metrics (Optional[List[etna.metrics.base.Metric]]) – List of metrics to compute. By default, Sign, SMAPE, MAE, MSE, MedAE metrics are used.



fit(ts[, timeout, n_trials, initializer, ...])

Start automatic pipeline selection.


Get trials summary.


Get top k pipelines with the best metric value.

abstract fit(ts: etna.datasets.tsdataset.TSDataset, timeout: Optional[int] = None, n_trials: Optional[int] = None, initializer: Optional[] = None, callback: Optional[] = None, **kwargs) etna.pipeline.base.BasePipeline

Start automatic pipeline selection.

  • ts (etna.datasets.tsdataset.TSDataset) – TSDataset to fit on.

  • timeout (Optional[int]) – Timeout for optuna. N.B. this is timeout for each worker. By default, isn’t set.

  • n_trials (Optional[int]) – Number of trials for optuna. N.B. this is number of trials for each worker. By default, isn’t set.

  • initializer (Optional[]) – Object that is called before each pipeline backtest, can be used to initialize loggers.

  • callback (Optional[]) – Object that is called after each pipeline backtest, can be used to log extra metrics.

  • **kwargs – Additional parameters for the method.

Return type


abstract summary() pandas.core.frame.DataFrame

Get trials summary.


dataframe with detailed info on each performed trial

Return type


top_k(k: int = 5) List[etna.pipeline.base.BasePipeline][source]

Get top k pipelines with the best metric value.

Only complete and non-duplicate studies are taken into account.


k (int) – Number of pipelines to return.


List of top k pipelines.

Return type