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

fix/historical_fore_fut_cov_notarget_lags #1685

Merged
merged 11 commits into from Apr 2, 2023

Conversation

dumjax
Copy link
Contributor

@dumjax dumjax commented Apr 1, 2023

Special case where the lags are just fut covariates

Summary

Other Information

@dumjax dumjax requested a review from dennisbader as a code owner April 1, 2023 14:57
@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.11 ⚠️

Comparison is base (5479108) 94.15% compared to head (2599299) 94.05%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1685      +/-   ##
==========================================
- Coverage   94.15%   94.05%   -0.11%     
==========================================
  Files         125      125              
  Lines       11384    11371      -13     
==========================================
- Hits        10719    10695      -24     
- Misses        665      676      +11     
Impacted Files Coverage Δ
...arts/models/forecasting/torch_forecasting_model.py 90.01% <ø> (-0.21%) ⬇️
darts/models/forecasting/baselines.py 100.00% <100.00%> (ø)
darts/models/forecasting/forecasting_model.py 96.34% <100.00%> (-0.44%) ⬇️
darts/models/forecasting/regression_model.py 97.12% <100.00%> (+<0.01%) ⬆️

... and 8 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dumjax for fixing this! 🚀

I believe the way we currently handle past covariates doesn't cover all uses cases. I added a comment. Could you have a look?

end=series.end_time(),
freq=series.freq,
)
# longest possible time index for target
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :) Could you add some unit tests which check the issue?
It's always good when fixing a bug to add a unit test, because we apparently haven't checked it before


# past covariates longest possible time index
# longest possible time index for past covariates
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the past covariates generated indexes cover all use cases:

  • What happens with RegressionModel(lags_past_covariates=[-100], output_chunk_length=1)?
    The user supplied past_covariates for fit()can actually be much shorter than the target series (101 steps shorter, I believe).
    With the current logic and the shorter past_covariates, the intersection would result in a much shorter historic_forecastable_time_index (because of the end=past_covariates.end_time()). We probably need the max_past_cov_lag as well.
    I think for future covariates it is correct, so similarly including the max_past_cov lag should probably work
  • also is the method supposed to also give the predictable indices after the end (when is_training=False) taking into account the output_chunk_length/max_target_lag? Then we would have to add the max_target_lag to all end parameters

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dumjax , looks great! 🚀

Just some minor comments :)

darts/models/forecasting/forecasting_model.py Outdated Show resolved Hide resolved
darts/models/forecasting/forecasting_model.py Outdated Show resolved Hide resolved
>>> model = LinearRegressionModel(lags=[3, 5], past_covariates_lags = 4, output_chunk_length=7)
>>> model.fit(train_series, past_covariates=past_covariates)
>>> model.extreme_lags
(-5, 7, -4, None, None)
(-5, 6, -4, None, None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(-5, 6, -4, None, None)
(-5, 6, -4, -4, None)

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@dennisbader dennisbader merged commit 69e83dc into master Apr 2, 2023
9 checks passed
alexcolpitts96 pushed a commit to alexcolpitts96/darts that referenced this pull request May 31, 2023
@madtoinou madtoinou deleted the fix/historical_fore_fut_cov_notarget_lags branch July 5, 2023 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants