etna icon indicating copy to clipboard operation
etna copied to clipboard

Add method for determining the size of the context

Open Mr-Geekman opened this issue 1 year ago • 0 comments

🚀 Feature Request

We decided that we want to enable passing context into forecast method of the model. For this we should for each model define its context size. For most of the models it will be zero, but for a few it will be positive and we want to enable passing of it.

Proposal

Add attribute/property context_size:

  1. Add abstract property context_size to base.FitAbstractModel.
  2. For SeasonalMovingAverageModel it is equal to window * seasonality.
  3. For DeepBaseModel it is equal to encoder_length.
  4. For DeadlineMovingAverageModel we can get only upper bound, determine it like in every month we have 31 day and in every year 366 days.
  5. For all other models define context_size as class attribute and return 0.

Test cases

  1. Check that for SeasonalMovingAverageModel and its heirs context_size is calculated correctly.
  2. Check that for heirs of DeepBaseModel context_size is calculated correctly.
  3. Check that for DeadlineMovingAverageModel context_size is determined correctly, check that if model isn't fit then exception is raised.

We don't have to check that all models have context_size because it will be checked when we will teach models to work with context. If model won't have a context_size then during prediction we will fail.

Additional context

Merge it into an inference branch.

Mr-Geekman avatar Aug 10 '22 12:08 Mr-Geekman