scvi.distributions.ZeroInflatedNegativeBinomial#

class scvi.distributions.ZeroInflatedNegativeBinomial(total_count=None, probs=None, logits=None, mu=None, theta=None, zi_logits=None, scale=None, validate_args=False)[source]#

Bases: NegativeBinomial

Zero-inflated negative binomial distribution.

One of the following parameterizations must be provided:

(1), (total_count, probs) where total_count is the number of failures until the experiment is stopped and probs the success probability. (2), (mu, theta) parameterization, which is the one used by scvi-tools. These parameters respectively control the mean and inverse dispersion of the distribution.

In the (mu, theta) parameterization, samples from the negative binomial are generated as follows:

  1. \(w \sim \textrm{Gamma}(\underbrace{\theta}_{\text{shape}}, \underbrace{\theta/\mu}_{\text{rate}})\)

  2. \(x \sim \textrm{Poisson}(w)\)

Parameters:
total_count Tensor | None (default: None)

Number of failures until the experiment is stopped.

probs Tensor | None (default: None)

The success probability.

mu Tensor | None (default: None)

Mean of the distribution.

theta Tensor | None (default: None)

Inverse dispersion.

zi_logits Tensor | None (default: None)

Logits scale of zero inflation probability.

scale Tensor | None (default: None)

Normalized mean expression of the distribution.

validate_args bool (default: False)

Raise ValueError if arguments do not match constraints

Attributes table#

arg_constraints

mean

Returns the mean of the distribution.

support

variance

Returns the variance of the distribution.

zi_logits

ZI logits.

zi_probs

Methods table#

log_prob(value)

Log probability.

sample([sample_shape])

Sample from the distribution.

Attributes#

ZeroInflatedNegativeBinomial.arg_constraints = {'mu': Optional(GreaterThanEq(lower_bound=0)), 'scale': Optional(GreaterThanEq(lower_bound=0)), 'theta': Optional(GreaterThanEq(lower_bound=0)), 'zi_logits': Optional(Real())}#
ZeroInflatedNegativeBinomial.mean#
ZeroInflatedNegativeBinomial.support = IntegerGreaterThan(lower_bound=0)#
ZeroInflatedNegativeBinomial.variance#
ZeroInflatedNegativeBinomial.zi_logits#

ZI logits.

ZeroInflatedNegativeBinomial.zi_probs#

Methods#

ZeroInflatedNegativeBinomial.log_prob(value)[source]#

Log probability.

Return type:

Tensor

ZeroInflatedNegativeBinomial.sample(sample_shape=None)[source]#

Sample from the distribution.

Return type:

Tensor