mxnet.gluon.probability.distributions.bernoulli

Bernoulli class.

Classes

Bernoulli([prob, logit, validate_args])

Create a bernoulli distribution object.

class mxnet.gluon.probability.distributions.bernoulli.Bernoulli(prob=None, logit=None, validate_args=None)[source]

Bases: ExponentialFamily

Create a bernoulli distribution object.

Parameters:
  • prob (Tensor or scalar, default None) – Probability of sampling 1.

  • logit (Tensor or scalar, default None) – The log-odds of sampling 1.

broadcast_to(batch_shape)[source]

Returns a new distribution instance with parameters expanded to batch_shape. This method calls numpy.broadcast_to on the parameters.

Parameters:

batch_shape (Tuple) – The batch shape of the desired distribution.

entropy()[source]

Return the entropy of a distribution. The entropy of distributions in exponential families could be computed by: H(P) = F(theta) - <theta, F(theta)’> - E_p[k(x)]

log_prob(value)[source]

Returns the log of the probability density/mass function evaluated at value.

logit()[source]

Get the log-odds of sampling 1.

Returns:

Parameter tensor.

Return type:

Tensor

property mean

Returns the mean of the distribution.

prob()[source]

Get the probability of sampling 1.

Returns:

Parameter tensor.

Return type:

Tensor

sample(size=None)[source]

Generates a shape shaped sample.

sample_n(size=None)[source]

Generate samples of (n + parameter_shape) from the distribution.

property variance

Returns the variance of the distribution.