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

Refactor/hist fc general #1801

Merged
merged 10 commits into from
May 28, 2023
Prev Previous commit
Next Next commit
replace series.drop_*() with series.slice() for performance boost
  • Loading branch information
dennisbader committed Apr 19, 2023
commit 998468068dec1f63419e7c2921c185c57b5dd718
4 changes: 2 additions & 2 deletions darts/models/forecasting/forecasting_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ def retrain_func(

# adjust the start of the series depending on whether we train (at some point), or predict only
if min_timestamp_series > series_.time_index[0]:
series_ = series_.drop_before(min_timestamp_series - 1 * series_.freq)
series_ = series_.slice(min_timestamp_series, series_.end_time())

if len(series) == 1:
# Only use tqdm if there's no outer loop
Expand All @@ -1026,7 +1026,7 @@ def retrain_func(
# iterate and forecast
for _counter, pred_time in enumerate(iterator):
# drop everything after `pred_time` to train on / predict with shifting input
train_series = series_.drop_after(pred_time)
train_series = series_.slice(min_timestamp_series, pred_time - series_.freq)

# optionally, apply moving window (instead of expanding window)
if train_length_ and len(train_series) > train_length_:
Expand Down