mxfusion.components.distributions.distribution

Members

class mxfusion.components.distributions.distribution.LogPDFDecorator

Bases: object

The decorator for the log_pdf function in Distribution

class mxfusion.components.distributions.distribution.DrawSamplesDecorator

Bases: object

The decorator for the draw_samples function in Distribution

class mxfusion.components.distributions.distribution.Distribution(inputs, outputs, input_names, output_names, rand_gen=None, dtype=None, ctx=None)

Bases: mxfusion.components.factor.Factor

The base class of a probability distribution associated with one or a set of random variables.

Parameters:
  • inputs ({name: Variable}) – the input variables that parameterize the probability distribution.
  • outputs ({name: Variable}) – the random variables drawn from the distribution.
  • 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).
replicate_self(attribute_map=None)

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 (a dict of {'name' : Variable} or None) – new input variables of the factor.
  • outputs (a dict of {'name' : Variable} or None) – new output variables of the factor.
log_pdf(F=None, **kwargs)

Computes the logarithm of the probability density/mass function (PDF/PMF) of the distribution.

Parameters:F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
Returns:log pdf of the distribution
Rtypes:MXNet NDArray or MXNet Symbol
log_cdf(F=None, **kwargs)

Computes the logarithm of the cumulative distribution function (CDF) of the distribution.

Parameters:F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
Returns:log cdf of the distribution.
Rtypes:MXNet NDArray or MXNet Symbol
draw_samples(rv_shape, num_samples=1, F=None, **kwargs)

Draw a number of samples from the distribution.

Parameters:
  • rv_shape (tuple, [tuple]) – the shape of each sample.
  • num_samples – the number of drawn samples (default: one).
  • F – the MXNet computation mode (mxnet.symbol or mxnet.ndarray).
Int num_samples:
 

int

Returns:

a set samples of the distribution.

Rtypes:

MXNet NDArray or MXNet Symbol or [MXNet NDArray or MXNet Symbol]

static define_variable(shape=None, rand_gen=None, dtype=None, ctx=None, **kwargs)

Define a random variable that follows from the specified distribution.

Parameters:
  • shape (tuple or [tuple]) – the shape of the random variable(s).
  • 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).
  • kwargs – the input variables that parameterize the probability

distribution. :type kwargs: {name: Variable} :returns: the random variables drawn from the distribution. :rtypes: Variable or [Variable]