Picat PPL - Probabilistic Programming Light is is a lightweight probabilistic programming
framework implemented entirely in Picat. It is designed for exploring uncertainty, solving
probability puzzles, and experimenting with small-scale probabilistic models - rather than
performing heavy Bayesian data analysis.
It has two features:
- support for doing probabilistic programming modelling using a fairly high level syntax (such as Gamble and WebPPL)
- support of over 40 different probability distributions (or about 80 depending how one count) with exact calculations, upto Picat's precision of about 1.0e-15.
The Picat PPL page includes documentation of the features of Picat PPL as well as over 550 probabilistic programming models. (In total, it's now over 115 000 lines, including comments and output of the model.)
To run a model, three modules must be downloaded:
"""
model() =>
Doors = [d1,d2,d3],
% The prize can be behind any door 1..3.
Prize = uniform_draw(Doors),
% Which door will Monty open?
% Assumption (WLOG): We always select door 1.
% If the prize is behind door 1 (our selected door),
% then Monty picks some of the other doors by random.
% Note: Monty knows where the prize is and never opens
% the door of the prize.
MontyOpen = cond(Prize == d1,
uniform_draw([d2,d3]), % Monty must pick D2 or D3 randomly
cond(Prize==d2,d3,d2)), % Monty must open D2
% We see that Monty opens door 2
% What are the probabilities that the price is behind
% - door D1 (the one we selected, i.e don't switch)
% - or door D3 (i.e. switch door)
observe(MontyOpen == d2),
if observed_ok then
add("prize",Prize)
end.
"""
$ picat monty_hall.pi
The output is something like:
"""
var : prize
Probabilities:
d3: 0.66149440596696851 (9933 / 15016)
d1: 0.33850559403303143 (5083 / 15016)
"""
Note that Picat PPL does not calculate exact probabilities. Instead it uses a rather simple rejection sampler for inference.
Besides supporting probabilistic programming, Picat PPL also supports over 40 (or 80) different probability distributions, which calculates exact probability (upto Picat's precision of about 1.0e-15). All these have a generator function which can be used in Picat PPL modeling. See the full list of the supported distributions at the Picat PPL page.
Most of the Picat PPL models - as well as the supported functions - have been ported from my Gamble and WebPPL models as well from some
other probabilistic programming systems. Here are my pages for these PPL
systems:
/Hakan
--