etna
etna copied to clipboard
Add method for determining the size of the context
🚀 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
:
- Add abstract property
context_size
tobase.FitAbstractModel
. - For
SeasonalMovingAverageModel
it is equal towindow * seasonality
. - For
DeepBaseModel
it is equal toencoder_length
. - For
DeadlineMovingAverageModel
we can get only upper bound, determine it like in every month we have 31 day and in every year 366 days. - For all other models define
context_size
as class attribute and return 0.
Test cases
- Check that for
SeasonalMovingAverageModel
and its heirscontext_size
is calculated correctly. - Check that for
heirs
ofDeepBaseModel
context_size
is calculated correctly. - 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.