-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctness issue with MHFromPrior sampler #250
Comments
@miguelbiron thanks for the great catch! this is pretty sloppy -- sorry, let me get on fixing this |
No problem! I wonder if, instead of the Gibbs sampler, the problem lies instead in the fact that OTOH, that feature enables some relevant algorithms. For example, the MCMC invariance statistical test we use in Pigeons. |
I think so (regarding issue lies in I think adding an option to not sample the conditioned variables is good. Actually not sample is probably the correct default implementation -- sampling from prior can be just first decondition on all variables and then run this evaluate function (one that does not sample from conditioned variables). |
That sounds reasonable! The situations where you actually want full resampling are pretty rare. |
#253 introduced the said option for not sampling observed variables Will start a fix to MHFromPrior soon |
Hi @sunxd3 -- I was testing the
MHFromPrior
withinGibbs
sampler on one of Pigeons' recurring toy examples, and I found that it doesn't target the correct posterior. The posterior is described in depth here. In particular,E[p] ≈ [0.7, 0.7]
, but the Gibbs sampler producesE[p] ≈ [0.5, 0.5]
, indicating that it is just sampling from the prior.The issue, I think, is here
JuliaBUGS.jl/src/gibbs.jl
Line 67 in bac2171
You are assuming that
logp_proposed
is the correct logpdf of the proposal. But the issue is thatevaluate!!(model, rng)
resamples every~
statement---even the ones that correspond to observations. Sologp_proposed
is computed under a randomn_heads
sampled from the likelihood, and is therefore unrelated to the actual observedn_heads
. Which implies that the sampler ends up targeting the prior instead of the posterior.Reproducer
Result
The issue persists if we sample in constrained space
Results
The text was updated successfully, but these errors were encountered: