Table Of Contents
Table Of Contents

gluonts.block.quantile_output module

class gluonts.block.quantile_output.ProjectParams(num_quantiles, **kwargs)[source]

Bases: mxnet.gluon.block.HybridBlock

Defines a dense layer to compute the projection weights into the quantile space.

Parameters:num_quantiles – number of quantiles to compute the projection.
hybrid_forward(F, x: 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], 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.
  • x – input tensor
Returns:

output of the projection layer

Return type:

Tensor

class gluonts.block.quantile_output.QuantileLoss(quantiles: List[float], quantile_weights: List[float] = None, weight=None, batch_axis=0, **kwargs)[source]

Bases: mxnet.gluon.loss.Loss

static compute_quantile_loss(F, y_true: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], y_pred_p: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], p: float) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]

Compute the quantile loss of the given quantile

Parameters:
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
  • y_true – true target, shape (N1 x N2 x … x Nk x dimension of time series (normally 1)).
  • y_pred_p – predicted target quantile, shape (N1 x N2 x … x Nk x 1).
  • p – quantile error to compute the loss.
Returns:

quantile loss, shape: (N1 x N2 x … x Nk x 1)

Return type:

Tensor

hybrid_forward(F, y_true: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], y_pred: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], sample_weight=None)[source]

Compute the weighted sum of quantile losses.

Parameters:
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet.
  • y_true – true target, shape (N1 x N2 x … x Nk x dimension of time series (normally 1))
  • y_pred – predicted target, shape (N1 x N2 x … x Nk x num_quantiles)
  • sample_weight – sample weights
Returns:

weighted sum of the quantile losses, shape N1 x N1 x … Nk

Return type:

Tensor

class gluonts.block.quantile_output.QuantileOutput(quantiles: List[float], quantile_weights: Optional[List[float]] = None)[source]

Bases: object

Output layer using a quantile loss and projection layer to connect the quantile output to the network.

Parameters:
  • quantiles – list of quantiles to compute loss over.
  • quantile_weights – weights of the quantiles.
get_loss() → mxnet.gluon.block.HybridBlock[source]
Returns:constructs quantile loss object.
Return type:nn.HybridBlock
get_quantile_proj(**kwargs) → mxnet.gluon.block.HybridBlock[source]
Returns:constructs projection parameter object.
Return type:nn.HybridBlock