Skip to content

Enabling passing context into Model.forecast #845

Closed
Mr-Geekman opened this issue Aug 10, 2022 · 1 comment
Closed

Enabling passing context into Model.forecast #845

Mr-Geekman opened this issue Aug 10, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Mr-Geekman
Copy link
Contributor

Mr-Geekman commented Aug 10, 2022

🚀 Feature Request

We decided that we want to enable passing context into forecast method of the model. It will be done with a new parameter: prediction_size. First n - prediction_size points in a given ts won't be forecasted and if model needs a context, it will use this points for this.

Proposal

  1. Add prediction_size parameter for the adapters.
    • implement separately common logic on selection of last prediction_size elements of prediction
  2. Add prediction_size parameter to forecast method in classes:
    • base.Model
    • base.ForecastAbstractModel
    • base.PredictIntervalAbstractModel
    • base.PerSegmentModel -- determine the context needed for prediction and pass it into the adapter in df_context parameter, if context isn't needed don't pass df_context.
    • base.PerSegmentPredictionIntervalModel -- same as above
    • base.MultiSegmentModel -- same as above
    • base.DeepBaseAbstractModel -- rename horizon to prediction_size
    • base.DeepBaseModel -- rename horizon to prediction_size
    • add to other classes if it wasn't enough
    • default value should be None and in the body of the function correct value is determined as a maximum possible prediction_size
    • if a too big prediction_size is set (not enough context) throw an error
  3. Fix forecast in pipelines to work with context
    • Fix Pipeline.forecast, the code should be similar to snippet with DeepBaseModel
    • Fix AutoRegressivePipeline.forecast
    • Fix ensembles.

Test cases

  1. Make sure current tests pass.
  2. Test function on selection of last prediction_size elements for adapters.
  3. Test that if prediction_size is None then value is determined as len(df) - context_size. Probably, it is convenient to do with some dummy/mock model.
  4. Test that models throw error if prediction_size is too big. Look above about dummy/mock.
  5. Test that Pipeline.forecast passes big enough dataset according to `horizon. Look above about dummy/mock.
  6. Test that AutoRegressivePipeline.forecast passes big enough dataset according to horizon. Look above about dummy/mock.

Additional context

@Mr-Geekman
Copy link
Contributor Author

Done wia #888.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant