tinkoff-ai/etna

Folds number estimation

brsnw250 opened this issue ยท 0 comments

๐Ÿš€ Feature Request

Add the function estimate_max_n_folds to estimate the maximum number of folds for a given data/pipeline configuration.

Proposal

def estimate_max_n_folds(pipeline: Pipeline, ts: TSDataset, method: Union[Literal["forecast"], Literal["backtest"]], **method_kwargs) -> int:
    pass

Function estimates number of folds using provided data and Pipeline configuration (transforms and model).

  • method -- method name for which to estimate the number of folds
  • method_kwargs -- additional arguments for methods that impact number of folds. For forecast this is prediction_interval. For backtest -- forecast_params (e.g. forecast_params={"prediction_interval": True, "n_folds": 3})

Take into account stride parameter when estimating folds number for backtest.

Raise NotImplementedError in case of backtest with prediction intervals(method='backtest' and method_kwargs contains forecast_params={"prediction_interval": True})

When estimating for forecast or backtest without intervals function returns single integer number for n_folds argument.

Test cases

  • Test that folds estimated for both methods (with and without intervals)
  • Test that function raises error in the case of backtest with intervals
  • Test that estimated number of folds are valid for different pipelines and data configurations

Additional context

No response