You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently statements such as `x .~ Normal()` will result in only a single entry in the result of `pointwise_loglikelihoods`, i.e. `x` is treated as a single multivariate random variable rather than a collection of independent random variables.
This is unfortunate for a couple of reasons.
a) It is counter-intuitive as indicated by users finding it confusing: TuringLang/Turing.jl#1666. And I 100% agree with them, in particular because of (b).
b) It is actually different from how `x` is treated in `dot_tilde_assume` due to the usage of `DynamicPPL.unwrap_right_left_vns` for the assume-branch but _not_ for the observe-branch
https://github.com/TuringLang/DynamicPPL.jl/blob/b82459a081c4b8925da3c0d97a6dc61687648ed3/src/compiler.jl#L369-L387
We _could_ simply add the `unwrap_right_left_vns` to the observe-branch too, _but_ it will add some unnecessary overhead due to
https://github.com/TuringLang/DynamicPPL.jl/blob/b82459a081c4b8925da3c0d97a6dc61687648ed3/src/compiler.jl#L106-L115
On the bright side it will make the inputs to `dot_tilde_assume!` and `dot_tilde_observe!` more consistent, so I'm a bit uncertain what the "right" choice is here.
For now I've decided to just call `unwrap_right_left_vns` from within the `dot_tilde_observe!` for `PointwiseLikelihoodContext` as it only introduces an overhead to the `pointwise_loglikelihood` computation but nothing else. IMO this is way to go for this PR, but the above is something that should be given more thought later, e.g. introduce multi-index `VarName`.
0 commit comments