diff --git a/darts/models/forecasting/block_rnn_model.py b/darts/models/forecasting/block_rnn_model.py index 5903adf9aa..afd3cbf503 100644 --- a/darts/models/forecasting/block_rnn_model.py +++ b/darts/models/forecasting/block_rnn_model.py @@ -157,9 +157,16 @@ def __init__( Parameters ---------- input_chunk_length - The number of time steps that will be fed to the internal forecasting module + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - Number of time steps to be output by the internal forecasting module. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). model Either a string specifying the RNN module type ("RNN", "LSTM" or "GRU"), or a PyTorch module with the same specifications as diff --git a/darts/models/forecasting/catboost_model.py b/darts/models/forecasting/catboost_model.py index 45ad8a1984..fbb8e3df7d 100644 --- a/darts/models/forecasting/catboost_model.py +++ b/darts/models/forecasting/catboost_model.py @@ -51,9 +51,12 @@ def __init__( `future` future lags (starting from 0 - the prediction time - up to `future - 1` included). Otherwise a list of integers with lags is required. output_chunk_length - Number of time steps predicted at once by the internal regression model. Does not have to equal the forecast - horizon `n` used in `predict()`. However, setting `output_chunk_length` equal to the forecast horizon may - be useful if the covariates don't extend far enough into the future. + Number of time steps predicted at once (per chunk) by the internal model. It is not the same as forecast + horizon `n` used in `predict()`, which is the desired number of prediction points generated using a + one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents auto-regression. This is + useful when the covariates don't extend far enough into the future, or to prohibit the model from using + future values of past and / or future covariates for prediction (depending on the model's covariate + support). add_encoders A large number of past and future covariates can be automatically generated with `add_encoders`. This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that diff --git a/darts/models/forecasting/dlinear.py b/darts/models/forecasting/dlinear.py index 62f41ee621..05faff0350 100644 --- a/darts/models/forecasting/dlinear.py +++ b/darts/models/forecasting/dlinear.py @@ -245,15 +245,23 @@ def __init__( ): """An implementation of the DLinear model, as presented in [1]_. - This implementation is improved by allowing the optional use of past covariates, - future covariates and static covariates, and by making the model optionally probabilistic. + This implementation is improved by allowing the optional use of past covariates (known for + `input_chunk_length` points before prediction time), future covariates (known for `output_chunk_length` + points after prediction time) and static covariates, as well as supporting probabilistic forecasting. Parameters ---------- input_chunk_length - The length of the input sequence fed to the model. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - The length of the forecast of the model. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). shared_weights Whether to use shared weights for all components of multivariate series. diff --git a/darts/models/forecasting/ensemble_model.py b/darts/models/forecasting/ensemble_model.py index 65e0595faf..b772594d1e 100644 --- a/darts/models/forecasting/ensemble_model.py +++ b/darts/models/forecasting/ensemble_model.py @@ -288,6 +288,7 @@ def predict( num_samples: int = 1, verbose: bool = False, predict_likelihood_parameters: bool = False, + show_warnings: bool = True, ) -> Union[TimeSeries, Sequence[TimeSeries]]: # ensure forecasting models all rely on the same series during inference if series is None: @@ -305,6 +306,7 @@ def predict( num_samples=num_samples, verbose=verbose, predict_likelihood_parameters=predict_likelihood_parameters, + show_warnings=show_warnings, ) # for single-level ensemble, probabilistic forecast is obtained directly from forecasting models diff --git a/darts/models/forecasting/forecasting_model.py b/darts/models/forecasting/forecasting_model.py index 2c2bd4909c..84a12f8a8c 100644 --- a/darts/models/forecasting/forecasting_model.py +++ b/darts/models/forecasting/forecasting_model.py @@ -879,6 +879,9 @@ def retrain_func( else: outer_iterator = _build_tqdm_iterator(series, verbose) + # deactivate the warning after displaying it once if show_warnings is True + show_predict_warnings = show_warnings + forecasts_list = [] for idx, series_ in enumerate(outer_iterator): past_covariates_ = past_covariates[idx] if past_covariates else None @@ -1061,8 +1064,11 @@ def retrain_func( num_samples=num_samples, verbose=verbose, predict_likelihood_parameters=predict_likelihood_parameters, + show_warnings=show_predict_warnings, **predict_kwargs, ) + show_predict_warnings = False + if forecast_components is None: forecast_components = forecast.columns @@ -2201,6 +2207,7 @@ def predict( num_samples: int = 1, verbose: bool = False, predict_likelihood_parameters: bool = False, + show_warnings: bool = True, ) -> Union[TimeSeries, Sequence[TimeSeries]]: """Forecasts values for `n` time steps after the end of the series. @@ -2239,6 +2246,8 @@ def predict( If set to `True`, the model predict the parameters of its Likelihood parameters instead of the target. Only supported for probabilistic models with a likelihood, `num_samples = 1` and `n<=output_chunk_length`. Default: ``False`` + show_warnings + Whether to show warnings related auto-regression and past covariates usage. Returns ------- @@ -2280,6 +2289,18 @@ def predict( "must be embedded in the target `series` passed to `predict()`." ) ) + if ( + show_warnings + and self.uses_past_covariates + and self.output_chunk_length is not None + and n > self.output_chunk_length + ): + logger.warning( + "`predict()` was called with `n > output_chunk_length`: using auto-regression to forecast " + "the values after `output_chunk_length` points. The model will access `(n - output_chunk_length)` " + "future values of your `past_covariates` (relative to the first predicted time step). " + "To hide this warning, set `show_warnings=False`." + ) @property def _supports_non_retrainable_historical_forecasts(self) -> bool: diff --git a/darts/models/forecasting/lgbm.py b/darts/models/forecasting/lgbm.py index c93927fb03..4a3d748719 100644 --- a/darts/models/forecasting/lgbm.py +++ b/darts/models/forecasting/lgbm.py @@ -78,9 +78,12 @@ def __init__( 'default_lags' can be used to provide default lags for un-specified components. Raises and error if some components are missing and the 'default_lags' key is not provided. output_chunk_length - Number of time steps predicted at once by the internal regression model. Does not have to equal the forecast - horizon `n` used in `predict()`. However, setting `output_chunk_length` equal to the forecast horizon may - be useful if the covariates don't extend far enough into the future. + Number of time steps predicted at once (per chunk) by the internal model. It is not the same as forecast + horizon `n` used in `predict()`, which is the desired number of prediction points generated using a + one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents auto-regression. This is + useful when the covariates don't extend far enough into the future, or to prohibit the model from using + future values of past and / or future covariates for prediction (depending on the model's covariate + support). add_encoders A large number of past and future covariates can be automatically generated with `add_encoders`. This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that diff --git a/darts/models/forecasting/linear_regression_model.py b/darts/models/forecasting/linear_regression_model.py index 03773cca82..24e7aec049 100644 --- a/darts/models/forecasting/linear_regression_model.py +++ b/darts/models/forecasting/linear_regression_model.py @@ -71,9 +71,12 @@ def __init__( 'default_lags' can be used to provide default lags for un-specified components. Raises and error if some components are missing and the 'default_lags' key is not provided. output_chunk_length - Number of time steps predicted at once by the internal regression model. Does not have to equal the forecast - horizon `n` used in `predict()`. However, setting `output_chunk_length` equal to the forecast horizon may - be useful if the covariates don't extend far enough into the future. + Number of time steps predicted at once (per chunk) by the internal model. It is not the same as forecast + horizon `n` used in `predict()`, which is the desired number of prediction points generated using a + one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents auto-regression. This is + useful when the covariates don't extend far enough into the future, or to prohibit the model from using + future values of past and / or future covariates for prediction (depending on the model's covariate + support). add_encoders A large number of past and future covariates can be automatically generated with `add_encoders`. This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that diff --git a/darts/models/forecasting/nbeats.py b/darts/models/forecasting/nbeats.py index 24e789a201..76daceac7a 100644 --- a/darts/models/forecasting/nbeats.py +++ b/darts/models/forecasting/nbeats.py @@ -563,9 +563,16 @@ def __init__( Parameters ---------- input_chunk_length - The length of the input sequence fed to the model. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - The length of the forecast of the model. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). generic_architecture Boolean value indicating whether the generic architecture of N-BEATS is used. If not, the interpretable architecture outlined in the paper (consisting of one trend diff --git a/darts/models/forecasting/nhits.py b/darts/models/forecasting/nhits.py index 69ba11eee3..94adc5f0ef 100644 --- a/darts/models/forecasting/nhits.py +++ b/darts/models/forecasting/nhits.py @@ -500,9 +500,16 @@ def __init__( Parameters ---------- input_chunk_length - The length of the input sequence fed to the model. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - The length of the forecast of the model. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). num_stacks The number of stacks that make up the whole model. num_blocks diff --git a/darts/models/forecasting/nlinear.py b/darts/models/forecasting/nlinear.py index 09e112f6f9..2120e32de9 100644 --- a/darts/models/forecasting/nlinear.py +++ b/darts/models/forecasting/nlinear.py @@ -191,15 +191,23 @@ def __init__( ): """An implementation of the NLinear model, as presented in [1]_. - This implementation is improved by allowing the optional use of past covariates, - future covariates and static covariates, and by making the model optionally probabilistic. + This implementation is improved by allowing the optional use of past covariates (known for + `input_chunk_length` points before prediction time), future covariates (known for `output_chunk_length` + points after prediction time) and static covariates, as well as supporting probabilistic forecasting. Parameters ---------- input_chunk_length - The length of the input sequence fed to the model. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - The length of the forecast of the model. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). shared_weights Whether to use shared weights for all components of multivariate series. diff --git a/darts/models/forecasting/pl_forecasting_module.py b/darts/models/forecasting/pl_forecasting_module.py index 79c1902a81..c58ffd57e3 100644 --- a/darts/models/forecasting/pl_forecasting_module.py +++ b/darts/models/forecasting/pl_forecasting_module.py @@ -96,9 +96,16 @@ def __init__( Parameters ---------- input_chunk_length - Number of input past time steps per chunk. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - Number of output time steps per chunk. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). train_sample_shape Shape of the model's input, used to instantiate model without calling ``fit_from_dataset`` and perform sanity check on new training/inference datasets used for re-training or prediction. diff --git a/darts/models/forecasting/random_forest.py b/darts/models/forecasting/random_forest.py index ad481ffc29..34cee5f38f 100644 --- a/darts/models/forecasting/random_forest.py +++ b/darts/models/forecasting/random_forest.py @@ -75,9 +75,12 @@ def __init__( 'default_lags' can be used to provide default lags for un-specified components. Raises and error if some components are missing and the 'default_lags' key is not provided. output_chunk_length - Number of time steps predicted at once by the internal regression model. Does not have to equal the forecast - horizon `n` used in `predict()`. However, setting `output_chunk_length` equal to the forecast horizon may - be useful if the covariates don't extend far enough into the future. + Number of time steps predicted at once (per chunk) by the internal model. It is not the same as forecast + horizon `n` used in `predict()`, which is the desired number of prediction points generated using a + one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents auto-regression. This is + useful when the covariates don't extend far enough into the future, or to prohibit the model from using + future values of past and / or future covariates for prediction (depending on the model's covariate + support). add_encoders A large number of past and future covariates can be automatically generated with `add_encoders`. This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that diff --git a/darts/models/forecasting/regression_model.py b/darts/models/forecasting/regression_model.py index cc1dc61205..3058aa87ea 100644 --- a/darts/models/forecasting/regression_model.py +++ b/darts/models/forecasting/regression_model.py @@ -114,9 +114,12 @@ def __init__( 'default_lags' can be used to provide default lags for un-specified components. Raises and error if some components are missing and the 'default_lags' key is not provided. output_chunk_length - Number of time steps predicted at once by the internal regression model. Does not have to equal the forecast - horizon `n` used in `predict()`. However, setting `output_chunk_length` equal to the forecast horizon may - be useful if the covariates don't extend far enough into the future. + Number of time steps predicted at once (per chunk) by the internal model. It is not the same as forecast + horizon `n` used in `predict()`, which is the desired number of prediction points generated using a + one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents auto-regression. This is + useful when the covariates don't extend far enough into the future, or to prohibit the model from using + future values of past and / or future covariates for prediction (depending on the model's covariate + support). add_encoders A large number of past and future covariates can be automatically generated with `add_encoders`. This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that @@ -738,6 +741,7 @@ def predict( num_samples: int = 1, verbose: bool = False, predict_likelihood_parameters: bool = False, + show_warnings: bool = True, **kwargs, ) -> Union[TimeSeries, Sequence[TimeSeries]]: """Forecasts values for `n` time steps after the end of the series. @@ -813,6 +817,7 @@ def predict( num_samples, verbose, predict_likelihood_parameters, + show_warnings, ) # check that the input sizes of the target series and covariates match @@ -1500,9 +1505,12 @@ def __init__( `future` future lags (starting from 0 - the prediction time - up to `future - 1` included). Otherwise a list of integers with lags is required. output_chunk_length - Number of time steps predicted at once by the internal regression model. Does not have to equal the forecast - horizon `n` used in `predict()`. However, setting `output_chunk_length` equal to the forecast horizon may - be useful if the covariates don't extend far enough into the future. + Number of time steps predicted at once (per chunk) by the internal model. It is not the same as forecast + horizon `n` used in `predict()`, which is the desired number of prediction points generated using a + one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents auto-regression. This is + useful when the covariates don't extend far enough into the future, or to prohibit the model from using + future values of past and / or future covariates for prediction (depending on the model's covariate + support). add_encoders A large number of past and future covariates can be automatically generated with `add_encoders`. This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that diff --git a/darts/models/forecasting/tcn_model.py b/darts/models/forecasting/tcn_model.py index 076fd939df..7f53b8781c 100644 --- a/darts/models/forecasting/tcn_model.py +++ b/darts/models/forecasting/tcn_model.py @@ -279,9 +279,16 @@ def __init__( Parameters ---------- input_chunk_length - Number of past time steps that are fed to the forecasting module. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - Number of time steps the torch module will predict into the future at once. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). kernel_size The size of every kernel in a convolutional layer. num_filters diff --git a/darts/models/forecasting/tft_model.py b/darts/models/forecasting/tft_model.py index f77255c601..e6e503f974 100644 --- a/darts/models/forecasting/tft_model.py +++ b/darts/models/forecasting/tft_model.py @@ -683,8 +683,9 @@ def __init__( The internal sub models are adopted from `pytorch-forecasting's TemporalFusionTransformer `_ implementation. - This model supports mixed covariates (includes past covariates known for ``input_chunk_length`` - points before prediction time and future covariates known for ``output_chunk_length`` after prediction time). + This model supports past covariates (known for `input_chunk_length` points before prediction time), + future covariates (known for `output_chunk_length` points after prediction time), static covariates, + as well as probabilistic forecasting. The TFT applies multi-head attention queries on future inputs from mandatory ``future_covariates``. Specifying future encoders with ``add_encoders`` (read below) can automatically generate future covariates @@ -697,9 +698,18 @@ def __init__( Parameters ---------- input_chunk_length - Encoder length; number of past time steps that are fed to the forecasting module at prediction time. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). + Also called: Encoder length output_chunk_length - Decoder length; number of future time steps that are fed to the forecasting module at prediction time. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). + Also called: Decoder length hidden_size Hidden state size of the TFT. It is the main hyper-parameter and common across the internal TFT architecture. diff --git a/darts/models/forecasting/tide_model.py b/darts/models/forecasting/tide_model.py index 57704e21dd..3005020268 100644 --- a/darts/models/forecasting/tide_model.py +++ b/darts/models/forecasting/tide_model.py @@ -383,11 +383,9 @@ def __init__( but attempts to provide better performance at lower computational cost by introducing multilayer perceptron (MLP)-based encoder-decoders without attention. - The model is implemented as a :class:`MixedCovariatesTorchModel`, which means that it supports - both past and future covariates, as well as static covariates. Probabilistic forecasting is supported through - the use of a `likelihood` instead of a `loss_fn`. - The original paper does not describe how past covariates are treated in detail, so we assume that they are - passed to the encoder as-is. + This model supports past covariates (known for `input_chunk_length` points before prediction time), + future covariates (known for `output_chunk_length` points after prediction time), static covariates, + as well as probabilistic forecasting. The encoder and decoder are implemented as a series of residual blocks. The number of residual blocks in the encoder and decoder can be controlled via ``num_encoder_layers`` and ``num_decoder_layers`` respectively. @@ -397,9 +395,16 @@ def __init__( Parameters ---------- input_chunk_length - The length of the input sequence fed to the model. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - The length of the forecast of the model. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). num_encoder_layers The number of residual blocks in the encoder. num_decoder_layers diff --git a/darts/models/forecasting/torch_forecasting_model.py b/darts/models/forecasting/torch_forecasting_model.py index b8348af5a7..d9d3508e48 100644 --- a/darts/models/forecasting/torch_forecasting_model.py +++ b/darts/models/forecasting/torch_forecasting_model.py @@ -1232,6 +1232,7 @@ def predict( num_loader_workers: int = 0, mc_dropout: bool = False, predict_likelihood_parameters: bool = False, + show_warnings: bool = True, ) -> Union[TimeSeries, Sequence[TimeSeries]]: """Predict the ``n`` time step following the end of the training series, or of the specified ``series``. @@ -1351,6 +1352,7 @@ def predict( future_covariates, num_samples=num_samples, predict_likelihood_parameters=predict_likelihood_parameters, + show_warnings=show_warnings, ) dataset = self._build_inference_dataset( diff --git a/darts/models/forecasting/transformer_model.py b/darts/models/forecasting/transformer_model.py index 6430b1d108..775c2e05ca 100644 --- a/darts/models/forecasting/transformer_model.py +++ b/darts/models/forecasting/transformer_model.py @@ -356,9 +356,16 @@ def __init__( Parameters ---------- input_chunk_length - Number of time steps to be input to the forecasting module. + Number of time steps in the past to take as a model input (per chunk). Applies to the target + series, and past and/or future covariates (if the model supports it). output_chunk_length - Number of time steps to be output by the forecasting module. + Number of time steps predicted at once (per chunk) by the internal model. Also, the number of future values + from future covariates to use as a model input (if the model supports future covariates). It is not the same + as forecast horizon `n` used in `predict()`, which is the desired number of prediction points generated + using either a one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents + auto-regression. This is useful when the covariates don't extend far enough into the future, or to prohibit + the model from using future values of past and / or future covariates for prediction (depending on the + model's covariate support). d_model The number of expected features in the transformer encoder/decoder inputs (default=64). nhead diff --git a/darts/models/forecasting/xgboost.py b/darts/models/forecasting/xgboost.py index 417b00413f..246e68c17a 100644 --- a/darts/models/forecasting/xgboost.py +++ b/darts/models/forecasting/xgboost.py @@ -97,9 +97,12 @@ def __init__( 'default_lags' can be used to provide default lags for un-specified components. Raises and error if some components are missing and the 'default_lags' key is not provided. output_chunk_length - Number of time steps predicted at once by the internal regression model. Does not have to equal the forecast - horizon `n` used in `predict()`. However, setting `output_chunk_length` equal to the forecast horizon may - be useful if the covariates don't extend far enough into the future. + Number of time steps predicted at once (per chunk) by the internal model. It is not the same as forecast + horizon `n` used in `predict()`, which is the desired number of prediction points generated using a + one-shot- or auto-regressive forecast. Setting `n <= output_chunk_length` prevents auto-regression. This is + useful when the covariates don't extend far enough into the future, or to prohibit the model from using + future values of past and / or future covariates for prediction (depending on the model's covariate + support). add_encoders A large number of past and future covariates can be automatically generated with `add_encoders`. This can be done by adding multiple pre-defined index encoders and/or custom user-made functions that diff --git a/darts/tests/models/forecasting/test_backtesting.py b/darts/tests/models/forecasting/test_backtesting.py index e54ca70d5d..ffea1b2ba5 100644 --- a/darts/tests/models/forecasting/test_backtesting.py +++ b/darts/tests/models/forecasting/test_backtesting.py @@ -654,13 +654,14 @@ def test_gridsearch_multi(self): @pytest.mark.parametrize( "model_cls,parameters", - zip([Theta, ARIMA], [{"theta": [3, 4]}, {"p": [18, 4]}]), + zip([NaiveSeasonal, ARIMA], [{"K": [1, 2]}, {"p": [18, 4]}]), ) def test_gridsearch_bad_covariates(self, model_cls, parameters): """Passing unsupported covariate should raise an exception""" dummy_series = get_dummy_series( ts_length=100, lt_end_value=1, st_value_offset=0 ).astype(np.float32) + ts_train, ts_val = dummy_series.split_before(split_point=0.8) bt_kwargs = {"start": -1, "start_format": "position", "show_warnings": False} diff --git a/darts/utils/historical_forecasts/optimized_historical_forecasts_torch.py b/darts/utils/historical_forecasts/optimized_historical_forecasts_torch.py index 2079850e2b..0aa41d4eab 100644 --- a/darts/utils/historical_forecasts/optimized_historical_forecasts_torch.py +++ b/darts/utils/historical_forecasts/optimized_historical_forecasts_torch.py @@ -103,6 +103,7 @@ def _optimized_historical_forecasts( future_covariates, num_samples=num_samples, predict_likelihood_parameters=predict_likelihood_parameters, + show_warnings=show_warnings, **{k: v for k, v in kwargs.items() if k in super_predict_params}, )