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_forecasts() with future covariates #1466

Closed
hrzn opened this issue Jan 5, 2023 · 0 comments · Fixed by #1481
Closed

Fix historical_forecasts() with future covariates #1466

hrzn opened this issue Jan 5, 2023 · 0 comments · Fixed by #1481
Assignees
Labels
bug Something isn't working

Comments

@hrzn
Copy link
Contributor

hrzn commented Jan 5, 2023

To reproduce:

import os

from darts.models import TFTModel
from darts.datasets import AirPassengersDataset
from darts.utils.timeseries_generation import linear_timeseries

output_chunk_length = 6
series = AirPassengersDataset().load()
past_covs = linear_timeseries(start=series.start_time(), length=len(series), freq=series.freq)
future_covs = linear_timeseries(start=series.start_time(), length=len(series) + output_chunk_length, freq=series.freq)

save_path = os.path.join(os.getcwd(), "nbeats_1455.pt")
model = TFTModel(input_chunk_length=12, output_chunk_length=output_chunk_length)
model.fit(
    series,
    past_covariates=past_covs,
    future_covariates=future_covs,
    verbose=True,
    epochs=3
)
model.save(save_path)

model_loaded = TFTModel.load(save_path)
model_loaded.historical_forecasts(
    series=series,
    past_covariates=past_covs,
    future_covariates=future_covs,
    # start=0.15,
    forecast_horizon=6,
    stride=6,
    retrain=False,
    verbose=False,
)
@hrzn hrzn added the bug Something isn't working label Jan 10, 2023
@hrzn hrzn assigned hrzn and dumjax Jan 10, 2023
@hrzn hrzn linked a pull request Jan 12, 2023 that will close this issue
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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants