-
Notifications
You must be signed in to change notification settings - Fork 223
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
Particle Gibbs does not return log probability #643
Comments
If you have usage questions, please post a minimal working example. These questions are also more suited to the Julia slack (https://julialang.slack.com) channel #turing. |
@colehurwitz31 You should be able to extract the log probability from the chain for each sample after you've run it using |
@mohamed82008 @cpfiffer Sorry for the confusing - I was helping @colehurwitz31 with Turing and found this issue so I asked him to create an issue on this. Yes PG indeed doesn't report log-joint in chain correct - all using Turing
@model gdemo(x, y) = begin
s ~ InverseGamma(10,3)
m ~ Normal(0,sqrt(s))
x ~ Normal(m, sqrt(s))
y ~ Normal(m, sqrt(s))
return s, m
end
x, y = 1.5, 2.0
chn = sample(gdemo(x, y), PG(20, 500))
chn[:lp] # => all 0s |
Because PG doesn't track the log-joint, there is no way to extract it directly - is my understanding correct? @yebai I guess a simple solution is to evaluate the log-joint after each MCMC step, though it adds some more computation (ofc we should have an interface to make it optional). Otherwise we should provide some utility functions to re-evaluate the log-joint for each sample in the MCMC chain. |
That's right, the weight associated with each particle is reset to logp(model, vi) However, if we accumulate log weights and store them somewhere, we can avoid an extra call to |
So it seems to me we'd add another field to the |
Likely out of date due to the effort of separating particle MCMC and SMC samplers into https://github.com/TuringLang/AdvancedPS.jl |
Would it be possible to return the log probability when using PG?
The text was updated successfully, but these errors were encountered: