Omega.jl icon indicating copy to clipboard operation
Omega.jl copied to clipboard

Allow controlling output of random variable

Open zenna opened this issue 7 years ago • 0 comments

Currently we can only modify Omega, which is rich enough for most (all?) purposes. However it may also be useful to be able to make proposals on the outputs of random variables for the following reasons

  • There are many primitive distributions for which we have (log)pdf but the sampler for that distribution is either (i) not controllable (e.g. because random number generator calls to R, which is still most of Distributions.jl, or (ii) not differentiable even when it should be (e.g. mvnormal)
  • Often a user might have domain knowledge about valid proposals, this is unlikely to be at the level of omega, but rather at random variable level. Currently no way to incorporate that.
  • Currently Mu is always approximate; it is like ABC. We should be able to strictly subsume what other probabilistic languages do in the cases that they apply, i.e. if you condition on X == 1.234 these X is literally restricted to be 1.234 and the log density of the trace is computed.
  • It would allow us to construct something like a EnergyRandVar, i.e. a random variable defined by an (potentially unnormalized) density, but could be used in the same way as other randvar
using LightGraphs
f(x::Graph) = nvertices(x)
x = EnergyRandVar{Graph}(f) # Make a random variable by defining the energy function
x2 = iid(x)
y = nconnectedcomponents(x2)
rand(y) # but treat as a normal random variable
  • It might make things like caching etc easier, but maybe we don't need this for that

Unclear currently how hard this would be. Ideally it would integrate seamlessly with Omega.

zenna avatar Apr 20 '18 17:04 zenna