-
Notifications
You must be signed in to change notification settings - Fork 12
[WIP] Develop concept #3
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
Conversation
This is the concept for the package. The package does not run yet!
A short demo is added to demonstarte.jl. It shows how this package could be used outside of Turing!
some typose fixed
Some corrections, now it rusn with Turing. Check the ParticleGibbsExtension branch!
Ancestor Sampling concept
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.
Added some comments, might have more at some later stage:)
But as we discussed in person, I think it would be nicer if the framework was bit closer in nature to how it's currently done in Turing.jl, e.g. have a abstract type ParticleInference
and then implement SMC
, ParticleGibbs
, etc. and pass these around as arguments. This way you could remove the manipulators
field from the ParticleContainer
, etc.
Co-Authored-By: David Widmann <devmotion@users.noreply.github.com>
Co-Authored-By: David Widmann <devmotion@users.noreply.github.com>
Co-Authored-By: David Widmann <devmotion@users.noreply.github.com>
Co-Authored-By: David Widmann <devmotion@users.noreply.github.com>
Co-Authored-By: David Widmann <devmotion@users.noreply.github.com>
Co-Authored-By: David Widmann <devmotion@users.noreply.github.com>
Co-Authored-By: David Widmann <devmotion@users.noreply.github.com>
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 left two comments. Solid work, needs a little bit of tidying up as far as whitespace is concerned.
I'm also not sure about the direction this package is meant to go -- is this meant to be a package that stands alone but can be incorporated into Turing (like AdvancedHMC) or is it a package that requires Turing to function? Some people may actually really like to be able to just hand some likelihood function to these particle samplers without building a model in Turing.
If the goal is to have something separate which Turing extends, I highly recommend reading through the interface guide here (sorry it's a little out of date, the Turing.Interface
module should now be AbstractMCMC
) to see how to implement the various interface methods in AbstractMCMC.
src/samplers.jl
Outdated
@@ -0,0 +1,151 @@ | |||
|
|||
|
|||
function sampleSMC!(pc::ParticleContainer,resampler::Function =resample_systematic ,resampler_threshold::AbstractFloat = 0.5) |
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'm not fond of having functions defined with the sampler name in the signature. Turing and most of the packages under it's umbrella use multiple dispatch on some kind of sampler object -- I think good practice would be to do the same here so that everything is consistent across the Turingverse.
Check out AbstractMCMC
and the interface methods it provides for a sampler. There's also a fairly detailed writeup about the interface methodology here and a slightly less detailed one here.
In this case, I think pc
, resampler
, and resampler_threshold
could be bundled into one SMCSampler
struct or something.
Thanks for your comment. The goal of this package is to have something similar to AdvancedHMC for particle filters. However, so far it was the main goal to extract the particle filter from turing and create an own package. There is no proper interface yet. It would definitely make sense to invest some time on creating it! Unfortunately, I do have other projects in the pipeline and therefore, most likely, will not be able to work on this for the moment. My aim is to make a functional first pr such that everyone has a solid basis and can contribute to the package. |
small mistakes
Core - could be used for Turing Inference - Inference outside of Turing based on AbstractMCMC
This is a first version. It should compile and also runs with Turing. Please try to read the code and propose test which need to be made.
The structure is taken from the container file in the Turing package. The idea is to create an own Particle Filter package which allows more freedom.
Remark: The interface is not at all complete and should be completely rewritten. The only purpose of this interface is for debugging and to demonstrate what the package could be used for.
The main purpose so far is to have a clean separation between particle filter and Turing. The focus is still on making the package independent on Turing.
Remark: This is a WIP pull and it is clear that this pull will not be accepted.
Many thanks for the comments so far!