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
(F, variables, targets=None)¶ Computes the logarithm of the probability density/mass function (PDF/PMF) of the distribution. The inputs and outputs variables are fetched from the variables argument according to their UUIDs.
Parameters: - F (mxnet.symbol or mxnet.ndarray) – the MXNet computation mode
- variables – the set of MXNet arrays that holds the values of
variables at runtime. :type variables: {str(UUID): MXNet NDArray or MXNet Symbol} :returns: log pdf of the distribution :rtypes: MXNet NDArray or MXNet Symbol
-
draw_samples
(F, variables, num_samples=1, always_return_tuple=False, targets=None)¶ Draw a set of samples from the distribution. The inputs variables are fetched from the variables argument according to their UUIDs.
Parameters: - F (mxnet.symbol or mxnet.ndarray) – the MXNet computation mode
- variables – the set of MXNet arrays that holds the values of
variables at runtime. :type variables: {str(UUID): MXNet NDArray or MXNet Symbol} :param num_samples: the number of drawn samples (default: one) :int num_samples: int :param always_return_tuple: Whether return a tuple even if there is only one variables in outputs. :type always_return_tuple: boolean :returns: a set samples of the distribution :rtypes: MXNet NDArray or MXNet Symbol or [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: - 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
(F, variables, targets=None)¶ Computes the logarithm of the probability density/mass function (PDF/PMF) of the distribution. The inputs and outputs variables are fetched from the variables argument according to their UUIDs.
Parameters: - F (mxnet.symbol or mxnet.ndarray) – the MXNet computation mode
- variables – the set of MXNet arrays that holds the values of
variables at runtime. :type variables: {str(UUID): MXNet NDArray or MXNet Symbol} :returns: log pdf of the distribution :rtypes: MXNet NDArray or MXNet Symbol
-
draw_samples
(F, variables, num_samples=1, always_return_tuple=False, targets=None)¶ Draw a set of samples from the distribution. The inputs variables are fetched from the variables argument according to their UUIDs.
Parameters: - F (mxnet.symbol or mxnet.ndarray) – the MXNet computation mode
- variables – the set of MXNet arrays that holds the values of
variables at runtime. :type variables: {str(UUID): MXNet NDArray or MXNet Symbol} :param num_samples: the number of drawn samples (default: one) :int num_samples: int :param always_return_tuple: Whether return a tuple even if there is only one variables in outputs. :type always_return_tuple: boolean :returns: a set samples of the distribution :rtypes: MXNet NDArray or MXNet Symbol or [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