mxfusion.components.distributions.dirichlet

Members

class mxfusion.components.distributions.dirichlet.Dirichlet(alpha, normalization=True, rand_gen=None, dtype=None, ctx=None)

Bases: mxfusion.components.distributions.distribution.Distribution

The Dirichlet distribution.

Parameters:
  • a (Variable) – alpha, the concentration parameters of the distribution.
  • normalization (boolean) – If true, L1 normalization is applied.
  • rand_gen (RandomGenerator) – the random generator (default: MXNetRandomGenerator).
  • dtype (numpy.float32 or numpy.float64) – the data type for float point numbers.
  • ctx (None or mxnet.cpu or mxnet.gpu) – the mxnet context (default: None/current context).
log_pdf_impl(alpha, random_variable, F=None)

Computes the logarithm of the probability density function (pdf) of the Dirichlet distribution.

Parameters:
  • a (MXNet NDArray or MXNet Symbol) – the a parameter (alpha) of the Dirichlet distribution.
  • random_variable (MXNet NDArray or MXNet Symbol) – the random variable of the Dirichlet distribution.
  • F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
Returns:

log pdf of the distribution.

Rtypes:

MXNet NDArray or MXNet Symbol

draw_samples_impl(alpha, rv_shape, num_samples=1, F=None)

Draw samples from the Dirichlet distribution.

Parameters:
  • a (MXNet NDArray or MXNet Symbol) – the a parameter (alpha) of the Dirichlet distribution.
  • rv_shape (tuple) – the shape of each sample (this variable is not used because the shape of the random var is given by the shape of a)
  • num_samples (int) – the number of drawn samples (default: one).
  • F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
Returns:

a set samples of the Dirichlet distribution.

Rtypes:

MXNet NDArray or MXNet Symbol

static define_variable(alpha, shape=None, normalization=True, rand_gen=None, dtype=None, ctx=None)

Creates and returns a random variable drawn from a Dirichlet distribution.

Parameters:
  • a (Variable) – alpha, the concentration parameters of the distribution.
  • normalization (boolean) – If true, L1 normalization is applied.
  • rand_gen (RandomGenerator) – the random generator (default: MXNetRandomGenerator).
  • dtype (numpy.float32 or numpy.float64) – the data type for float point numbers.
  • ctx (None or mxnet.cpu or mxnet.gpu) – the mxnet context (default: None/current context).
Returns:

the random variables drawn from the Dirichlet distribution.

Rtypes:

Variable

replicate_self(attribute_map=None)

This functions as a copy constructor for the object. In order to do a copy constructor we first call __new__ on the class which creates a blank object. We then initialize that object using the methods standard init procedures, and do any extra copying of attributes.

Replicates this Factor, using new inputs, outputs, and a new uuid. Used during model replication to functionally replicate a factor into a new graph.

Parameters:
  • inputs (List of tuples of name to node e.g. [('random_variable': Variable y)] or None) – new input variables of the factor.
  • outputs (List of tuples of name to node e.g. [('random_variable': Variable y)] or None) – new output variables of the factor.