3 ms·
For some examples of one form of "probabilistic programming" is, have a look at some examples from the BUGS book [1]. Here, we'll estimate P(Z < 3), where Z ~
by ajtulloch 12y ago
For some examples of one form of "probabilistic programming" is, have a look at some examples from the BUGS book [1]. Here, we'll estimate P(Z < 3), where Z ~ Binom(8, 0.5)
model {
Y ~ dbin(0.5, 8) # Y is Binom(8, 0.5) - 8 trials, pSuccess = 0.5
P2 <- step(2.5 - Y) # does Y = 2, 1 or 0?
}
When this is passed to {Open/Win}BUGS, the software constructs a factor graph for this model and uses MCMC techniques to sample efficiently on this graph. For example, you can example the distribution of the nodes P2 and Y.
node mean sd MC error 2.5% median 97.5% start sample
P2 0.1448 0.3519 0.003317 0.0 0.0 1.0 1 10000
Y 4.004 1.417 0.01291 1.0 4.0 7.0 1 10000
Thus, we infer that P(Z < 3) ≈ 0.1448.
[1]: http://www2.mrc-bsu.cam.ac.uk/bugs/thebugsbook/examples/ http://www2.mrc-bsu.cam.ac.uk/bugs/thebugsbook/examples/