rhine icon indicating copy to clipboard operation
rhine copied to clipboard

Variable time resampling

Open reubenharry opened this issue 1 year ago • 1 comments

One feature I often want in Rhine-Bayes is the ability to control how often resampling happens (which I believe in the present implementation happens at every time step).

The simplest thing would be to specify a resampling rate for runPopulationCl. More complex would be to have the return type of runPopulationCl be ClSF m cl (a, Bool) [(b, Log Double)], where the Bool determines when resampling happens. Does this seem doable (in which case I could have a go) or do you think there's a reason it's not practical?

reubenharry avatar Jan 04 '25 02:01 reubenharry

This seems certainly doable, and I had plans for controlling when resampling happens since some time. Your approach is the most straightforward.

Another idea (which coincidentally might be what you actually want) is to make the decision whether to resample based on the effective sample size. If this is what you want then the advantage is that we don't need to change anything about rhine-bayes, it can all be done in monad-bayes by changing the resampler. In general, if the information whether to resample or not is already in the population then it's best to adjust the resampler.

There are drafts for this in https://github.com/tweag/monad-bayes/pull/268 and https://github.com/turion/rhine/pull/222. I got stuck a bit because I was unsure what the right implementation is, but your prompt has made me come up with a new approach which I'll test now.

turion avatar Jan 04 '25 09:01 turion