Table Of Contents
Table Of Contents

gluonts.block.encoder module

class gluonts.block.encoder.HierarchicalCausalConv1DEncoder(dilation_seq: List[int], kernel_size_seq: List[int], channels_seq: List[int], use_residual: bool = False, use_covariates: bool = False, **kwargs)[source]

Bases: gluonts.block.encoder.Seq2SeqEncoder

Defines a stack of dilated convolutions as the encoder.

See the following paper for details: 1. Van Den Oord, A., Dieleman, S., Zen, H., Simonyan, K., Vinyals, O., Graves, A., Kalchbrenner, N., Senior, A.W. and Kavukcuoglu, K., 2016, September. WaveNet: A generative model for raw audio. In SSW (p. 125).

Parameters:
  • dilation_seq – dilation for each convolution in the stack.
  • kernel_size_seq – kernel size for each convolution in the stack.
  • channels_seq – number of channels for each convolution in the stack.
  • use_residual – flag to toggle using residual connections.
  • use_covariates – flag to toggle whether to use coveriates as input to the encoder
hybrid_forward(F, target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], static_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], dynamic_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]][source]
Parameters:
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
  • target – target time series, shape (batch_size, sequence_length)
  • static_features – static features, shape (batch_size, num_static_features)
  • dynamic_features – dynamic_features, shape (batch_size, sequence_length, num_dynamic_features)
Returns:

  • Tensor – static code, shape (batch_size, num_static_features)
  • Tensor – dynamic code, shape (batch_size, sequence_length, num_dynamic_features)

class gluonts.block.encoder.MLPEncoder(layer_sizes: List[int], **kwargs)[source]

Bases: gluonts.block.encoder.Seq2SeqEncoder

Defines a multilayer perceptron used as an encoder.

Parameters:
  • layer_sizes – number of hidden units per layer.
  • kwargs
hybrid_forward(F, target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], static_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], dynamic_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]][source]
Parameters:
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
  • target – target time series, shape (batch_size, sequence_length)
  • static_features – static features, shape (batch_size, num_static_features)
  • dynamic_features – dynamic_features, shape (batch_size, sequence_length, num_dynamic_features)
Returns:

  • Tensor – static code, shape (batch_size, num_static_features)
  • Tensor – dynamic code, shape (batch_size, sequence_length, num_dynamic_features)

class gluonts.block.encoder.RNNCovariateEncoder(mode: str, hidden_size: int, num_layers: int, bidirectional: bool, **kwargs)[source]

Bases: gluonts.block.encoder.Seq2SeqEncoder

Defines RNN encoder that uses covariates and target as input to the RNN.

Parameters:
  • mode – type of the RNN. Can be either: rnn_relu (RNN with relu activation), rnn_tanh, (RNN with tanh activation), lstm or gru.
  • hidden_size – number of units per hidden layer.
  • num_layers – number of hidden layers.
  • bidirectional – toggle use of bi-directional RNN as encoder.
hybrid_forward(F, target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], static_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], dynamic_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]][source]
Parameters:
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
  • target – target time series, shape (batch_size, sequence_length)
  • static_features – static features, shape (batch_size, num_static_features)
  • dynamic_features – dynamic_features, shape (batch_size, sequence_length, num_dynamic_features)
Returns:

  • Tensor – static code, shape (batch_size, num_static_features)
  • Tensor – dynamic code, shape (batch_size, sequence_length, num_dynamic_features)

class gluonts.block.encoder.RNNEncoder(mode: str, hidden_size: int, num_layers: int, bidirectional: bool, **kwargs)[source]

Bases: gluonts.block.encoder.Seq2SeqEncoder

Defines an RNN as the encoder.

Parameters:
  • mode – type of the RNN. Can be either: rnn_relu (RNN with relu activation), rnn_tanh, (RNN with tanh activation), lstm or gru.
  • hidden_size – number of units per hidden layer.
  • num_layers – number of hidden layers.
  • bidirectional – toggle use of bi-directional RNN as encoder.
hybrid_forward(F, target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], static_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], dynamic_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]][source]
Parameters:
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
  • target – target time series, shape (batch_size, sequence_length)
  • static_features – static features, shape (batch_size, num_static_features)
  • dynamic_features – dynamic_features, shape (batch_size, sequence_length, num_dynamic_features)
Returns:

  • Tensor – static code, shape (batch_size, num_static_features)
  • Tensor – dynamic code, shape (batch_size, sequence_length, num_dynamic_features)

class gluonts.block.encoder.Seq2SeqEncoder(**kwargs)[source]

Bases: mxnet.gluon.block.HybridBlock

Abstract class for the encoder. An encoder takes a target sequence with corresponding covariates and maps it into a static latent and a dynamic latent code with the same length as the target sequence.

hybrid_forward(F, target: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], static_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], dynamic_features: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]][source]
Parameters:
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
  • target – target time series, shape (batch_size, sequence_length)
  • static_features – static features, shape (batch_size, num_static_features)
  • dynamic_features – dynamic_features, shape (batch_size, sequence_length, num_dynamic_features)
Returns:

  • Tensor – static code, shape (batch_size, num_static_features)
  • Tensor – dynamic code, shape (batch_size, sequence_length, num_dynamic_features)