nchopin / particles

Sequential Monte Carlo in python
MIT License
403 stars 75 forks source link

Potential Bug in SMC2 #73

Closed JingyueLu closed 12 months ago

JingyueLu commented 1 year ago

In the first step (t=0) of SMC2, the code seems to wrongly compute both G(x_0) (in the current_target function of _M0) and G(x_1) in the logG function.

If so, the code could be fixed by changing "self.current_target(0, self.init_Nx)(x0)" to "self.current_target(-1, self.init_Nx)(x0)" in the _M0 function on line 1134 of the smc_samplers.py script.

nchopin commented 1 year ago

Good catch, thanks a lot. Actually, this bug occurred both in SMC2 and in IBIS (in module smc_samplers). In both cases, method _M0 called self.current_target(0)(x0) but 0 should have been -1, since, at time 0, before the reweighting step, the target is $\pi_{-1}$, so to speak.

This issue has been fixed in experimental. I'm going to run more tests before merging this into master.