Friendly modelling API

PyMC3 allows you to write down models using an intuitive syntax to describe a data generating process.

Cutting edge algorithms

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 fit a regression model.


X, y = linear_training_data()

with pm.Model() as linear_model:
    weights = pm.Normal('weights', mu=0, sd=1)
    noise = pm.Gamma('noise', alpha=2, beta=1)
    y_observed = pm.Normal('y_observed',
                mu=X.dot(weights),
                sd=noise,
                observed=y)

    prior = pm.sample_prior_predictive()
    posterior = pm.sample()
    posterior_pred = pm.sample_posterior_predictive(posterior)

Installation

Via conda-forge:

conda install -c conda-forge pymc3

Via pypi:

pip install pymc3

Latest (unstable):

pip install git+https://github.com/pymc-devs/pymc3

License

PyMC3 is licensed under the Apache License, V2.

Citing PyMC3

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.

See Google Scholar for a continuously updated list of papers citing PyMC3.

Support and sponsors

PyMC3 is a non-profit project under NumFOCUS umbrella. If you want to support PyMC3 financially, you can donate here.