probmods/webppl — pull request #16 by null-a (2014-10-09 13:09:49+00:00)
Title: Possible PMCMC fix.

Hi.

Thanks for publishing dippl, I've had great fun working through it and I learning a *lot*.

I've been playing with the PMCMC implementation in webppl and assuming it's doing particle Gibbs I'm not sure it's correct.

(Before I go on, I should point out that I'm not all that familiar with PMCMC, so please keep in mind the possibility that I'm entirely mistaken about what's happening here.)

This commit makes two changes, I think they fix the correctness issue.

1) The particles from every iteration of conditional SMC are now used in the estimate of the marginal. Previously only the particles from the last iteration were used.

2) The first non-retained particle is now deterministically chosen as the retained particle for the next iteration. The reason I think this is correct is that the retained particle should be a sample from the set of weighted particles we have after the last factor statement. Since this final set is re-sampled (with weights) before the exit function is reached, once in the exit function all of the particles are independent draws from the distribution from which the retained particle should be drawn. Any of them could be used, the first is easiest.

I've tried this out on a few examples and it seems to do the right thing, though I'm still unsure. What do you think?