Closed
Description
I'm trying to sample from a complex hierarchical model with lots of variables. I'm thinking of applying ADVI to sample from the posterior because the model has potentially many variables. One of the variables has a bounded prior. In the process of learning how to write user-defined bounded distributions, I did some tests with simple distributions and, unless I'm doing something wrong, it looks that ADVI is not able to properly sample from bounded distributions. Here is the code I'm using:
with pm.Model() as model:
boundedNormal = pm.Bound(pm.Normal, upper=1.0)
th = boundedNormal('th', mu=0.0, sd=1.0)
v_params = pm.variational.advi(n=50000)
traceADVI = pm.variational.sample_vp(v_params, draws=5000)
with pm.Model() as model:
boundedNormal = pm.Bound(pm.Normal, upper=1.0)
th = boundedNormal('th', mu=0.0, sd=1.0)
traceNUTS = pm.sample(2000, pm.NUTS())
pm.traceplot(traceADVI)
pm.traceplot(traceNUTS)
Metadata
Metadata
Assignees
Labels
No labels