Probability Distributions
PyMC includes a comprehensive set of pre-defined statistical distributions that can be used as model building blocks.
PyMC allows you to write down models using an intuitive syntax to describe a data generating process.
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 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)
conda install -c conda-forge pymc
pip install git+https://github.com/pymc-devs/pymc
PyMC is licensed under the Apache License, V2.
Please choose from the following:
See Google Scholar for a continuously updated list of papers citing PyMC.
PyMC is a non-profit project under NumFOCUS umbrella. If you value PyMC and want to support its development, consider donating to the project or read our support PyMC page.