mgplvm.dists module

class mgplvm.dists.NegativeBinomial(total_count, logits, validate_args=None)[source]

Bases: torch.distributions.distribution.Distribution

Creates a Negative Binomial distribution, i.e. distribution of the number of successful independent and identical Bernoulli trials before total_count failures are achieved. The probability of failure of each Bernoulli trial is probs. Args:

total_count (float or Tensor): non-negative number of negative Bernoulli

trials to stop, although the distribution is still valid for real valued count

logits (Tensor): Event log-odds for probabilities of success

arg_constraints = {'logits': Real(), 'total_count': GreaterThanEq(lower_bound=0)}
expand(batch_shape, _instance=None)[source]

Returns a new distribution instance (or populates an existing instance provided by a derived class) with batch dimensions expanded to batch_shape. This method calls expand on the distribution’s parameters. As such, this does not allocate new memory for the expanded distribution instance. Additionally, this does not repeat any args checking or parameter broadcasting in __init__.py, when an instance is first created.

Args:

batch_shape (torch.Size): the desired expanded size. _instance: new instance provided by subclasses that

need to override .expand.

Returns:

New distribution instance with batch dimensions expanded to batch_size.

log_prob(value)[source]

binom(y+r-1, y) (1-p)^r p^y

property mean

mu = pr/(1-p)

property param_shape
sample(conc = r, rate = (1-p)/p) sample y = Poisson(lambda)[source]
support = IntegerGreaterThan(lower_bound=0)
property variance

var = mu/(1-p) = mu*(1 + mu/r)