Inference Dataset

class darts.utils.data.inference_dataset.DualCovariatesInferenceDataset(target_series, covariates=None, n=1, stride=0, bounds=None, input_chunk_length=12, output_chunk_length=1, output_chunk_shift=0, use_static_covariates=True)[source]

Bases: InferenceDataset

Contains (past_target, historic_future_covariates, future_covariates, static_covariates) tuples.

Parameters
  • target_series (Union[TimeSeries, Sequence[TimeSeries]]) – The target series that are to be predicted into the future.

  • covariates (Union[TimeSeries, Sequence[TimeSeries], None]) – Optionally, some future-known covariates that are used for predictions. This argument is required if the model was trained with future-known covariates.

  • n (int) – Forecast horizon: The number of time steps to predict after the end of the target series.

  • stride (int) – Optionally, the number of time steps between two consecutive predictions. Can only be used together with bounds.

  • bounds (Optional[ndarray]) – Optionally, an array of shape (n series, 2), with the left and right prediction start point boundaries per series. The boundaries must represent the positional index of the series (0, len(series)). If provided, stride must be >=1.

  • input_chunk_length (int) – The length of the target series the model takes as input.

  • output_chunk_length (int) – The length of the target series the model emits in output.

  • output_chunk_shift (int) – Optionally, the number of steps to shift the start of the output chunk into the future.

  • use_static_covariates (bool) – Whether to use/include static covariate data from input series.

class darts.utils.data.inference_dataset.FutureCovariatesInferenceDataset(target_series, covariates=None, n=1, stride=0, bounds=None, input_chunk_length=12, output_chunk_length=None, output_chunk_shift=0, covariate_type=CovariateType.FUTURE, use_static_covariates=True)[source]

Bases: InferenceDataset

Contains (past_target, future_covariates, static_covariates) tuples

Parameters
  • target_series (Union[TimeSeries, Sequence[TimeSeries]]) – The target series that are to be predicted into the future.

  • covariates (Union[TimeSeries, Sequence[TimeSeries], None]) – Optionally, some future-known covariates that are used for predictions. This argument is required if the model was trained with future-known covariates.

  • n (int) – Forecast horizon: The number of time steps to predict after the end of the target series.

  • stride (int) – Optionally, the number of time steps between two consecutive predictions. Can only be used together with bounds.

  • bounds (Optional[ndarray]) – Optionally, an array of shape (n series, 2), with the left and right prediction start point boundaries per series. The boundaries must represent the positional index of the series (0, len(series)). If provided, stride must be >=1.

  • input_chunk_length (int) – The length of the target series the model takes as input.

  • output_chunk_length (Optional[int]) – Optionally, the length of the target series the model emits in output. If None, will use the same value as n.

  • output_chunk_shift (int) – Optionally, the number of steps to shift the start of the output chunk into the future.

  • use_static_covariates (bool) – Whether to use/include static covariate data from input series.

class darts.utils.data.inference_dataset.GenericInferenceDataset(target_series, covariates=None, n=1, stride=0, bounds=None, input_chunk_length=12, output_chunk_length=1, output_chunk_shift=0, covariate_type=CovariateType.PAST, use_static_covariates=True)[source]

Bases: InferenceDataset

Contains (past_target, past_covariates | historic_future_covariates, future_past_covariates | future_covariate, static_covariates).

“future_past_covariates” are past covariates that happen to be also known in the future - those are needed for forecasting with n > output_chunk_length by any model relying on past covariates. For this reason, when n > output_chunk_length, this dataset will also emit the “future past_covariates”.

“historic_future_covariates” are historic future covariates that are given for the input_chunk in the past.

Parameters
  • target_series (Union[TimeSeries, Sequence[TimeSeries]]) – The target series that are to be predicted into the future.

  • covariates (Union[TimeSeries, Sequence[TimeSeries], None]) – Optionally, one or a sequence of TimeSeries containing either past or future covariates. If covariates were used during training, the same type of cavariates must be supplied at prediction.

  • n (int) – Forecast horizon: The number of time steps to predict after the end of the target series.

  • stride (int) – Optionally, the number of time steps between two consecutive predictions. Can only be used together with bounds.

  • bounds (Optional[ndarray]) – Optionally, an array of shape (n series, 2), with the left and right prediction start point boundaries per series. The boundaries must represent the positional index of the series (0, len(series)). If provided, stride must be >=1.

  • input_chunk_length (int) – The length of the target series the model takes as input.

  • output_chunk_length (int) – The length of the target series the model emits in output.

  • output_chunk_shift (int) – Optionally, the number of steps to shift the start of the output chunk into the future.

  • use_static_covariates (bool) – Whether to use/include static covariate data from input series.

Methods

find_list_index

static find_list_index(index, cumulative_lengths, bounds, stride)[source]
class darts.utils.data.inference_dataset.InferenceDataset[source]

Bases: ABC, Dataset

Abstract class for all darts torch inference dataset.

It can be used as models’ inputs, to obtain simple forecasts on each TimeSeries (using covariates if specified).

The first elements of the tuples it contains are numpy arrays (which will be translated to torch tensors by the torch DataLoader). The last elements of the tuples are the (past) target TimeSeries, which is needed in order to properly construct the time axis of the forecast series.

class darts.utils.data.inference_dataset.MixedCovariatesInferenceDataset(target_series, past_covariates=None, future_covariates=None, n=1, stride=0, bounds=None, input_chunk_length=12, output_chunk_length=1, output_chunk_shift=0, use_static_covariates=True)[source]

Bases: InferenceDataset

Contains (past_target, past_covariates, historic_future_covariates, future_covariates, future_past_covariates, static_covariates) tuples. “future_past_covariates” are past covariates that happen to be also known in the future - those are needed for forecasting with n > output_chunk_length by any model relying on past covariates.

Parameters
  • target_series (Union[TimeSeries, Sequence[TimeSeries]]) – The target series that are to be predicted into the future.

  • past_covariates (Union[TimeSeries, Sequence[TimeSeries], None]) – Optionally, some past-observed covariates that are used for predictions. This argument is required if the model was trained with past-observed covariates.

  • future_covariates (Union[TimeSeries, Sequence[TimeSeries], None]) – Optionally, some future-known covariates that are used for predictions. This argument is required if the model was trained with future-known covariates.

  • n (int) – Forecast horizon: The number of time steps to predict after the end of the target series.

  • stride (int) – Optionally, the number of time steps between two consecutive predictions. Can only be used together with bounds.

  • bounds (Optional[ndarray]) – Optionally, an array of shape (n series, 2), with the left and right prediction start point boundaries per series. The boundaries must represent the positional index of the series (0, len(series)). If provided, stride must be >=1.

  • input_chunk_length (int) – The length of the target series the model takes as input.

  • output_chunk_length (int) – The length of the target series the model emits in output.

  • output_chunk_shift (int) – Optionally, the number of steps to shift the start of the output chunk into the future.

  • use_static_covariates (bool) – Whether to use/include static covariate data from input series.

class darts.utils.data.inference_dataset.PastCovariatesInferenceDataset(target_series, covariates=None, n=1, stride=0, bounds=None, input_chunk_length=12, output_chunk_length=1, output_chunk_shift=0, covariate_type=CovariateType.PAST, use_static_covariates=True)[source]

Bases: InferenceDataset

Contains (past_target, past_covariates, future_past_covariates, static_covariates).

“future_past_covariates” are past covariates that happen to be also known in the future - those are needed for forecasting with n > output_chunk_length by any model relying on past covariates.

For this reason, when n > output_chunk_length, this dataset will also emit the “future past_covariates”.

Parameters
  • target_series (Union[TimeSeries, Sequence[TimeSeries]]) – The target series that are to be predicted into the future.

  • covariates (Union[TimeSeries, Sequence[TimeSeries], None]) – Optionally, some past-observed covariates that are used for predictions. This argument is required if the model was trained with past-observed covariates.

  • n (int) – Forecast horizon: The number of time steps to predict after the end of the target series.

  • stride (int) – Optionally, the number of time steps between two consecutive predictions. Can only be used together with bounds.

  • bounds (Optional[ndarray]) – Optionally, an array of shape (n series, 2), with the left and right prediction start point boundaries per series. The boundaries must represent the positional index of the series (0, len(series)). If provided, stride must be >=1.

  • input_chunk_length (int) – The length of the target series the model takes as input.

  • output_chunk_length (int) – The length of the target series the model emits in output.

  • output_chunk_shift (int) – Optionally, the number of steps to shift the start of the output chunk into the future.

  • use_static_covariates (bool) – Whether to use/include static covariate data from input series.

class darts.utils.data.inference_dataset.SplitCovariatesInferenceDataset(target_series, past_covariates=None, future_covariates=None, n=1, stride=0, bounds=None, input_chunk_length=12, output_chunk_length=1, output_chunk_shift=0, use_static_covariates=True)[source]

Bases: InferenceDataset

Contains (past_target, past_covariates, future_covariates, future_past_covariates, static_covariates) tuples. “future_past_covariates” are past covariates that happen to be also known in the future - those are needed for forecasting with n > output_chunk_length by any model relying on past covariates.

Parameters
  • target_series (Union[TimeSeries, Sequence[TimeSeries]]) – The target series that are to be predicted into the future.

  • past_covariates (Union[TimeSeries, Sequence[TimeSeries], None]) – Optionally, some past-observed covariates that are used for predictions. This argument is required if the model was trained with past-observed covariates.

  • future_covariates (Union[TimeSeries, Sequence[TimeSeries], None]) – Optionally, some future-known covariates that are used for predictions. This argument is required if the model was trained with future-known covariates.

  • n (int) – Forecast horizon: The number of time steps to predict after the end of the target series.

  • stride (int) – Optionally, the number of time steps between two consecutive predictions. Can only be used together with bounds.

  • bounds (Optional[ndarray]) – Optionally, an array of shape (n series, 2), with the left and right prediction start point boundaries per series. The boundaries must represent the positional index of the series (0, len(series)). If provided, stride must be >=1.

  • input_chunk_length (int) – The length of the target series the model takes as input.

  • output_chunk_length (int) – The length of the target series the model emits in output.

  • output_chunk_shift (int) – Optionally, the number of steps to shift the start of the output chunk into the future.

  • use_static_covariates (bool) – Whether to use/include static covariate data from input series.