Learning and Cognitive Systems

BCM-Ch03.3: CHURCH-Code for "Inferring a Common Rate"

BUGS contains an abstract simple functional modelling language with restricted expressiveness (e.g.: an IF and recursivion is lacking). Furthermore the sampling process is rather opaque to the user. So BUGS appears to be a 'black box' to the modeler. We believe that our modeling approach with CHURCH is more transparent. Besides the random number generators, the density and the histogram plots every programming construct we used is pure functional Scheme. So it is easy to translate the CHURCH-programs to any functional programming language with similar attributes (random number generators, basic graphic routines).

Furthermore we study how far we could go when the sampling process is restricted to the easy to understand rejection sampling. Though CHURCH offers more sophisticated samplers like MCMC we prefer up to now rejection sampling. This has a clear semantics compared to GIBBS-sampling or MCMC. We believe that nearly all textbook examples could be modelled along our Poor Programmer's Probabilistic Programming Approach: Pure Functional Programs + Random Number Generators + Basic Graphic Routines + Rejection Sampling.

The WinBUGS-code from Lee & Wagenmakers is translated by us to a functional CHURCH-program to clarify its semantics. The generative model is contained in the CHURCH function "take-a-sample". This code of this function should be equivalent to the model{...}-part of OpenBUGS. The number of samples taken was set to 20000 in this run. This number could in principle be increased to get a better precision of estimates. The sampling method used is the simple-to-understand 'forward sampling'. The screen-shot presented was generated by using the PlaySpace environment of WebCHURCH.