TuringLang / DynamicPPL.jl

Implementation of domain-specific language (DSL) for dynamic probabilistic programming
https://turinglang.org/DynamicPPL.jl/
MIT License
160 stars 28 forks source link

[RFC] Distinguishing tilde methods for passing variable names to both variants #46

Closed phipsgabler closed 4 years ago

phipsgabler commented 4 years ago

Currently, there are essentially two methods of tilde (resp. dot_tilde) -- one for assume, one for observe. These are only distinguished by the assume variant being passed the VarName (and indices).

Can we just have different functions for them, like tilde_observe and tilde_assume, with both taking the VarName? The motivation is that I want to use IRTracker for dependency analysis, for which having the name would really be a nice (i.e., necessary) thing.

The name of an observed variable would just be ignored in all existing implementations, but who knows, maybe it can become useful. I think both methods could actually fall back to tilde for transition. Do any other packages besides Turing itself use them at all?

BTW: what exactly is the reason that assume/observe are not directly produced from the model macro?

phipsgabler commented 4 years ago

Of course I'll also implement this if the answer is yes!

phipsgabler commented 4 years ago

I have made a branch that implements this in a backwards-compatible way, if you wan't to take a look: https://github.com/TuringLang/DynamicPPL.jl/compare/master...phipsgabler:phg/split_tilde.