distributions utils#
- class scconfluence.distributions.NegativeBinomial(total_count: Tensor | None = None, probs: Tensor | None = None, logits: Tensor | None = None, mu: Tensor | None = None, theta: Tensor | None = None, validate_args: bool = False)#
Bases:
DistributionNegative 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.
- arg_constraints = {'mu': GreaterThanEq(lower_bound=0), 'theta': GreaterThanEq(lower_bound=0)}#
- log_prob(value: Tensor) Tensor#
Returns the log of the probability density/mass function evaluated at value.
- Parameters:
value (Tensor) –
- property mean#
Returns the mean of the distribution.
- sample(sample_shape: Size | Tuple = torch.Size([])) Tensor#
Generates a sample_shape shaped sample or sample_shape shaped batch of samples if the distribution parameters are batched.
- support = IntegerGreaterThan(lower_bound=0)#
- property variance#
Returns the variance of the distribution.
- class scconfluence.distributions.ZeroInflatedNegativeBinomial(total_count: Tensor | None = None, probs: Tensor | None = None, logits: Tensor | None = None, mu: Tensor | None = None, theta: Tensor | None = None, zi_logits: Tensor | None = None, validate_args: bool = False)#
Bases:
NegativeBinomialZero-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.
- arg_constraints = {'mu': GreaterThanEq(lower_bound=0), 'theta': GreaterThanEq(lower_bound=0), 'zi_logits': Real(), 'zi_probs': HalfOpenInterval(lower_bound=0.0, upper_bound=1.0)}#
- log_prob(value: Tensor) Tensor#
Returns the log of the probability density/mass function evaluated at value.
- Parameters:
value (Tensor) –
- property mean#
Returns the mean of the distribution.
- sample(sample_shape: Size | Tuple = torch.Size([])) Tensor#
Generates a sample_shape shaped sample or sample_shape shaped batch of samples if the distribution parameters are batched.
- support = IntegerGreaterThan(lower_bound=0)#
- property variance#
Returns the variance of the distribution.
- property zi_logits: Tensor#
- property zi_probs: Tensor#
- scconfluence.distributions.log_nb_positive(x: Tensor, mu: Tensor, theta: Tensor, eps=1e-08)#
Log likelihood (scalar) of a minibatch according to a nb model.
- scconfluence.distributions.log_zinb_positive(x: Tensor, mu: Tensor, theta: Tensor, pi: Tensor, eps=1e-08)#
Log likelihood (scalar) of a minibatch according to a zinb model.