scvi.distributions.ZeroInflatedGamma#
- class scvi.distributions.ZeroInflatedGamma(concentration, rate, zi_logits, scale=None, validate_args=False)[source]#
Bases:
GammaZero-inflated Gamma distribution.
A mixture distribution of a point mass at zero and a Gamma distribution. This is ideal for continuous positive data with excess zeros.
In the (concentration, rate, zi_logits) parameterization, samples are generated as follows:
\(\pi = \textrm{sigmoid}(\texttt{zi\_logits})\)
\(b \sim \textrm{Bernoulli}(\pi)\)
If \(b = 1\): \(x = 0\)
If \(b = 0\): \(x \sim \textrm{Gamma}(\alpha, \beta)\)
The probability density function is:
\[\begin{split}f(x; \alpha, \beta, \pi) = \begin{cases} \pi & \text{if } x = 0 \\ (1 - \pi) \cdot f_{\Gamma}(x) & \text{if } x > 0 \end{cases}\end{split}\]where \(f_{\Gamma}(x; \alpha, \beta) = \frac{\beta^\alpha}{\Gamma(\alpha)} x^{\alpha-1} e^{-\beta x}\) is the Gamma density.
- Parameters:
concentration (
Tensor) – Shape parameter (α > 0) of the Gamma distribution.rate (
Tensor) – Rate parameter (β > 0) of the Gamma distribution.zi_logits (
Tensor) – 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#
Methods table#
|
Get normalized values. |
|
Log probability. |
|
Sample from the distribution. |
Attributes#
- ZeroInflatedGamma.arg_constraints = {'concentration': Optional(GreaterThan(lower_bound=0)), 'rate': Optional(GreaterThan(lower_bound=0)), 'zi_logits': Optional(Real())}#
- ZeroInflatedGamma.support = GreaterThanEq(lower_bound=0.0)#