Closed EdwardRaff closed 2 years ago
@fehiepsi I appreciate the quick bug fix! As I am reading the code changes, is my understanding correct that this would still not allow the ZeroInflatedDistribution
to work with the Beta
distribution? I'm trying to understand if the discere only distributions is intendended.
I guess you can use inflated beta one for likelihood. We don't have an inference algorithm to deal with inflated beta latent variable.
Does that mean dist.ZeroInflatedDistribution(dist.Beta(3,3), gate=0.5, obs=Y)
would work fine, but dist.ZeroInflatedDistribution(dist.Beta(3,3), gate=0.5)
would not?
I'm currently doing something like:
prob_zero = sample('Zero Inflation', dist.BernoulliProbs(0.5))
beta_aug = sample('Slab Response', dist.BetaProportion(3, 3))
v = numpyro.deterministic('Zero Inflated Response', (1-prob_zero)*beta_aug)
Do you think that is OK / have any other recommendations?
Either way, want to make sure you know I appreciate Numpyro and your fast help! This has helped me get some cool stuff working with greater speed/ease then I ever could have done without it.
Does that mean dist.ZeroInflatedDistribution(dist.Beta(3,3), gate=0.5, obs=Y) would work fine, but dist.ZeroInflatedDistribution(dist.Beta(3,3), gate=0.5) would not?
Yes.
Do you think that is OK / have any other recommendations?
Yup, I think that is the right way to be able to perform inference for a latent zero-inflated beta variable.
Hi I am running into a similar error but have not been able to resolve it. I keep running into the assertion assert base_dist.support.is_discrete
that makes it seem like the ZeroInflatedDistribution
will not support continuous-valued distributions like the Beta
. My model is:
def model(data):
α = numpyro.sample("alpha", TruncatedNormal(0, 1, low=0))
β = numpyro.sample("beta", TruncatedNormal(0, 1, low=0))
p = numpyro.sample("p", Beta(1, 1))
R = ZeroInflatedDistribution(Beta(α, β), gate=p)
return numpyro.sample("rate", R, obs=data)
so the ZI site is not latent, which from the discussion above, sounds like it should be ok then? Does the ZI distribution only work with discrete distributions? I am using NUTS to start, but plan to start using SVI once I work out the kinks, btw, I don't know if that is relevant.
If I build a model as
I get the confusing error mesage:
If I then switch to
kernel =NUTS(model)
I get thisThe errors get more confusing if I move toward model I want to perform, a zero inflated Beta
Which apparently does not allow to zero inflated continuous distributions according to this assert?
My larger goal was to have a zero-one inflated Beta, but I would be happy to reach Zero-Inflated only