You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When generating a historical forecast using regression model and last point forecasting on a model with output_chunk_shift > 0, time indices are not shifted according to the output_chunk_shift. This is only the case when doing an 'optimized' historical forecast (when you get into darts.utils.historical_forecasts.optimized_historical_forecasts_regression._optimized_historical_forecasts_last_points_only.
To Reproduce
from darts.datasets import AirPassengersDataset
from darts.models import RegressionModel
series = AirPassengersDataset().load()
model = RegressionModel(lags=20, output_chunk_shift=5)
model.fit(series)
historical = model.historical_forecasts(series=series,
retrain=False,
forecast_horizon=1)
series.plot(label="actual")
historical.plot(label="historical")
This will plot this image:
Expected behavior
The returned historical series don´t have their time index shifted respecting the output chunk shift.
The following result would be correct:
System (please complete the following information):
Python version: 3.12
darts version 0.31.0
Additional context
I will create a PR for this.
I've also inspected darts.utils.historical_forecasts.optimized_historical_forecasts_regression._optimized_historical_forecasts_all_points, which does seem to always take into account the output_chunk_shift unconditionally. I also looked at darts.utils.historical_forecasts.optimized_historical_forecasts_tocrch._optimized_historical_forecasts, which also doesn´t seem affected.
The text was updated successfully, but these errors were encountered:
Describe the bug
When generating a historical forecast using regression model and last point forecasting on a model with
output_chunk_shift > 0
, time indices are not shifted according to theoutput_chunk_shift
. This is only the case when doing an 'optimized' historical forecast (when you get intodarts.utils.historical_forecasts.optimized_historical_forecasts_regression._optimized_historical_forecasts_last_points_only
.To Reproduce
This will plot this image:
![image](https://private-user-images.githubusercontent.com/3415484/398568670-4b33c0c2-c527-4a42-90c4-7e19a56f1ac6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NjE0MjMsIm5iZiI6MTczODk2MTEyMywicGF0aCI6Ii8zNDE1NDg0LzM5ODU2ODY3MC00Y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TRkMDEwZTFhNWE0Nzc0NTFhNzA0NjY3YzlmNWUzYmY2ODliY2UxMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ibYdoZV-v6mARqQrhDQN8YfIO67DKNYWIy7dkN7qY18)
The returned historical series don´t have their time index shifted respecting the output chunk shift.
The following result would be correct:
System (please complete the following information):
Additional context
I will create a PR for this.
I've also inspected
darts.utils.historical_forecasts.optimized_historical_forecasts_regression._optimized_historical_forecasts_all_points
, which does seem to always take into account theoutput_chunk_shift
unconditionally. I also looked atdarts.utils.historical_forecasts.optimized_historical_forecasts_tocrch._optimized_historical_forecasts
, which also doesn´t seem affected.The text was updated successfully, but these errors were encountered: