Danuzco/bayesian-modelling-notes
Danuzco/bayesian-modelling-notes has 52 GitHub stars and 6 forks. GitHot measured +7 stars in 24 hours. Last checked 2026-11-17 03:53 UTC. Last push 2026-11-15.
Crecimiento de estrellas medido
- in 24h
- +7
- in 7 days
- Actualización retrasada
- in 15 days
- Actualización retrasada
- in 1 month
- Actualización retrasada
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
Acerca de
Handwritten lecture notes and Jupyter notebooks for the Bayesian Modelling course of the Doctorado en Inteligencia Artificial (Chile): probability, conjugate models, Kalman filters, Gaussian processes, MCMC, variational inference, hierarchical models.
Aprendizaje automáticoREADME.md
OriginalBayesian Modelling — Handwritten Lecture Notes
Lecture notes and code for the Bayesian Modelling course of the Doctorado en Inteligencia Artificial (PhD in Artificial Intelligence), Chile
by Daniel Uzcategui, PhD in Physics

About
[!NOTE] The course is in progress. New lectures, notebooks and corrections are added as they are taught. Star or watch the repository to follow along.
These are the notes I wrote by hand, on an iPad, while preparing and teaching Bayesian Modelling for the Doctorado en Inteligencia Artificial (my profile).
The notebooks also work as an introduction to probabilistic inference in JAX:
Hamiltonian Monte Carlo and variational inference are written from scratch, with
gradients from jax.grad and speed from jit and vmap, without a probabilistic
programming library. Then the same ideas are used through PyMC, up to
hierarchical models.
The course goes from the foundations (sets, probability, random variables) to the tools used in modern probabilistic machine learning: conjugate models, Kalman filtering, Gaussian processes, MCMC, variational inference and hierarchical models.
Course map
| # | Lecture | Highlights | Notes | Code |
|---|---|---|---|---|
| 1 | Set Theory | sets, subsets, power sets, Cartesian products, set identities, De Morgan | PDF · 24 pp · typeset | — |
| 2 | Probability | axioms, interpretations of probability, counting, independence, conditional probability, total probability, Bayes' theorem | PDF · 35 pp · typeset | — |
| 3 | Random Variables | PMF/PDF/CDF, Bernoulli → Poisson (derived from first principles), exponential, normal, joint and conditional distributions, expectation, variance, covariance | PDF · 64 pp · typeset | — |
| 4 | Classical Inference | maximum likelihood, confidence intervals, hypothesis testing | PDF · 14 pp · typeset | — |
| 5 | Bayesian Statistics | posterior and predictive distributions, Beta–Binomial, Gaussian–Gaussian, Normal–Inv-χ², exponential family, multivariate normal, linear Gaussian systems, model selection | PDF · 67 pp | 1 notebook |
| 6 | Kalman Filters | state-space models, Bayesian filtering equations, full Kalman derivation (Woodbury identity), forecasting | PDF · 18 pp | 1 notebook |
| 7 | Gaussian Processes | Bayesian linear regression, GP prior and posterior, prediction at new inputs, kernels | PDF · 17 pp | 1 notebook |
| 8 | Markov Chain Monte Carlo | sampling instead of integrating, Metropolis–Hastings and detailed balance, Hamiltonian Monte Carlo, leapfrog, Gelman–Rubin R̂ | PDF · 20 pp | 3 notebooks |
| 9 | Variational Inference | KL divergence, ELBO via Jensen, mean-field VI, ADVI, score-function gradients | PDF · 11 pp · typeset | 1 notebook |
| 10 | Hierarchical Models | complete, no and partial pooling, plate diagrams, the eight-schools model | PDF · 10 pp · typeset | 1 notebook |
Lectures 1–4, 9 and 10 also have a typeset LaTeX version, with its source in each folder's latex/. Each lecture folder has its own README with a short outline and a description of its notebooks.
How the lectures connect
flowchart LR
L1[1 · Set Theory] --> L2[2 · Probability] --> L3[3 · Random Variables]
L3 --> L4[4 · Classical Inference]
L3 --> L5[5 · Bayesian Statistics]
L4 -. contrast .-> L5
L5 -->|linear Gaussian systems| L6[6 · Kalman Filters]
L5 -->|Bayesian linear regression| L7[7 · Gaussian Processes]
L5 -->|non-conjugate posteriors| L8[8 · MCMC]
L5 -->|non-conjugate posteriors| L9[9 · Variational Inference]
L8 --> L10[10 · Hierarchical Models]
L9 --> L10
Code
| Lecture | Notebook | What it does |
|---|---|---|
| 5 | gaussian_2d_inference |
Posterior of a 2D Gaussian mean with known Σ, as a special case of a linear Gaussian system (Iris setosa data) |
| 6 | nile_kalman |
Local-level Kalman filter for the annual flow of the Nile |
| 7 | gp_linear_and_nonlinear |
GP regression: a linear kernel reproduces Bayesian linear regression, then a Gaussian kernel fits a nonlinear function |
| 8 | metropolis_hastings |
Inverse-CDF and Cholesky sampling, then Metropolis–Hastings on a banana-shaped target |
| 8 | hmc |
Hamiltonian Monte Carlo from scratch, with gradients from JAX |
| 8 | intro_pymc |
First PyMC model: NUTS samples checked against the closed-form Gaussian posterior |
| 9 | variational_inference |
Variational inference written from scratch in JAX: a Gaussian-mixture family fitted to a banana posterior by maximizing a Monte Carlo ELBO |
| 10 | hierarchical_model |
Eight-schools hierarchical model in PyMC (non-centred), MCMC compared with ADVI |
The notebooks are saved with their outputs, so plots and results show on GitHub without running anything.
Run them locally
git clone https://github.com/Danuzco/bayesian-modelling-notes.git
cd bayesian-modelling-notes
conda env create -f environment.yml
conda activate bayesian-modelling
jupyter lab
Or with pip: pip install -r requirements.txt.
Repository layout
bayesian-modelling-notes/
├── lecture01_set_theory/
│ ├── lecture01_set_theory.pdf # handwritten notes
│ ├── lecture01_set_theory_typeset.pdf # typeset version (Lectures 1–4, 9, 10)
│ ├── latex/ # LaTeX source of the typeset version
│ └── README.md # outline of the lecture
├── ...
├── lecture05_bayesian_statistics/
│ ├── lecture05_bayesian_statistics.pdf
│ ├── README.md
│ └── code/ # notebooks for this lecture
├── ...
├── environment.yml / requirements.txt
├── LICENSE # MIT, for the code
└── NOTES_LICENSE.md # CC BY 4.0, for the notes
A note on the notes
These are working notes written during the course, not a polished textbook. Some sections end early and a few pages mix in Spanish, the language the course is taught in. If you find a mistake, please open an issue. Corrections are welcome.
License and citation
- Notes (PDFs): Creative Commons Attribution 4.0. You can share and adapt them with credit.
- Code (notebooks): MIT.
If these notes help your teaching or research, you can cite them with the
"Cite this repository" button on GitHub (see CITATION.cff).