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

Support for Ensemble Sampler #11

Open
mileslucas opened this issue Aug 21, 2019 · 7 comments
Open

Support for Ensemble Sampler #11

mileslucas opened this issue Aug 21, 2019 · 7 comments

Comments

@mileslucas
Copy link

I come from the python astronomy community which includes an MCMC inference tool called the Ensemble Sampler (code, paper). Dan has said he's currently working with PyMC3 team to incorporate his sampler there and I think it would be nice to incorporate into Turing.

In general, I don't have great experience implementing inference methods (I did a Metropolis-Hastings in a stats class once!), so my attempt at implementing this sampler would definitely need oversight from more adept inferencers. Input from @dfm would be great, too!

Is this something that should be looked at soon or something that should wait for some of the roadmap goals of simplifying the sampler API? (#689)

@cpfiffer
Copy link
Member

The sampler API simplification you noted is indeed still ongoing, so anything you build now will probably be invalidated and require some nontrivial modifications once TuringLang/Turing.jl#793 goes through.

That said, after that point, we do want to encourage more developers to jump in, specifically so we can find the pain points of sampler development. There's an issue over at TuringLang/Turing.jl#886 that covers a bit of that. We're hoping that people like yourself will try to build stuff into Turing and let us know what is annoying to work with so we can fix it.

TuringLang/Turing.jl#793 is going to come with a guide on sampler implementation which describes the general architecture of an inference algorithm, and then shows how to integrate it with Turing. I'll reach out when it's available by posting a link here and we can talk about how to proceed further.

The good thing is that this ensemble sampler method you've highlighted is really a simple one (a modified MH) and it should be straightforward to implement.

@xukai92
Copy link
Member

xukai92 commented Sep 16, 2019

@cpfiffer This maybe another target to test the new interface.

@yebai
Copy link
Member

yebai commented Sep 16, 2019

@mileslucas
Copy link
Author

After reading through a discourse thread, it appears the sampler I'm taking about has already been implemented in Julia to some extent - https://github.com/madsjulia/AffineInvariantMCMC.jl

I've no clue on the status or interoperability of it with Turing, but could be useful as a reference for future implementation. This also leads to the issue of what to call it. People in Astronomy mostly know emcee as the magical black box MCMC package. Users refer to its sampler as the EnsembleSampler which is an implementation of the Goodman/Weare Affine Invariant sampler. Thoughts?

@cpfiffer
Copy link
Member

I am not sure about the name -- I hadn't heard about it until the astro people showed up. I'm preferential to sample(model, Ensemble(), 100) or sample(model, AffineInvariant(), 100).

As to the existing implementation, it appears to have a pretty reasonable structure that might lend itself well to the existing interface. It'd still have to be written, but to my eye it looks like it would be a lot easier than writing from scratch.

@xukai92
Copy link
Member

xukai92 commented Sep 17, 2019

By looking at there interface, I think we can esaily wrap that library into Turing as it only relies on the likelihood of the model.

@mileslucas
Copy link
Author

I think sample(model, AffineInvariant(), 100) is a more descriptive name to use. Especially if we und up wrapping the above package for consistency.

@yebai yebai transferred this issue from TuringLang/Turing.jl Jan 15, 2020
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

4 participants