4

When creating training or test data in gluon-ts we can specify an additional real-valued regressor in the DeepAREstimator by specifying a feat_dynamic_real. Is there support for multiple real-valued regressors?

There is a one_dim_target flag in gluonts.dataset.common.ListDataset which is used to create the training/test data objects. This seems like it could be needed to support multiple additional regressors, however I couldn't find a good example on the intended usage.

Here is the set up for creating training data with one additional regressor:

training_data = ListDataset(
    [{"start": df.index[0], "target": df.values, "feat_dynamic_real": df['randomColumn'].values}],
    freq = "5min", one_dim_target=False
)

and the Estimator:

from gluonts.model.deepar import DeepAREstimator
from gluonts.trainer import Trainer

estimator = DeepAREstimator(freq="5min", prediction_length=12, trainer=Trainer(epochs=10))
predictor = estimator.train(training_data=training_data)

I'm looking for the syntax/configuration needed for multiple regressors.

watsaqat
  • 41
  • 3

1 Answers1

5

Yes, there is support for that. First of, Gluon TS refers to regressors as features and the signal that we are trying to predict as target. Thus, the one_dim_target flag you mention is related to the dimension of the ouput and not the input.

Below is the code I use to associate a multi-dimensional feature (input) to each target signal (I use a one-dimensional target)

train_ds = ListDataset([{FieldName.TARGET: target,
                     FieldName.START: start,
                     FieldName.FEAT_DYNAMIC_REAL: fdr}
                    for (target, start, fdr) in zip(
target,
custom_ds_metadata['start'],
feat_dynamic_real)]

In the zip-function above,

  1. target: Is a 1-dimensional numpy array containing the target signal, i.e., the shape of target is (1,#of time steps)
  2. custom_ds_metadata['start'] : Is a pandas date variable indicating the beginning of the data
  3. feat_dynamic_real: Is a 2-dimensional numpy array containing two feature signals, i.e., feat_dynamic_real has shape (#of features, #number of time steps)
Markus Eriksson
  • 111
  • 2
  • 6