Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] RegressionModel historical forecasts with specific encoder lags #1875

Closed
dennisbader opened this issue Jul 2, 2023 · 0 comments · Fixed by #2034
Closed

[BUG] RegressionModel historical forecasts with specific encoder lags #1875

dennisbader opened this issue Jul 2, 2023 · 0 comments · Fixed by #2034
Assignees
Labels
bug Something isn't working
Projects

Comments

@dennisbader
Copy link
Collaborator

dennisbader commented Jul 2, 2023

Describe the bug
There is a bug when calling historical_forecasts on a RegressionModel that uses encoders with a non-divisible frequency RegressionModels and non-overlapping maximum lag with the target lags.

To Reproduce

from darts.models import LinearRegressionModel
from darts.datasets import AirPassengersDataset

model = LinearRegressionModel(
    lags=3,
    lags_past_covariates=[-3, -2],
    add_encoders={
        "cyclic": {"past": ["month"]},
    }
)

series = AirPassengersDataset().load()
hc = model.historical_forecasts(series=series)

Expected behavior
Should not raise an error. The error

System (please complete the following information):

  • Python version: [e.g. 3.10]
  • darts version [master]

Additional context
The error can be avoided by passing series also as past_covariates to historical forecasts. Reason is that encoders are generated on the fly with minimum time span requirements -> we have to calculate the expected start index of covariates because it is not available in the time index generated by the encoders.

@dennisbader dennisbader added bug Something isn't working triage Issue waiting for triaging and removed triage Issue waiting for triaging labels Jul 2, 2023
@dennisbader dennisbader added this to To do in darts via automation Jul 2, 2023
@dennisbader dennisbader changed the title [BUG] [BUG] RegressionModel historical forecasts with specific encoder lags Jul 2, 2023
@dennisbader dennisbader moved this from To do to In progress in darts Sep 19, 2023
darts automation moved this from In progress to Done Oct 28, 2023
@dennisbader dennisbader moved this from Done to Released in darts Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
darts
Released
Development

Successfully merging a pull request may close this issue.

2 participants