Table Of Contents
Table Of Contents

gluonts.distribution.multivariate_gaussian module

class gluonts.distribution.multivariate_gaussian.MultivariateGaussian(mu: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], L: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], F=None, float_type: gluonts.core.component.DType = <class 'numpy.float32'>)[source]

Bases: gluonts.distribution.distribution.Distribution

Multivariate Gaussian distribution, specified by the mean vector and the Cholesky factor of its covariance matrix.

Parameters:
  • mu – mean vector, of shape (…, d)
  • L – Lower triangular Cholesky factor of covariance matrix, of shape (…, d, d)
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet
batch_shape

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.

event_dim

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.

event_shape

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
mean

Tensor containing the mean of the distribution.

sample_rep(num_samples: Optional[int] = None) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]

Draw samples from the multivariate Gaussian distributions. Internally, Cholesky factorization of the covariance matrix is used:

sample = L v + mu,

where L is the Cholesky factor, v is a standard normal sample.

Parameters:num_samples – Number of samples to be drawn.
Returns:Tensor with shape (num_samples, …, d).
Return type:Tensor
variance

Tensor containing the variance of the distribution.

class gluonts.distribution.multivariate_gaussian.MultivariateGaussianOutput(dim: int)[source]

Bases: gluonts.distribution.distribution_output.DistributionOutput

domain_map(F, mu_vector, L_vector)[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.

event_shape

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