
On Jun 3, 2010, at 6:40 PM, mokus@deepbondi.net wrote:
If anyone knows a way this could be done while still allowing general functions to be mapped over RVars, I'd love to hear about it. My suspicion though is that it is not possible. It would be a very similar problem to computing the inverse of a function since the PDF is a measure of the size of the preimage of an event in the probability space (if I'm putting all those words together correctly ;)).
We don't necessarily have to compute the inverse of the distribution via sampling to do it. It can be done algebraically, in terms of the convolution operator. Since the types are enumerated, wouldn't something like... work? -- A set and binary operation. We have an algebra. I like the J for 'join'. -- With this algebra, we can use the real-complex analytical methods to -- interpret the terms later, if we want to actually reify a Distribution -- instance as a "Real" (Float, Double) function.
data DistributionJ a = UniformDistribution Uniform a | ... | ExponentialDistribution Exponential a | DistributionJ a `Convolve` (DistributionJ a)
-- I hope I understand the semantics for the PromptT monad.
newtype RVarT m a = RVarT { unRVarT :: PromptT (Prim, DistributionJ) m a }
I guess threading fst and snd in all the low level computations is inelegant, but it's a step closer.