About this project

PyMC (formerly PyMC3) is a Python package for Bayesian statistical modeling that focuses on advanced Markov chain Monte Carlo (MCMC) and variational inference (VI) algorithms. Its flexibility and extensibility make it applicable to a large suite of problems across many domains. Key features include an intuitive model specification syntax (e.g., x ~ N(0,1) translates to x = Normal('x',0,1)), powerful sampling algorithms such as the No U-Turn Sampler (NUTS) that allow complex models with thousands of parameters with little specialized knowledge of fitting algorithms, and variational inference via ADVI for fast approximate posterior estimation as well as mini-batch ADVI for large data sets. PyMC relies on PyTensor for computation optimization, dynamic C or JAX compilation, NumPy broadcasting, advanced indexing, linear algebra operators, and simple extensibility. It also provides transparent support for missing value imputation. The framework supports a complete Bayesian workflow: defining generative models with coordinates and dimensions, sampling from prior predictive distributions, observing data to perform inference, generating posterior predictive samples, and conducting counterfactual analysis using the do() operator to simulate scenarios under modified parameters. The example in the README demonstrates a linear regression model for plant growth prediction, showing how inferred parameters closely match fixed ground-truth values, and how posterior predictive sampling and counterfactual interventions can be performed. PyMC is a non-profit project under the NumFOCUS umbrella and is licensed under Apache License 2.0. It has a rich ecosystem of related software including Bambi for Bayesian model building, calibr8 for observation models, gumbi for Gaussian process models, SunODE for fast ODE solving, and domain-specific tools like Exoplanet for astronomical time series, beat for earthquake analysis, CausalPy for causal inference, and PyMC-Marketing for marketing mix modeling. The project provides extensive documentation, tutorials, example galleries, and an active Discourse forum for community support.