Turing.jl: Question about custom inference parameterized by distribution types

Created on 27 Sep 2018  路  2Comments  路  Source: TuringLang/Turing.jl

I have a noob question on how something might be done in Turing.jl, or any other extant PPL for that matter. Basically, I am wondering if I can implement bespoke inferences (for example, taking a particular expectation value) for hierarchical distributions that might only be appropriate for special cases of the hierarchical composition (as opposed to a general inference method like Gibbs sampling). I will try to clarify my question by way of an example.

Suppose I have a compound distribution involving some positive univariate distribution X of type T and a Poisson distribution Y = Poisson(X). I want to be able to estimate the mean of Y. In vanilla Julia I might define a compound distribution type (for univariate distributions that accept a single parameter)

struct CompoundDistribution{S,T}
   X{S}
   Y{T}
end

which would allow me to write a generic method that exploits the linear relationship between the mean of a Poisson distribution and its parameter

mean{S}(Z::CompoundDistribution{S,Poisson}) = mean(Z.X)

Is this sort of optimization something that Turing.jl supports or might in the future?

question

Most helpful comment

Turing is currently not exploiting special cases like conjugate priors. However, you can use a manually defined distribution, such as your CompoundDistribution, within Turing to exploit properties of special cases. You can have a look at http://turing.ml/latest/advanced.html for further details on how to define your CompoundDistribution so that it can be used in Turing.

I hope this answered your question.

All 2 comments

Turing is currently not exploiting special cases like conjugate priors. However, you can use a manually defined distribution, such as your CompoundDistribution, within Turing to exploit properties of special cases. You can have a look at http://turing.ml/latest/advanced.html for further details on how to define your CompoundDistribution so that it can be used in Turing.

I hope this answered your question.

Yep. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trappmartin picture trappmartin  路  3Comments

trappmartin picture trappmartin  路  6Comments

yebai picture yebai  路  6Comments

yebai picture yebai  路  6Comments

scheidan picture scheidan  路  5Comments