mxfusion.components.distributions.gamma

Members

class mxfusion.components.distributions.gamma.Gamma(alpha, beta, rand_gen=None, dtype=None, ctx=None)

Bases: mxfusion.components.distributions.univariate.UnivariateDistribution

Gamma distribution parameterized using Alpha and Beta. Takes dependency on Scipy to compute the log-gamma function.

Parameters:
  • alpha (Variable) – the alpha parameter of the Gamma distribution.
  • beta (Variable) – beta parameter of the Gamma 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).
log_pdf_impl(alpha, beta, random_variable, F=None)

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

Parameters:
  • random_variable (MXNet NDArray or MXNet Symbol) – the random variable of the Gamma 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, beta, rv_shape, num_samples=1, F=None)

Draw samples from the Gamma distribution. :param rv_shape: the shape of each sample. :type rv_shape: tuple :param num_samples: the number of drawn samples (default: one). :type num_samples: int :param F: the MXNet computation mode (mxnet.symbol or mxnet.ndarray). :returns: a set samples of the Gamma distribution. :rtypes: MXNet NDArray or MXNet Symbol

static define_variable(alpha=0.0, beta=1.0, shape=None, rand_gen=None, dtype=None, ctx=None)

Creates and returns a random variable drawn from a Gamma distribution parameterized with a and b parameters.

Parameters:
  • alpha (float) – beta parameter of the Gamma random variable (also known as rate)
  • beta (float) – alpha parameter of the Gamma random variable (also known as shape)
  • 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 Gamma distribution.

Rtypes:

Variable

class mxfusion.components.distributions.gamma.GammaMeanVariance(mean, variance, rand_gen=None, dtype=None, ctx=None)

Bases: mxfusion.components.distributions.univariate.UnivariateDistribution

Gamma distribution parameterized using Mean and Variance. Takes dependency on Scipy to compute the log-gamma function.

Parameters:
  • mean (Variable) – the mean parameter of the Gamma distribution.
  • variance (Variable) – variance parameter of the Gamma 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).
log_pdf_impl(mean, variance, random_variable, F=None)

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

Parameters:
  • mean (float) – mean of the Gamma random variable (alpha / beta)
  • variance (float) – variance of the Gamma random variable (alpha / beta**2)
  • random_variable (MXNet NDArray or MXNet Symbol) – the random variable of the Gamma 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(mean, variance, rv_shape, num_samples=1, F=None)

Draw samples from the Gamma distribution. :param rv_shape: the shape of each sample. :type rv_shape: tuple :param num_samples: the number of drawn samples (default: one). :type num_samples: int :param F: the MXNet computation mode (mxnet.symbol or mxnet.ndarray). :returns: a set samples of the Gamma distribution. :rtypes: MXNet NDArray or MXNet Symbol

static define_variable(mean=0.0, variance=1.0, shape=None, rand_gen=None, dtype=None, ctx=None)

Creates and returns a random variable drawn from a Gamma distribution parameterized with mean and variance.

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).
Returns:

the random variables drawn from the Gamma distribution.

Rtypes:

Variable