Exemple #1
0
 def _base_dist(self, psi: TensorLike, theta: TensorLike, *args, **kwargs):
     return pm.Mixture(
         p=[psi, 1.0 - psi],
         distributions=[
             pm.Constant(value=0, name="Zero"),
             pm.Poisson(mu=theta, name="Poisson")
         ],
         name="ZeroInflatedPoisson",
     )._distribution
Exemple #2
0
 def _base_dist(self, psi: TensorLike, mu: TensorLike, alpha: TensorLike,
                *args, **kwargs):
     return pm.Mixture(
         p=[psi, 1.0 - psi],
         distributions=[
             pm.Constant(value=0, name="Zero"),
             pm.NegativeBinomial(mu=mu, alpha=alpha, name="NegBin"),
         ],
         name="ZeroInflatedNegativeBinomial",
     )._distribution
Exemple #3
0
    def _base_dist(self, psi: TensorLike, n: TensorLike, p: TensorLike, *args,
                   **kwargs):
        """
        Zero-inflated binomial base distribution.

        A ZeroInflatedBinomial is a mixture between a deterministic
        distribution and a Binomial distribution.
        """
        return pm.Mixture(
            p=[psi, 1.0 - psi],
            distributions=[
                pm.Constant(0, name="Zero"),
                pm.Binomial(n, p, name="Bin")
            ],
            name="ZeroInflatedBinomial",
        )._distribution