phipsgabler / LittleGibbs.jl

Try out the AbstractMCMC interface
MIT License
1 stars 0 forks source link

Turing Gibbs #3

Open trappmartin opened 4 years ago

trappmartin commented 4 years ago

I think it would be good to incorporate this work into the Gibbs sampler by Turing at some point. We can probably extend the current Turing Gibbs sampler quite easily to use user-defined Gibbs conditionals (as in this package) in addition to the within Gibbs sampler strategy.

cc: @yebai

phipsgabler commented 4 years ago

Wouldn't it suffice to provide a "pseudo-sampler", such that one can write something like

cond_b((a,)) = SomeDist(f(a))
Gibbs(PG(20, :a), GibbsConditional(cond_b, :b))
trappmartin commented 4 years ago

Yes, but I don't see the merit of adding an additional sampler for that purpose.

Integrating Gibbs conditionals into the current Gibbs doesn't have a high priority. I can also have a look at it at some point. The issue is meant to keep track of it.

yebai commented 4 years ago

Gibbs(PG(20, :a), GibbsConditional(cond_b, :b))

Interesting - this could enable the user to manually specify Gibbs conditionals, which is easy and computationally more efficient in some cases, but it might require access to the sampling state of other model parameters.

trappmartin commented 4 years ago

Yes, it should be relatively easy to integrate this into Turing's Gibbs using the work done in this package by Philipp.

I'm thinking more about something like:

Gibbs(PG(20, :a), (cond_b, :b), (cond_c, :c))
phipsgabler commented 4 years ago

Yes, but I don't see the merit of adding an additional sampler for that purpose.

I just thought that a wrapper might be nicer for dispatch in Gibbs, but didn't mean it to be an actual sampler -- that's why I wrote "pseudo sampler".

By the way, I think this would be a really useful addition -- one thing I have noticed recently, when working though papers with Bayesian language models, is that most of them write down the model in "tilde form", and then have a section where they derive the conditionals for a Gibbs sampler. In this way, in Turing, people could just almost directly translate these explanations into code!

trappmartin commented 4 years ago

I agree. I think it would be super useful for people.