Birch

Birch is a probabilistic programming language featuring automatic marginalization, automatic conditioning, automatic differentiation, and inference algorithms based on Sequential Monte Carlo (SMC). The Birch language transpiles to C++.

See https://birch.sh for a gentle introduction, and https://docs.birch.sh for reference documentation.

lawmurray codecov Contributor Covenant

License

Birch is open source software. It is licensed under the Apache License, Version 2.0 (the "License"); you may not use it except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Getting started

Linux

Packages are provided for major Linux distributions, including Debian, Ubuntu, Fedora, CentOS, openSUSE, SUSE Linux Enterprise, Mageia, and Arch. Click through to the Open Build Service and select your distribution for installation instructions.

For Raspberry Pi OS, head straight to the repository. For Alpine Linux, which you may be particularly interested in for installing Birch in a lightweight container environment, you will need to install from source, but we do support musl for this purpose.

FreeBSD

You will need to install from source, see below.

Mac

Install Homebrew if not already, then install Birch with:

brew tap lawmurray/birch
brew install birch

Windows

Native support is not yet provided, but you can install Windows Subsystem for Linux with a Linux distribution of your choice, then click through to the Open Build Service and select that distribution for installation instructions.

From source

If a package is not available for your operating system or you have special requirements, you can install Birch from source. This requires:

The following are optional, but will be linked in automatically if found (to improve performance):

All Birch sources are in the same repository. The main branch is considered stable. Clone it:

git clone https://github.com/lawmurray/Birch.git

and change to the Birch directory:

cd Birch

Then proceed as follows. Note special instructions for Mac in step 2. In addition, on Mac, you can typically omit sudo from these commands.

  1. Install the driver by running, from within the driver/ directory:

    ./bootstrap
    ./configure
    make
    sudo make install
  2. Install LibBirch by running, from within the libbirch/ directory:

    ./bootstrap
    ./configure
    make
    sudo make install

    On Mac, use the following configure line instead:

    ./configure --disable-openmp CPPFLAGS="-Xpreprocessor -fopenmp"

    Despite the apparently conflicting options, this will enable multithreading with OpenMP (specifically, it disables the standard check in the configure script, which fails on Mac, but then adds the required flags).

  3. Install the standard library by running, from within the libraries/Standard/ directory:

    birch build
    sudo birch install

This constitutes a basic install with both debug (unoptimized, with debugging information) and release (optimized, without debugging information) modes. You may also like to install other packages in the libraries/ directory. It is not usual to install the packages in the examples/ directory, although you may like to build and run these locally for testing and learning purposes.

Birch

A probabilistic programming language that combines automatic differentiation, automatic marginalization, and automatic conditioning within Monte Carlo methods.

Birch Info

⭐ Stars 78
🔗 Homepage birch.sh
🔗 Source Code github.com
🕒 Last Update a month ago
🕒 Created 5 years ago
🐞 Open Issues 3
➗ Star-Issue Ratio 26
😎 Author lawmurray