zenna / Omega.jl

Causal, Higher-Order, Probabilistic Programming
MIT License
163 stars 17 forks source link

Extend lifting distributions to beyond Normal / Uniform #182

Open zenna opened 2 years ago

zenna commented 2 years ago

Currently, we can do:

\mu = @~ Normal(0, 1)
X = Normal(\mu, 1)

and it will create the corresponding pointwise application, but it is does not work beyond Normal and Bernoulli distributions, which it should (see OmegaDistributions.jl)

zenna commented 2 years ago

I'm not sure if the way it is currently done is a good idea.

Distributions.Normal(μ, σ) =
  (id, ω) -> Normal(liftapply(μ, ω), liftapply(σ, ω))(id, ω)

This is relying on the fact that "normal" application of Normal is Normal(::Float64, ::Float64), etc, and assumes that anything that isn't caught must be a random variable. Unclear whether this is currently true, but seems like a bad design choice in general. Problem is that we have no way to dispatch on random variables, which they are just arbitrary function of ω