abcpmc icon indicating copy to clipboard operation
abcpmc copied to clipboard

Break out if sampler gets stuck in while loop

Open Gabriel-p opened this issue 7 years ago • 4 comments

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?

Gabriel-p avatar Sep 11 '18 16:09 Gabriel-p

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?

jakeret avatar Sep 11 '18 19:09 jakeret

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?

Gabriel-p avatar Sep 11 '18 20:09 Gabriel-p

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

jakeret avatar Sep 12 '18 09:09 jakeret

You are correct, thank you!

Gabriel-p avatar Sep 12 '18 16:09 Gabriel-p