A library for probabilistic programming in Haskell.
See the docs for a user guide, notebook-style tutorials, an example gallery, and a detailed account of the implementation.
Created by Adam Scibior (@adscib), documentation, website and newer features by Reuben, maintained by Tweag.
Now that monad-bayes has been released on Hackage, and the documentation and the API has been updated, we will focus on adding new features. See the Github issues to get a sense of what is being prepared, and please feel free to make requests.
The basis for the code in this repository is the ICFP 2018 paper [2]. For the
code associated with the Haskell2015 paper [1], see the haskell2015
tag.
[1] Adam M. Ścibior, Zoubin Ghahramani, and Andrew D. Gordon. 2015. Practical probabilistic programming with monads. In Proceedings of the 2015 ACM SIGPLAN Symposium on Haskell (Haskell ’15), Association for Computing Machinery, Vancouver, BC, Canada, 165–176.
[2] Adam M. Ścibior, Ohad Kammar, and Zoubin Ghahramani. 2018. Functional programming for modular Bayesian inference. In Proceedings of the ACM on Programming Languages Volume 2, ICFP (July 2018), 83:1–83:29.
[3] Adam M. Ścibior. 2019. Formally justified and modular Bayesian inference for probabilistic programs. Thesis. University of Cambridge.
-
If you do not have
nixinstall it. The commands below need flakes; if you have not enabled them globally, add--extra-experimental-features 'nix-command flakes'to eachnixcall. -
Clone the repository using one of these URLs:
git clone git@github.com:tweag/monad-bayes.git git clone https://github.com/tweag/monad-bayes.git -
Run
nix develop- this should open a nix shell with GHC andcabal.
Now you can use cabal build, cabal test and cabal repl.
To develop against a specific compiler, use e.g. nix develop .#ghc912; see
the tested-with field in monad-bayes.cabal for the versions we support.
To view the notebooks, go to the website. To use the notebooks interactively:
- Run
nix develop .#default-jupyter- this opens a nix shell that additionally has JupyterLab and an IHaskell kernel withmonad-bayesin it. - Run
jupyter-labfrom the nix shell to load the notebooks.
Your mileage may vary.