In this workshop, you'll learn how to develop Bayesian intuition and build powerful probabilistic models using PyMC.
Making decisions under uncertainty is hard — especially when your data is limited, your outcomes are rare, or your assumptions are hidden. 😭
You'll see how modern Bayesian modeling can:
- Estimate probabilities with informative priors.
- Compare alternatives probabilistically with Bayesian A/B testing.
- Share strength across groups using hierarchical models.
- Evaluate and anticipate rare events using posterior predictive distributions.
You can run the notebooks locally using PyMC, ArviZ, and Jupyter Notebooks — or on Colab with no setup required.
This workshop is based on tutorials taught my PyMC Labs, with some examples from Allen Downey's book Think Bayes.
Use these links to run the notebooks on Colab (no setup required):
🚀 Notebook 1: Priors and Posteriors
🎯 Notebook 2: Bayesian Bandits
🧬 Notebook 3: Hierarchical Models
🔮 Notebook 4: Probabilistic Prediction
Or follow the instructions below to run the notebooks locally.
You'll start by developing a solid foundation in Bayesian thinking:
- Understand the fundamentals of probability and uncertainty.
- Learn how to specify informative priors based on domain knowledge.
- Build simple models to estimate unknown rates from sparse observations.
- Practice interpreting posterior distributions and credible intervals.
This gives you the Bayesian mindset needed for more complex modeling.
After building Bayesian intuition, you'll create decision-support systems:
- Use Bayesian A/B testing to compare alternatives probabilistically.
- Build hierarchical models to pool data across many subgroups.
- Identify and avoid catastrophic sequences of failures.
- Evaluate whether your models make robust predictions under uncertainty.
You'll also learn how to:
- Balance generalization and specificity in your models.
- Communicate risks and confidence clearly to stakeholders.
Finally, you'll move from individual models to complete Bayesian workflows:
- Build posterior predictive distributions to evaluate rare events.
- Develop systematic approaches to model validation and criticism.
- Integrate Bayesian thinking into your broader modeling workflow.
- Reason clearly, act decisively, and manage uncertainty with confidence.
We recommend you run the notebooks on Colab, using the links above. But if you want to run locally, you'll need a working Python 3.11+ environment with PyMC and related packages. We've provided requirements files for Conda/pip, pixi, and uv, and we recommend them in that order.
Navigate to the repository and use the Makefile to create a Conda environment and install the requirements:
cd ai_decision_workshop
make create_environment
conda activate ai_decision_workshop
make requirements
Navigate to the repository and activate the environment:
cd ai_decision_workshop
pixi shell
Note: This option requires separate installation of GraphViz, which is used to display graphical representations of the models.
Navigate to the repository and create the environment:
cd ai_decision_workshop
uv venv
source .venv/bin/activate # macOS/Linux
# or
.venv\Scripts\activate # Windows
uv pip install -r requirements.txt
Install GraphViz:
- macOS:
brew install graphviz
- Ubuntu/Debian:
sudo apt-get install graphviz
- Windows: Download from GraphViz website
- Notebooks are located in the
notebooks/
folder. - Solutions are in the
soln/
folder.
Start with the notebooks in the notebooks/
folder and work through them in order.
Ready to build your Bayesian decision-making skills? Let's go. 🚀