PyMC is a python module for Bayesian statistical modeling and model fitting which focuses on advanced Markov chain Monte Carlo fitting algorithms. Its flexibility and extensibility make it applicable to a large suite of problems.
Check out the Tutorial!
PyMC 3 is alpha software and is not ready for use in production. We encourage most new users to use the current release version in the PyMC 2.3 branch. Release versions are also available on PyPI and Binstar.
- Intuitive model specification syntax, for example,
x ~ N(0,1)translates to
x = Normal(0,1)
- Powerful sampling algorithms such as Hamiltonian Monte Carlo
- Easy optimization for finding the maximum a posteriori point
- Numpy broadcasting and advanced indexing
- Linear algebra operators
- Computation optimization and dynamic C compilation
- Simple extensibility
- PyMC 3 Tutorial
- Coal Mining Disasters model in PyMC 2 and PyMC 3
- Global Health Metrics & Evaluation model case study for GHME 2013
- Stochastic Volatility model
- Several blog posts on linear regression
- Talk at PyData NYC 2013 on PyMC3
- PyMC3 port of the models presented in the book "Doing Bayesian Data Analysis" by John Kruschke
- The PyMC examples folder
The latest version of PyMC 3 can be installed from the master branch using pip:
pip install git+https://github.com/pymc-devs/pymc
Another option is to clone the repository and install PyMC using
python setup.py install or
python setup.py develop.
pip install pymc will install PyMC 2.3, not PyMC 3, from PyPI.
PyMC is tested on Python 2.7 and 3.3 and depends on Theano, NumPy, SciPy, and Matplotlib (see setup.py for version information).
The GLM submodule relies on Pandas, Patsy, Statsmodels.
scikits.sparse enables sparse scaling matrices which are useful for large problems. Installation on Ubuntu is easy:
sudo apt-get install libsuitesparse-dev pip install git+https://github.com/njsmith/scikits-sparse.git
On Mac OS X you can install libsuitesparse 4.2.1 via homebrew (see http://brew.sh/ to install homebrew), manually add a link so the include files are where scikits-sparse expects them, and then install scikits-sparse:
brew install suite-sparse ln -s /usr/local/Cellar/suite-sparse/4.2.1/include/ /usr/local/include/suitesparse pip install git+https://github.com/njsmith/scikits-sparse.git