-
Notifications
You must be signed in to change notification settings - Fork 11
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
User-specified resampling methods #6
Comments
Hi @pkairys. I welcome the discussion. With the code as is, a user can create a child of OptBayesExpt and overwrite the resample function, but maybe that's not what you're suggesting. If the goal is to add alternative, user-selectable resamplers to a new version of the distribution, then I'd suggest adding alternative resampling methods to the ParticlePDF class and select between them with a keyword argument in init() Would there be an advantage to putting the resample function in a separate Resampler class that would be inherited by ParticlePDF? I suppose that if we also put (e.g.) the resample_test function in a separate class, the two functions could be developed in parallel without conflct. Admittedly, I'm mostly ignorant of the branch & pull functions of git so if I'm missing something, please let me know. |
My idea was in line with your second point. Basically, allow a user to specify a resampler function when initializing the particlePDF. This can either be done by passing a keyword argument to specify which resampler. Or equally, by passing a resampler function to the class. Something like def custom_resampler(weights, particles, params):
....
return new_particles
custom_params= {'a':0.98, ...}
mypdf = ParticlePDF(..., resampler=custom_resampler, resampler_params = custom_params) I think this would be really useful because it would allow me to optimize my resampler implementation as needed for the application without having to modify any OBE classes or code. |
OK, yes. Go ahead and make your version of ParticlePDF with extra custom_reampler methods and the resampler keyword. It's OK to coach/prompt/nag me on use of branching and pulling if you need those features. |
I'm creating this issue to discuss user-specified resamplers. This would be useful to specify different resamplers for different applications. For example when the posterior is multimodal. ]. It would also help to optimize the resampling methods separately from the OBE classes in order to increase performance.
Thoughts?
The text was updated successfully, but these errors were encountered: