tweag / monad-bayes

A library for probabilistic programming in Haskell.
MIT License
404 stars 62 forks source link

Add effective sample size to Population #268

Open turion opened 1 year ago

turion commented 1 year ago

I recently read about improving existing resampling methods by only resampling when the effective sample size is small.

turion commented 1 year ago

I assume this preserves the unbiased nature of SMC (since no resampling is unbiased, and full resampling is unbiased) - if not it should be commented.

I'm not sure. Is there a resource to read up about biases introduced by resampling? I didn't read anything in Murphy's book about this not being unbiased. I would have thought that if the procedure at each timestamp is not biased, the whole process is not biased, but I can't prove it.

turion commented 1 year ago

Also, I want to add a fixture test and look at the values a bit before merging.

reubenharry commented 1 year ago

I don't really know, but yeah, I also agree with that reasoning.

turion commented 1 year ago

I managed to produce a crash using this function in rhine-bayes, but I haven't found the reason yet.

turion commented 1 year ago

I managed to produce a crash using this function in rhine-bayes, but I haven't found the reason yet.

The crash was:

rhine-bayes-gloss: Statistics.Distribution.Normal.normalDistr: standard deviation must be positive. Got NaN
CallStack (from HasCallStack):
  error, called at ./Statistics/Distribution/Normal.hs:115:27 in statistics-0.16.2.0-ca3954dbbfc16db2d02d8c716cbf789c747e026d3f9db91380356ec3f9721ef8:Statistics.Distribution.Normal
Segmentation fault (Speicherabzug geschrieben)

I could not manage to reproduce it again. In subsequent runs, it seemed to me that one could definitely speed up performance, while keeping the same variance.