-
Notifications
You must be signed in to change notification settings - Fork 815
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
dennisbader
merged 11 commits into
master
from
fix/historical_fore_fut_cov_notarget_lags
Apr 2, 2023
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
83ee28b
correction
dumjax 501081c
Delete test_.py
dumjax 8caf166
corrections
dumjax d4d7efb
corrections
dumjax 4a7f648
corrections
dumjax 421f7b0
corrections
dumjax 8e0c748
corrections docstring of
dumjax 04c9833
Update darts/models/forecasting/forecasting_model.py
dumjax b332d04
Update darts/models/forecasting/forecasting_model.py
dumjax 6213d47
corrections docstring of extreme_lags
dumjax 2599299
corrections docstring of extreme_lags
dumjax File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -371,7 +371,7 @@ def _predict_sample_time_index_length(self) -> int: | |
|
||
def _get_historical_forecastable_time_index( | ||
self, | ||
series: Optional[TimeSeries] = None, | ||
series: TimeSeries, | ||
past_covariates: Optional[TimeSeries] = None, | ||
future_covariates: Optional[TimeSeries] = None, | ||
is_training: Optional[bool] = False, | ||
|
@@ -392,7 +392,7 @@ def _get_historical_forecastable_time_index( | |
Parameters | ||
---------- | ||
series | ||
Optionally, a target series. | ||
A target series. | ||
past_covariates | ||
Optionally, a past covariates. | ||
future_covariates | ||
|
@@ -440,20 +440,19 @@ def _get_historical_forecastable_time_index( | |
max_future_cov_lag, | ||
) = self.extreme_lags | ||
|
||
intersect_ = None | ||
if min_target_lag is None: | ||
min_target_lag = 0 | ||
|
||
# target longest possible time index | ||
if (min_target_lag is not None) and (series is not None): | ||
intersect_ = generate_index( | ||
start=series.start_time() | ||
- (min_target_lag - max_target_lag) * series.freq | ||
if is_training | ||
else series.start_time() - min_target_lag * series.freq, | ||
end=series.end_time(), | ||
freq=series.freq, | ||
) | ||
# longest possible time index for target | ||
intersect_ = generate_index( | ||
start=series.start_time() - (min_target_lag - max_target_lag) * series.freq | ||
if is_training | ||
else series.start_time() - min_target_lag * series.freq, | ||
end=series.end_time(), | ||
freq=series.freq, | ||
) | ||
|
||
# past covariates longest possible time index | ||
# longest possible time index for past covariates | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
|
||
if (min_past_cov_lag is not None) and (past_covariates is not None): | ||
tmp_ = generate_index( | ||
start=past_covariates.start_time() | ||
|
@@ -469,7 +468,7 @@ def _get_historical_forecastable_time_index( | |
else: | ||
intersect_ = tmp_ | ||
|
||
# future covariates longest possible time index | ||
# longest possible time index for future covariates | ||
if (min_future_cov_lag is not None) and (future_covariates is not None): | ||
tmp_ = generate_index( | ||
start=future_covariates.start_time() | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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