gluonts.mx.representation.discrete_pit module

class gluonts.mx.representation.discrete_pit.DiscretePIT(num_bins: int, mlp_transf: bool = False, embedding_size: Optional[int] = None, *args, **kwargs)[source]

Bases: gluonts.mx.representation.representation.Representation

A class representing a discrete probability integral transform of a given quantile-based learned binning. Note that this representation is intended to be applied on top of a quantile-based binning representation.

Parameters
  • num_bins – Number of bins used by the data on which this representation is applied.

  • mlp_tranf – Whether we want to post-process the pit-transformed valued using a MLP which can learn an appropriate binning, which would ensure that pit models have the same expressiveness as standard quantile binning with embedding. (default: False)

  • embedding_size – The desired layer output size if mlp_tranf=True. By default, the following heuristic is used: https://developers.googleblog.com/2017/11/introducing-tensorflow-feature-columns.html (default: round(num_bins**(1/4)))

hybrid_forward(F, data: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], observed_indicator: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], scale: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol, None], rep_params: List[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]], **kwargs) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], List[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]]][source]

Transform the data into the desired representation.

Parameters
  • F

  • data – Target data.

  • observed_indicator – Target observed indicator.

  • scale – Pre-computed scale.

  • rep_params – Additional pre-computed representation parameters.

  • **kwargs, – Additional block-specfic parameters.

Returns

Tuple consisting of the transformed data, the computed scale, and additional parameters to be passed to post_transform.

Return type

Tuple[Tensor, Tensor, List[Tensor]]

post_transform(F, samples: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], scale: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], rep_params: List[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]]) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]

Transform samples back to the original representation.

Parameters
  • samples – Samples from a distribution.

  • scale – The scale of the samples.

  • rep_params – Additional representation-specific parameters used during post transformation.

Returns

Post-transformed samples.

Return type

Tensor