mxfusion.components.distributions.bernoulli¶
Members¶
-
class
mxfusion.components.distributions.bernoulli.
BernoulliLogPDFDecorator
¶ Bases:
mxfusion.components.distributions.distribution.LogPDFDecorator
-
class
mxfusion.components.distributions.bernoulli.
BernoulliDrawSamplesDecorator
¶ Bases:
mxfusion.components.distributions.distribution.DrawSamplesDecorator
-
class
mxfusion.components.distributions.bernoulli.
Bernoulli
(prob_true, rand_gen=None, dtype=None, ctx=None)¶ Bases:
mxfusion.components.distributions.univariate.UnivariateDistribution
The Bernoulli distribution.
Parameters: - prob_true (Variable) – the probability of being true.
- 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)¶ 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:
-
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
(prob_true, shape=None, rand_gen=None, dtype=None, ctx=None)¶ Creates and returns a random variable drawn from a Bernoulli distribution.
Parameters: - prob_true (Variable) – the probability being true.
- shape (tuple of int) – the shape of the Bernoulli variable.
- 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: RandomVariable drawn from the Bernoulli distribution.
Rtypes: Variable