gluonts.mx.distribution.laplace module#

class gluonts.mx.distribution.laplace.Laplace(mu: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], b: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol])[source]#

Bases: gluonts.mx.distribution.distribution.Distribution

Laplace distribution.

Parameters
  • mu – Tensor containing the means, of shape (*batch_shape, *event_shape).

  • b – Tensor containing the distribution scale, of shape (*batch_shape, *event_shape).

  • F

property F#
arg_names: Tuple#
property args: List#
property batch_shape: Tuple#

Layout of the set of events contemplated by the distribution.

Invoking sample() from a distribution yields a tensor of shape batch_shape + event_shape, and computing log_prob (or loss more in general) on such sample will yield a tensor of shape batch_shape.

This property is available in general only in mx.ndarray mode, when the shape of the distribution arguments can be accessed.

cdf(x: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]#

Return the value of the cumulative distribution function evaluated at x

property event_dim: int#

Number of event dimensions, i.e., length of the event_shape tuple.

This is 0 for distributions over scalars, 1 over vectors, 2 over matrices, and so on.

property event_shape: Tuple#

Shape of each individual event contemplated by the distribution.

For example, distributions over scalars have event_shape = (), over vectors have event_shape = (d, ) where d is the length of the vectors, over matrices have event_shape = (d1, d2), and so on.

Invoking sample() from a distribution yields a tensor of shape batch_shape + event_shape.

This property is available in general only in mx.ndarray mode, when the shape of the distribution arguments can be accessed.

is_reparameterizable = True#
log_prob(x: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]#

Compute the log-density of the distribution at x.

Parameters

x – Tensor of shape (*batch_shape, *event_shape).

Returns

Tensor of shape batch_shape containing the log-density of the distribution for each event in x.

Return type

Tensor

property mean: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]#

Tensor containing the mean of the distribution.

quantile(level: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]#

Calculates quantiles for the given levels.

Parameters

level – Level values to use for computing the quantiles. level should be a 1d tensor of level values between 0 and 1.

Returns

Quantile values corresponding to the levels passed. The return shape is

(num_levels, …DISTRIBUTION_SHAPE…),

where DISTRIBUTION_SHAPE is the shape of the underlying distribution.

Return type

quantiles

sample_rep(num_samples=None, dtype=<class 'numpy.float32'>) Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]#
property stddev: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]#

Tensor containing the standard deviation of the distribution.

class gluonts.mx.distribution.laplace.LaplaceFixedVarianceOutput[source]#

Bases: gluonts.mx.distribution.laplace.LaplaceOutput

classmethod domain_map(F, mu, b)[source]#

Converts arguments to the right shape and domain. The domain depends on the type of distribution, while the correct shape is obtained by reshaping the trailing axis in such a way that the returned tensors define a distribution of the right event_shape.

class gluonts.mx.distribution.laplace.LaplaceOutput[source]#

Bases: gluonts.mx.distribution.distribution_output.DistributionOutput

args_dim: Dict[str, int] = {'b': 1, 'mu': 1}#
distr_cls#

alias of gluonts.mx.distribution.laplace.Laplace

classmethod domain_map(F, mu, b)[source]#

Converts arguments to the right shape and domain. The domain depends on the type of distribution, while the correct shape is obtained by reshaping the trailing axis in such a way that the returned tensors define a distribution of the right event_shape.

property event_shape: Tuple#

Shape of each individual event contemplated by the distributions that this object constructs.