[Haskell-cafe] Lazy Probabilistic Programming System in Haskell

Benjamin Redelings benjamin.redelings at gmail.com
Fri Jul 16 00:36:08 UTC 2021


Hi,

My program BAli-Phy implements probabilistic programming with models 
written as Haskell programs.

http://www.bali-phy.org/models.php

Unlike [1], models are *lazy* in the sense that you can generate an 
infinite list of random variables, as long as you only access a finite 
number.  I am also using MCMC for inference, not particle filters.

BAli-Phy implements a Haskell interpreter in C++ that records execution 
traces of Haskell programs.  When a random variable is modified (during 
MCMC), the parts of the execution trace that depend on the changed 
variables are invalidated and recomputed. This saves work by not 
recomputing the probability of the new state from scratch.

Here's a example of a model written in Haskell:

https://github.com/bredelings/BAli-Phy/blob/master/tests/prob_prog/regression/LinearRegression.hs

WARNING: There are lots sharp edges.  First and foremost, no type 
system! (yet)

-BenRI

[1] Practical probabilistic programming with monads, 
https://dl.acm.org/doi/10.1145/2804302.2804317



More information about the Haskell-Cafe mailing list