PyMC Documentation¶

We have two major announcements that we’re excited to share. First of all, a new name for our library: the PyMC3 library you know and love is now called PyMC. PyMC3 still exists, as a specific major release between PyMC2 and PyMC 4.0. Read more about the renaming and how to solve related issues you might experience from this update here.
This ties into our second announcement, which is that we are hereby launching the newest version of PyMC: PyMC 4.0! Read more about this new release here.
Main Features & Benefits¶
Friendly modelling API
PyMC allows you to write down models using an intuitive syntax to describe a data generating process.
Cutting edge algorithms and model building blocks
Fit your model using gradient-based MCMC algorithms like NUTS, using ADVI for fast approximate inference — including minibatch-ADVI for scaling to large datasets — or using Gaussian processes to build Bayesian nonparametric models.
import numpy as np
import pymc as pm
X = np.random.normal(size=100)
y = np.random.normal(X) * 1.2
with pm.Model() as linear_model:
weights = pm.Normal("weights", mu=0, sigma=1)
noise = pm.Gamma("noise", alpha=2, beta=1)
y_observed = pm.Normal(
"y_observed",
mu=X @ weights,
sigma=noise,
observed=y,
)
prior = pm.sample_prior_predictive()
posterior = pm.sample()
posterior_pred = pm.sample_posterior_predictive(posterior)
Support¶
PyMC is a non-profit project under NumFOCUS umbrella. If you value PyMC and want to support its development, consider donating to the project.
Our sponsors¶


Testimonials¶
SpaceX
At SpaceX PyMC helped us estimate supplier delivery uncertainty and quantify which suppliers were consistent in sending us rocket parts and which suppliers we needed to partner with to understand how we could reduce variability
Ravin Kumar
Salesforce
PyMC is my primary tool for statistical modeling at Salesforce. I use it to combine disparate sources of information and pretty much anywhere that quantifying uncertainty is important. We’ve also been experimenting with gaussian processes to model time series data for forecasting.
Eddie Landesberg. Manager, Data Scientist
At the Novartis Institutes for Biomedical Research, we use PyMC for a wide variety of scientific and business use cases. The API is incredible, making it easy to express probabilistic models of our scientific experimental data and business processes, such as models of electrophysiology and molecular dose response.
Eric J. Ma
At Intercom, we’ve adopted PyMC as part of our A/B testing framework. The API made it easy to integrate into our existing experimentation framework and the methodology has made communication of experiment results much more straightforward for non technical stakeholders.
Louis Ryan
Used in research code at Channel 4 for developing internal forecasting tools.
Peader Coyle
Find more testimonials here
Citing PyMC¶
Use this to cite the library:
Salvatier J., Wiecki T.V., Fonnesbeck C. (2016) Probabilistic programming in Python using PyMC3. PeerJ Computer Science 2:e55 DOI: 10.7717/peerj-cs.55.
For detailed advise on citing PyMC go to Citing PyMC. See Google Scholar for a continuously updated list of papers citing PyMC3.