A couple of days ago, while working on a chapter of my book, I came across a manuscript from Kerman and Gelman, from Columbia University talking about a fully Bayesian computing environment. They argue that the basic building block for such a system, would be a "random variable" data type.
I liked their paper. Especially because I was already thinking along those lines for a while. So I decided to give it a shot. Well it was easy, since I already had a nice library for calculating likelihood functions, I didn't have to implement that. I came down to about a hundred lines of Python code (not counting the likelihood library)
I was pretty impressed with it, I had a object that I could specify from a prior distribution, that I could throw data at it and it would return a posterior distribution, a likelihood function, samples from the posterior, etc.
Pretty nice! It also allows the recursive inference typical of Bayesian statistics by which, if available, the posterior becomes the prior when new data is available.
It can still be extended by inhering from basic types such a numpy array. This would allow for this object to be used as a full-fledged type and participate in all sorts of mathematical operations...
Since the code is a bit long and blogger sucks at posting code, I am simply adding a UML representation of the class. If you are interested in discussing about this, getting access to the code or make suggestions, please email me or just leave a comment.