
Bayesian Methods for Hackers
A free, notebook-based introduction to Bayesian statistics taught through code, using PyMC.CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
- Stars
- 28.2k
- Forks
- 7.9k
- Licence
- MIT
- Language
- Jupyter Notebook
- Last update
- 2.4 years ago
- Type
- Learning resource
No commits in over a year — check for forks or alternatives before adopting.
What it is
This is an open book of Jupyter notebooks that teaches Bayesian inference by having readers run and modify Python code rather than starting with heavy probability theory. It uses the PyMC probabilistic programming library, along with NumPy, SciPy and Matplotlib, and its examples include inferring changes in text message rates and estimating the frequency of cheating students. The README says it is aimed at readers with less mathematical background who care more about practice than proofs.
- Read the notebooks online through the linked nbviewer pages to learn Bayesian concepts
- Clone the repository to run and change the example notebooks locally
- Work through the chapter examples, such as the Price is Right showdown or the Challenger disaster probability
- Compare the PyMC2 and PyMC3 versions of the chapters to see how the code differs
Great for
- Programmers who know some Python and want to learn Bayesian methods by doing
- Students who find traditional statistics textbooks too abstract
- People who want a hands-on introduction to PyMC
- Data practitioners who want practical examples of priors and MCMC
Not ideal for
- Readers who want rigorous mathematical derivations, since the README says the book prioritizes computation and understanding over mathematics
- Readers looking for a reference manual for PyMC's current API, since the README points to the official documentation for that and the notebooks are organized by PyMC2 and PyMC3 versions
How to get it
- 1
Clone and build from source
You'll need: Python · Jupyter Notebook
Clone the repository
git clone https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers.git - 2
Run it
- Read chapters directly in your browser via the nbviewer links in the README, with no install needed
- Or clone the repository and open the notebooks in Jupyter
- Start with the Prologue and Chapter 1 notebooks
- Install PyMC, NumPy, SciPy and Matplotlib before running the code cells
- 3
Get the most out of it
- Read the printed edition's additional chapter on Bayesian A/B testing if you can get it, as the README lists it as an extra
- Use the project homepage linked in the README for additional examples
- Edit the notebook code to change priors and data and observe how the results change
Downloads
Strengths
- Free to read online, and the notebooks can be downloaded and run
- Code-first approach with many worked examples
- MIT licensed and widely used, with about 28,000 stars
Trade-offs
- The README's chapter listing is organized around PyMC2 and PyMC3, and the content may be dated relative to current PyMC releases
- The README says a printed version exists with extra material, so the online version is not the complete edition
- No formal release is listed, so there is no versioned download to pin
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| Probabilistic-Programming-and-Bayesian-Methods-for-Hackers (this) | 28.2k | Learning resource | beginner | 2.4 years ago | Programmers who know some Python and want to learn Bayesian methods by doing |
| fg-data-profiling | 13.7k | Library | beginner | 6 days ago | Analysts who want a quick first look at an unfamiliar dataset |
| PythonDataScienceHandbook | 50.3k | Learning resource | beginner | 2.4 years ago | Students learning NumPy, Pandas, Matplotlib, or Scikit-Learn through hands-on examples |
| Data-Science-For-Beginners | 37.9k | Learning resource | beginner | 16 days ago | Complete beginners who want a guided, week-by-week data science course |
| homemade-machine-learning | 24.8k | Learning resource | beginner | 12 months ago | Students learning the math behind machine learning algorithms |
| ML-For-Beginners | 91.9k | Learning resource | beginner | 5 days ago | Beginners who want a structured, self-paced introduction to machine learning |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.