estimate_max_n_folds

estimate_max_n_folds(pipeline: etna.pipeline.pipeline.Pipeline, method_name: Union[Literal['forecast'], Literal['backtest']], context_size: int, ts: Optional[etna.datasets.tsdataset.TSDataset] = None, **method_kwargs) int[source]

Estimate number of folds using provided data and pipeline configuration.

This function helps to estimate maximum number of folds that can be used when performing forecast with intervals or pipeline backtest. Number of folds estimated using the following formula:

\[max\_n\_folds = \left\lfloor\frac{num\_points - horizon + stride - context\_size}{stride}\right\rfloor,\]

where \(num\_points\) is number of points in the dataset, \(horizon\) is length of forecasting horizon, \(stride\) is number of points between folds, \(context\_size\) is pipeline context size.

Parameters
  • pipeline (etna.pipeline.pipeline.Pipeline) – Pipeline for which to estimate number of folds.

  • method_name (Union[Literal['forecast'], typing.Literal['backtest']]) – Method name for which to estimate number of folds.

  • context_size (int) – Minimum number of points for pipeline to be estimated.

  • ts (Optional[etna.datasets.tsdataset.TSDataset]) – Dataset which will be used for estimation.

  • method_kwargs – Additional arguments for methods that impact number of folds.

Returns

Number of folds.

Return type

int