Skip to content

Conversation

donhausk
Copy link

@donhausk donhausk commented Nov 27, 2019

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!

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
Copy link
Member

@torfjelde torfjelde left a 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.

donhausk and others added 7 commits November 27, 2019 21:33
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>
Copy link
Member

@cpfiffer cpfiffer left a 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)
Copy link
Member

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.

@donhausk
Copy link
Author

donhausk commented Nov 28, 2019

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.

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.

@donhausk donhausk requested a review from torfjelde November 28, 2019 22:15
small mistakes
Core - could be used for Turing
Inference - Inference outside of Turing based on AbstractMCMC
@donhausk donhausk closed this Dec 7, 2019
yebai pushed a commit that referenced this pull request Sep 14, 2021
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

Successfully merging this pull request may close these issues.

4 participants