code: def make_dummy_datasets_with_features(
      num_ts: int = 5,
      start: str = "2018-01-01",
      freq: str = "D",
      min_length: int = 5,
      max_length: int = 10,
      prediction_length: int = 3,
      cardinality: List[int] = [],
      num_feat_dynamic_real: int = 0,
      num_past_feat_dynamic_real: int = 0,
  ) -> Tuple[Dataset, Dataset]:
      data_iter_train = []
      data_iter_test = []
  
      for k in range(num_ts):
          ts_length = randint(min_length, max_length)
          data_entry_train = {
              FieldName.START: start,
              FieldName.TARGET: [0.0] * ts_length,
          }
          if len(cardinality) > 0:
              data_entry_train[FieldName.FEAT_STATIC_CAT] = [
                  randint(0, c) for c in cardinality
              ]
          if num_past_feat_dynamic_real > 0:
              data_entry_train[FieldName.PAST_FEAT_DYNAMIC_REAL] = [
                  [float(1 + k)] * ts_length
                  for k in range(num_past_feat_dynamic_real)
              ]
          # Since used directly in predict and not in make_evaluate_predictions,
          # where the test target would be chopped, test and train target have
          # the same lengths
          data_entry_test = data_entry_train.copy()
          if num_feat_dynamic_real > 0:
              data_entry_train[FieldName.FEAT_DYNAMIC_REAL] = [
                  [float(1 + k)] * ts_length
                  for k in range(num_feat_dynamic_real)
              ]
              data_entry_test[FieldName.FEAT_DYNAMIC_REAL] = [
                  [float(1 + k)] * (ts_length + prediction_length)
                  for k in range(num_feat_dynamic_real)
              ]
          data_iter_train.append(data_entry_train)
          data_iter_test.append(data_entry_test)
  
      return (
          ListDataset(data_iter=data_iter_train, freq=freq),
          ListDataset(data_iter=data_iter_test, freq=freq),
      )
  
imports: from random import randint
  from typing import List, Tuple
  import numpy
  import pandas
  from gluonts.dataset.common import Dataset, ListDataset
  from gluonts.dataset.field_names import FieldName
label_desc: Use image node_id 1 for calling a global function with example usage: make_dummy_datasets_with_features(num_ts, start, freq, min_length, max_length, prediction_length, cardinality, num_feat_dynamic_real, num_past_feat_dynamic_real) and returns: ListDataset,  ListDataset