zenna / Omega.jl

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

Transformations to \omega to make id handling simpler? #179

Closed zenna closed 2 years ago

zenna commented 2 years ago

Here's how to implement a geometric distribution in Omega

geometric(p, ω, n = 0) = (n ~ Bernoulli(p))(ω) ? 0 : 1 + geometric(p, ω, n + 1)

Let's make it into a class

function geometric(p) geoclass(i, ω) = geometric(p, ω, i) something someting it gets more complicated end

It might be more convenient if we can transform ω instead

geometric(p, ω) = (@~ Bernoulli(p))(ω) ? 0 : 1 + geometric(p, τ(ω))

This is easier to write, but are we opening pandora's box. In a sense, this we already have the functionality to do this with sample space projections