mxfusion.components.distributions.wishart

Members

class mxfusion.components.distributions.wishart.Wishart(degrees_of_freedom, scale, rand_gen=None, dtype=None, ctx=None)

Bases: mxfusion.components.distributions.distribution.Distribution

The Wishart distribution.

Parameters:
  • degrees_of_freedom (Variable) – Degrees of freedom of the Wishart distribution.
  • scale (Variable) – Scale matrix of 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_impl(degrees_of_freedom, scale, random_variable, F=None)

Computes the logarithm of the probability density function (PDF) of the Wishart distribution.

Parameters:
  • degrees_of_freedom (MXNet NDArray or MXNet Symbol) – the degrees of freedom of the Wishart distribution.
  • scale (MXNet NDArray or MXNet Symbol) – the scale of the distribution.
  • random_variable (MXNet NDArray or MXNet Symbol) – the random variable of the Wishart 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(degrees_of_freedom, scale, rv_shape, num_samples=1, F=None)

Draw a number of samples from the Wishart distribution.

The Bartlett decomposition of a matrix X from a p-variate Wishart distribution with scale matrix V and n degrees of freedom is the factorization: X = LAA’L’ where L is the Cholesky factor of V and A is lower triangular, with diagonal elements drawn from a chi squared (n-i+1) distribution where i is the (1-based) diagonal index and the off-diagonal elements are independent N(0, 1)

Parameters:
  • degrees_of_freedom (MXNet NDArray or MXNet Symbol) – the degrees of freedom of the Wishart distribution.
  • scale (MXNet NDArray or MXNet Symbol) – the scale of the Wishart distributions.
  • rv_shape (tuple) – the shape of each sample.
  • 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 Wishart distribution

Rtypes:

MXNet NDArray or MXNet Symbol

static define_variable(shape, degrees_of_freedom=0, scale=None, rand_gen=None, minibatch_ratio=1.0, dtype=None, ctx=None)

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

Parameters:
  • degrees_of_freedom – Degrees of freedom of the distribution.
  • scale – Scale matrix of the distribution.
  • 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).
Returns:

the random variables drawn from the Wishart distribution.

Rtypes:

Variable