Probabilistic Programming in Birch

Birch is an imperative, object-oriented, universal probabilistic programming language. It compiles to C++14 with shared-memory parallelism provided by OpenMP and fast numerics by Eigen. It is free and open source software for Linux, macOS and Windows.

Probabilistic models are specified in Birch by writing a program to simulate the joint distribution. Inference methods are also written in the language. Sequential Monte Carlo (SMC) is currently supported, with analytical optimizations—such as locally-optimal proposals and Rao–Blackwellization—applied automatically, and efficient memory management via a pooled and copy-on-write memory manager that leverages the path coalescence inherent in these algorithms.

Research and development of Birch is ongoing, but the above already makes it very useful. See Getting Started to try it yourself.

Example

A simple linear-Gaussian state-space model written in Birch.

β:Real <- 0.9;
σ2:Real <- 1.0;
T:Integer <- 10;
x:Random<Real>[T];
y:Random<Real>[T];

x[1] ~ Gaussian(0.0, σ2);
y[1] ~ Gaussian(x[1], σ2);
for (t:Integer in 2..T) {
x[t] ~ Gaussian(β*x[t - 1], σ2);
y[t] ~ Gaussian(x[t], σ2);
}