class_docstr: Constructs a DeepVAR estimator, which is a multivariate variant of DeepAR.
  
  These models have been described as VEC-LSTM in this paper:
  https://arxiv.org/abs/1910.03002
  
  Note that this implementation will change over time and we further work on
  this method. To replicate the results of the paper, please refer to our
  (frozen) implementation here:
  https://github.com/mbohlkeschneider/gluon-ts/tree/mv_release
  
  
  Parameters
  ----------
  freq
      Frequency of the data to train on and predict
  prediction_length
      Length of the prediction horizon
  target_dim
      Dimensionality of the input dataset
  trainer
      Trainer object to be used (default: Trainer())
  context_length
      Number of steps to unroll the RNN for before computing predictions
      (default: None, in which case context_length = prediction_length)
  num_layers
      Number of RNN layers (default: 2)
  num_cells
      Number of RNN cells for each layer (default: 40)
  cell_type
      Type of recurrent cells to use (available: 'lstm' or 'gru';
      default: 'lstm')
  num_parallel_samples
      Number of evaluation samples per time series to increase parallelism
      during inference. This is a model optimization that does not affect
      the accuracy (default: 100)
  dropout_rate
      Dropout regularization parameter (default: 0.1)
  use_feat_dynamic_real
      Whether to use the ``feat_dynamic_real`` field from the data
      (default: False)
  cardinality
      Number of values of each categorical feature (default: [1])
  embedding_dimension
      Dimension of the embeddings for categorical features
      (default: 5])
  distr_output
      Distribution to use to evaluate observations and sample predictions
      (default: LowrankMultivariateGaussianOutput with dim=target_dim and
      rank=5). Note that target dim of the DistributionOutput and the
      estimator constructor call need to match. Also note that the rank in
      this constructor is meaningless if the DistributionOutput is
      constructed outside of this class.
  rank
      Rank for the LowrankMultivariateGaussianOutput. (default: 5)
  scaling
      Whether to automatically scale the target values (default: true)
  pick_incomplete
      Whether training examples can be sampled with only a part of
      past_length time-units
  lags_seq
      Indices of the lagged target values to use as inputs of the RNN
      (default: None, in which case these are automatically determined
      based on freq)
  time_features
      Time features to use as inputs of the RNN (default: None, in which
      case these are automatically determined based on freq)
  conditioning_length
      Set maximum length for conditioning the marginal transformation
  use_marginal_transformation
      Whether marginal (empirical cdf, gaussian ppf) transformation is used.
  train_sampler
      Controls the sampling of windows during training.
  validation_sampler
      Controls the sampling of windows during validation.
  batch_size
      The size of the batches to be used training and prediction.
class_docstr_tok: ["Constructs","a","DeepVAR","estimator",",","which","is","a","multivariate","variant","of","DeepAR",".","These","models","have","been","described","as","VEC-LSTM","in","this","paper",":","https",":","\/\/arxiv.org\/abs\/1910.03002","Note","that","this","implementation","will","change","over","time","and","we","further","work","on","this","method",".","To","replicate","the","results","of","the","paper",",","please","refer","to","our","(","frozen",")","implementation","here",":","https",":","\/\/github.com\/mbohlkeschneider\/gluon-ts\/tree\/mv_release","Parameters","--","--","--","--","--","freq","Frequency","of","the","data","to","train","on","and","predict","prediction_length","Length","of","the","prediction","horizon","target_dim","Dimensionality","of","the","input","dataset","trainer","Trainer","object","to","be","used","(","default",":","Trainer","(",")",")","context_length","Number","of","steps","to","unroll","the","RNN","for","before","computing","predictions","(","default",":","None",",","in","which","case","context_length","=","prediction_length",")","num_layers","Number","of","RNN","layers","(","default",":","2",")","num_cells","Number","of","RNN","cells","for","each","layer","(","default",":","40",")","cell_type","Type","of","recurrent","cells","to","use","(","available",":","'lstm","'","or","'gru","'",";","default",":","'lstm","'",")","num_parallel_samples","Number","of","evaluation","samples","per","time","series","to","increase","parallelism","during","inference",".","This","is","a","model","optimization","that","does","not","affect","the","accuracy","(","default",":","100",")","dropout_rate","Dropout","regularization","parameter","(","default",":","0.1",")","use_feat_dynamic_real","Whether","to","use","the","``","feat_dynamic_real","``","field","from","the","data","(","default",":","False",")","cardinality","Number","of","values","of","each","categorical","feature","(","default",":","[","1","]",")","embedding_dimension","Dimension","of","the","embeddings","for","categorical","features","(","default",":","5","]",")","distr_output","Distribution","to","use","to","evaluate","observations","and","sample","predictions","(","default",":","LowrankMultivariateGaussianOutput","with","dim=target_dim","and","rank=5",")",".","Note","that","target","dim","of","the","DistributionOutput","and","the","estimator","constructor","call","need","to","match",".","Also","note","that","the","rank","in","this","constructor","is","meaningless","if","the","DistributionOutput","is","constructed","outside","of","this","class",".","rank","Rank","for","the","LowrankMultivariateGaussianOutput",".","(","default",":","5",")","scaling","Whether","to","automatically","scale","the","target","values","(","default",":","true",")","pick_incomplete","Whether","training","examples","can","be","sampled","with","only","a","part","of","past_length","time-units","lags_seq","Indices","of","the","lagged","target","values","to","use","as","inputs","of","the","RNN","(","default",":","None",",","in","which","case","these","are","automatically","determined","based","on","freq",")","time_features","Time","features","to","use","as","inputs","of","the","RNN","(","default",":","None",",","in","which","case","these","are","automatically","determined","based","on","freq",")","conditioning_length","Set","maximum","length","for","conditioning","the","marginal","transformation","use_marginal_transformation","Whether","marginal","(","empirical","cdf",",","gaussian","ppf",")","transformation","is","used",".","train_sampler","Controls","the","sampling","of","windows","during","training",".","validation_sampler","Controls","the","sampling","of","windows","during","validation",".","batch_size","The","size","of","the","batches","to","be","used","training","and","prediction","."]
code: def create_transformation(self) -> Transformation:
      return Chain(
          [
              AsNumpyArray(
                  field=FieldName.TARGET,
                  expected_ndim=1 + len(self.distr_output.event_shape),
              ),
              # maps the target to (1, T)
              # if the target data is uni dimensional
              ExpandDimArray(
                  field=FieldName.TARGET,
                  axis=0
                  if self.distr_output.event_shape[0] == 1
                  else None,
              ),
              AddObservedValuesIndicator(
                  target_field=FieldName.TARGET,
                  output_field=FieldName.OBSERVED_VALUES,
              ),
              AddTimeFeatures(
                  start_field=FieldName.START,
                  target_field=FieldName.TARGET,
                  output_field=FieldName.FEAT_TIME,
                  time_features=self.time_features,
                  pred_length=self.prediction_length,
              ),
              VstackFeatures(
                  output_field=FieldName.FEAT_TIME,
                  input_fields=[FieldName.FEAT_TIME]
                  + (
                      [FieldName.FEAT_DYNAMIC_REAL]
                      if self.use_feat_dynamic_real
                      else []
                  ),
              ),
              SetFieldIfNotPresent(
                  field=FieldName.FEAT_STATIC_CAT, value=[0.0]
              ),
              TargetDimIndicator(
                  field_name="target_dimension_indicator",
                  target_field=FieldName.TARGET,
              ),
              AsNumpyArray(
                  field=FieldName.FEAT_STATIC_CAT, expected_ndim=1
              ),
          ]
      )
  
imports: from functools import partial
  from typing import Callable, List, Optional
  import numpy
  import pandas
  from mxnet.gluon import HybridBlock
  from pandas.tseries.frequencies import to_offset
  from gluonts.core.component import validated
  from gluonts.dataset.common import Dataset
  from gluonts.dataset.field_names import FieldName
  from gluonts.dataset.loader import DataLoader, TrainDataLoader, ValidationDataLoader
  from gluonts.model.predictor import Predictor
  from gluonts.mx.batchify import batchify
  from gluonts.mx.distribution import DistributionOutput, LowrankMultivariateGaussianOutput
  from gluonts.mx.model.estimator import GluonEstimator
  from gluonts.mx.model.predictor import RepresentableBlockPredictor
  from gluonts.mx.trainer import Trainer
  from gluonts.mx.util import copy_parameters, get_hybrid_forward_input_names
  from gluonts.time_feature import TimeFeature, norm_freq_str
  from gluonts.transform import AddObservedValuesIndicator, AddTimeFeatures, AsNumpyArray, CDFtoGaussianTransform, Chain, ExpandDimArray, ExpectedNumInstanceSampler, InstanceSampler, InstanceSplitter, RenameFields, SelectFields, SetFieldIfNotPresent, TargetDimIndicator, TestSplitSampler, Transformation, ValidationSplitSampler, VstackFeatures, cdf_to_gaussian_forward_transform
  from ._network import DeepVARPredictionNetwork, DeepVARTrainingNetwork
label_desc: Use image node_id 2 for calling the DeepVAREstimator obj's underlying member method code with example usage: obj.create_transformation() and returns: Chain