zenna / Omega.jl

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

RID of one argument #136

Open zenna opened 3 years ago

zenna commented 3 years ago

In the normal normal a model:

θ = @~ Normal(0, 1)
x = @~ Normal(θ, 1)

rcd(x) should just be x || θ

In contrast, if you have A = X + Y + Z, its not clear what RCD(A) should mean

I think then that it make sense to limit RCD of one arg to members of plates

Whereby RCD(Id ~ X) is w.r.t. everything that's not in the plate. Example

e = 21 ~ Normal(0, 1)
function f(id, ω)
  a = (id, 1) ~ Normal(0, 1)
  b = (id, 2) ~ Normal(0, 1)
  c = a(ω) + b(ω) + e(ω)
end

In this case we, if we have x = 12 ~ f, and then rcd(x), we really just want \theta to include e.

  [12, 1]@StdNormal{Float64}() => 0.069282
  [21]@StdNormal{Float64}()    => -2.21076
  [12, 2]@StdNormal{Float64}() => -0.283042

Difficulties in implementation:

  1. Identifying whether a variable needs to be intervened. Can we tell this from the ids?
  2. This doesn't quite fit into the intervention interface. We don't have an explicit random variable - rather we have a predicate on random variables that says whether it should be intervened. Then we don't have a specific value, we have a kind of function that we want to execute.

So I think I should make a more general type of intervention first and formulate rid in thee terms.

As for identifying the variable, looking at the thing above it's clear that the one we want to intervene does not have 12 in it's ids. Is this robust? Let's consider possible failures