Skip to content
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

Example code mutates a ParticleFilterState directly, but ParticleFilterState is undocumented #50

Open
bzinberg opened this issue Apr 29, 2020 · 1 comment

Comments

@bzinberg
Copy link
Contributor

From #49 (comment):

we should not be mutating the (undocumented) traces field of the (undocumented) ParticleFilterState struct. The reader should (unlike I did) know what their rejuvenation move is supposed to do, but they shouldn't be responsible for knowing what representation invariants a ParticleFilterState has to satisfy, i.e., whether direct mutation (in Julia, outside Gen) is allowed, and if so, what other fields need to be updated simultaneously to maintain data integrity.

In the Gen documentation, particle filter states are treated as black boxes that can only be looked under the hood via Gen APIs. So I think for rejuvenation moves we should either make an API, or document the representation invariants that someone who mutates a ParticleFilterState should maintain.

@ztangent
Copy link
Member

I've been directly mutating ParticleFilterState for some custom SMC code I'm writing too -- I'm in favor of just documenting ParticleFilterState, because there are a lot of other things you might want to do with a particle filter, including custom rejuvenation moves, but also custom initializations (e.g. stratified sampling from the prior so you have low variance even w a small number of particles) and custom resampling steps (e.g. stratified resampling, etc., for the same variance reduction purposes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants