Table Of Contents
Table Of Contents

gluonts.dataset.multivariate_grouper module

class gluonts.dataset.multivariate_grouper.MultivariateGrouper(max_target_dim: Optional[int] = None, num_test_dates: Optional[int] = None, train_fill_rule: Callable = <function mean>, test_fill_rule: Callable = <function MultivariateGrouper.<lambda>>)[source]

Bases: object

The MultivariateGrouper takes a univariate dataset and groups it into a single multivariate time series. Therefore, this class allows the user to convert a univariate dataset into a multivariate dataset without making a separate copy of the dataset.

The Multivariate Grouper has two different modes:

Training: For training data, the univariate time series get aligned to the earliest time stamp in the dataset. Time series will be left and right padded to produce an array of shape (dim, num_time_steps)

Test: The test dataset might have multiple start dates (usually because
the test dataset mimics a rolling evaluation scenario). In this case, the univariate dataset will be split into n multivariate time series, where n is the number of evaluation dates. Again, the time series will be grouped but only left padded. Note that the padded value will influence the prediction if the context length is longer than the length of the time series.

Rules for padding for training and test datasets can be specified by the user.

  • max_target_dim – Set maximum dimensionality (for faster testing or when hitting constraints of multivariate model). Takes the last max_target_dim time series and groups them to multivariate time series.
  • num_test_dates – Number of test dates in the test set. This can be more than one if the test set contains more than one forecast start date (often the case in a rolling evaluation scenario). Must be set to convert test data.
  • train_fill_rule – Implements the rule that fills missing data after alignment of the time series for the training dataset.
  • test_fill_rule – Implements the rule that fills missing data after alignment of the time series for the test dataset.
static to_ts(data: Dict[str, Any]) → pandas.core.series.Series[source]