-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add effective sample size to Population #268
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
Also, I want to add a fixture test and look at the values a bit before merging. |
I don't really know, but yeah, I also agree with that reasoning. |
I managed to produce a crash using this function in |
The crash was:
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. |
-- | The new resampler | ||
(Population m a -> Population m a) | ||
onlyBelowEffectiveSampleSize threshold resampler pop = do | ||
ess <- lift $ effectiveSampleSize pop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is wrong because it will execute the m
effects of pop
again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to have a function withEffectiveSampleSize :: Functor m => Population m a -> m (a, Double)
b76102f
to
7811d67
Compare
@@ -206,6 +208,31 @@ resampleMultinomial :: | |||
PopulationT m a | |||
resampleMultinomial = resampleGeneric multinomial | |||
|
|||
-- | Only use the given resampler when the effective sample size is below a certain threshold | |||
onlyBelowEffectiveSampleSize :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have one fixture test and a unit test where this is used.
I recently read about improving existing resampling methods by only resampling when the effective sample size is small.