PyMC Documentation

card-img-top
Announcements: library name change and launching PyMC 4.0!

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

background image
background image

Testimonials

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.