jakeret / abcpmc

Approximate Bayesian Computation Population Monte Carlo
GNU General Public License v3.0
40 stars 19 forks source link

Break out if sampler gets stuck in while loop #16

Open Gabriel-p opened 6 years ago

Gabriel-p commented 6 years ago

I've been using this package for a few days (thank you BTW!) and it works great. One issue I have is that it seems to get stuck forever if I use >20 particles, trying to find solutions with distances below the threshold for all of them:

captura de pantalla de 2018-09-11 11-41-29

Is there a way to break out of this if enough time has elapsed? Is this even a good idea?

jakeret commented 6 years ago

Hi Gabriel, great to hear that the package is useful to you. This is indeed an issue. I think the first case is a bit special if the prior is already smaller than the posterior. The second one seems much more critical. However, setting a time limit is probably not optimal as time very much depends on the case and can vary a lot depending on the complexity of the model. Maybe one way out would be to slightly adapt the sampler such that it stops after a certain number of trials. What do you think?

Gabriel-p commented 6 years ago

Definitely agree. Adding a parameter like max_trials to force the sampler to break out and not get stuck would be nice. Perhaps issuing a Warning when this happens would be reasonable too.

Add: BTW, is there any way to know how many models are evaluated at each sampler iteration?

jakeret commented 6 years ago

In principle you can derive it from the number of particles and the acceptance ratio

Gabriel-p commented 6 years ago

You are correct, thank you!