Table Of Contents
Table Of Contents

gluonts.distribution.mixture module

class gluonts.distribution.mixture.MixtureArgs(distr_outputs: List[gluonts.distribution.distribution_output.DistributionOutput], prefix: Optional[str] = None)[source]

Bases: mxnet.gluon.block.HybridBlock

hybrid_forward(F, x: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol]) → Tuple[Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], ...][source]

Overrides to construct symbolic graph for this Block.

  • x (Symbol or NDArray) – The first input tensor.
  • *args (list of Symbol or list of NDArray) – Additional input tensors.
class gluonts.distribution.mixture.MixtureDistribution(mixture_probs: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol], components: List[gluonts.distribution.distribution.Distribution], F=None)[source]

Bases: gluonts.distribution.distribution.Distribution

A mixture distribution where each component is a Distribution.

  • mixture_probs – A tensor of mixing probabilities. The entries should all be positive and sum to 1 across the last dimension. Shape: (…, k), where k is the number of distributions to be mixed. All axis except the last one should either coincide with the ones from the component distributions, or be 1 (in which case, the mixing coefficient is shared across the axis).
  • components – A list of k Distribution objects representing the mixture components. Distributions can be of different types. Each component’s support should be made of tensors of shape (…, d).
  • F – A module that can either refer to the Symbol API or the NDArray API in MXNet

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]

Returns the value of the cumulative distribution function evaluated at x


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.


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 = False
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

Tensor containing the mean of the distribution.

sample(num_samples: Optional[int] = None, dtype=<class 'numpy.float32'>) → Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol][source]

Draw samples from the distribution.

If num_samples is given the first dimension of the output will be num_samples.

  • num_samples – Number of samples to to be drawn.
  • dtype – Data-type of the samples.

A tensor containing samples. This has shape (*batch_shape, *eval_shape) if num_samples = None and (num_samples, *batch_shape, *eval_shape) otherwise.

Return type:



Tensor containing the standard deviation of the distribution.

class gluonts.distribution.mixture.MixtureDistributionOutput(distr_outputs: List[gluonts.distribution.distribution_output.DistributionOutput])[source]

Bases: gluonts.distribution.distribution_output.DistributionOutput

distribution(distr_args, scale: Union[mxnet.ndarray.ndarray.NDArray, mxnet.symbol.symbol.Symbol, None] = None, **kwargs) → gluonts.distribution.mixture.MixtureDistribution[source]

Construct the associated distribution, given the collection of constructor arguments and, optionally, a scale tensor.

  • distr_args – Constructor arguments for the underlying Distribution type.
  • scale – Optional tensor, of the same shape as the batch_shape+event_shape of the resulting distribution.

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

get_args_proj(prefix: Optional[str] = None) → gluonts.distribution.mixture.MixtureArgs[source]