TODO: Model SPs vs inference SPs vs callbacks; the latter two should be very easy.
Conceptually, a Venture stochastic procedure (SP) represents a conditional probability distribution, P(output | inputs).
The bare minimum that Venture requires from its SPs is the ability to sample:
output ~ P(output | inputs)
TODO: Note that for model SPs, simulate should be a pure function except for the randomness. Forward reference to incorporate and unincorporate for exchangeable mutation. Also permit a beast like print whose effects may be repeated.
However, a wide variety of other information about a model SP may be useful for various purposes:
The Venture SP interface permits one to express all of the above information and expose it for Venture to take advantage of.
In addition, one might wish to manipulate the sequence of different outputs that occur from multiple calls to an SP, for instance to
The Venture SP interface has hooks for this. See [TODO The section on exchangeable coupling]
Finally, Venture SPs may need to call back in to Venture. That is handled by the request mechanism [TODO link].
Technially, the Venture SP interface also has hooks for attaching custom proposal distributions and even entire custom inference programs to individual SPs, but we don’t like to talk about that.
Footnotes
[1] | Density can be with respect to any base measure (usually Lebesgue or counting measure, giving pdf or pmf), as long as the base measure is constant across all values of the inputs. Density can also be unnormalized, again as long as the normalization factor is constant across all values of the inputs. |
[2] | Yes, this is an unusual thing to do with actually stochastic procedures. See [TODO discussion of gradientOfSimulate]. |
Writing foreign Venture SPs can accomplish several goals:
Well, that depends on which SP interface features you want to take advantage of.
TODO: They are all bound the same way, though: ripl.bind_foreign_sp(name, sp) or ripl.bind_foreign_inference_sp(name, sp); which you would typically do in a Plugin.
The easiest kind of foreign SP to add to Venture is just a function (deterministic or stochastic) that you don’t know (or don’t care about) any special properties of.