Table Of Contents
Table Of Contents

gluonts.block.scaler module

class gluonts.block.scaler.MeanScaler(minimum_scale: float = 1e-10, *args, **kwargs)[source]

Bases: gluonts.block.scaler.Scaler

The MeanScaler computes a per-item scale according to the average absolute value over time of each item. The average is computed only among the observed values in the data tensor, as indicated by the second argument. Items with no observed data are assigned a scale based on the global average.

Parameters:minimum_scale – default scale that is used if the time series has only zeros.
compute_scale(F, data: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], observed_indicator: 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.
  • data – tensor of shape (N, T, C) containing the data to be scaled
  • observed_indicator – observed_indicator: binary tensor with the same shape as data, that has 1 in correspondence of observed data points, and 0 in correspondence of missing data points.
Returns:

shape (N, C), computed according to the average absolute value over time of the observed values.

Return type:

Tensor

class gluonts.block.scaler.NOPScaler(*args, **kwargs)[source]

Bases: gluonts.block.scaler.Scaler

The NOPScaler assigns a scale equals to 1 to each input item, i.e., no scaling is applied upon calling the NOPScaler.

compute_scale(F, data: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], observed_indicator: 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.
  • data – tensor of shape (N, T, C) containing the data to be scaled
  • observed_indicator – observed_indicator: binary tensor with the same shape as data, that has 1 in correspondence of observed data points, and 0 in correspondence of missing data points.
Returns:

shape (N, C), identically equal to 1.

Return type:

Tensor

class gluonts.block.scaler.Scaler(keepdims: bool = False)[source]

Bases: mxnet.gluon.block.HybridBlock

Base class for blocks used to scale data.

Parameters:keepdims – toggle to keep the dimension of the input tensor.
compute_scale(F, data: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], observed_indicator: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol])[source]

Computes the scale of the given input data.

Parameters:
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
  • data – tensor of shape (N, T, C) containing the data to be scaled
  • observed_indicator – observed_indicator: binary tensor with the same shape as data, that has 1 in correspondence of observed data points, and 0 in correspondence of missing data points.
hybrid_forward(F, data: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], observed_indicator: 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.
  • data – tensor of shape (N, T, C) containing the data to be scaled
  • observed_indicator – observed_indicator: binary tensor with the same shape as data, that has 1 in correspondence of observed data points, and 0 in correspondence of missing data points.
Returns:

  • Tensor – Tensor containing the “scaled” data, shape: (N, T, C).
  • Tensor – Tensor containing the scale, of shape (N, C) if keepdims == False, and shape (N, 1, C) if keepdims == True.