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

add already existing forecasts param #1597

Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion darts/models/forecasting/forecasting_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ def historical_forecasts(
def backtest(
self,
series: Union[TimeSeries, Sequence[TimeSeries]],
historical_forecasts: Optional[Union[TimeSeries, Sequence[TimeSeries]]] = None,
past_covariates: Optional[Union[TimeSeries, Sequence[TimeSeries]]] = None,
future_covariates: Optional[Union[TimeSeries, Sequence[TimeSeries]]] = None,
num_samples: int = 1,
Expand Down Expand Up @@ -950,6 +951,8 @@ def backtest(
----------
series
The (or a sequence of) target time series to use to successively train and evaluate the historical forecasts
historical_forecasts
Optionally, the (or a sequence of) historical forecasts time series to be evaluated.
past_covariates
Optionally, one (or a sequence of) past-observed covariate series.
This applies only if the model supports past covariates.
Expand Down Expand Up @@ -1022,7 +1025,7 @@ def backtest(
provided series and each sample.
"""

forecasts = self.historical_forecasts(
forecasts = historical_forecasts or self.historical_forecasts(
series=series,
past_covariates=past_covariates,
future_covariates=future_covariates,
Expand Down