Course · Lecture notes, demonstrations and code

Bayesian and Probabilistic Machine Learning

Mathematical foundations, demonstrations and code

A course that follows Christopher Bishop's Pattern Recognition and Machine Learning (Springer, 2006) chapter by chapter. It covers the whole book, from the first chapters on regression, classification, neural networks and kernel methods to graphical models and belief propagation, mixture models and the EM algorithm, approximate (variational) inference and expectation propagation, Monte Carlo sampling and Markov chain Monte Carlo, continuous latent variables from PCA to kernel PCA, hidden Markov models and Kalman filters, and ways of combining models from boosting to mixtures of experts.

TrungTin Nguyen · Teaching page · Homepage

What each chapter offers

Lecture notes that fill the gaps. The notes follow the book section by section and use its equation numbers. Wherever the book says that a result "can be shown", is "easily verified" or is left to an exercise, the notes write out the whole argument, hidden until you open it.

Every numerical figure, reproduced. The Python code rebuilds the chapter's numerical experiments from scratch with numpy, scipy and matplotlib. The notes show these reproductions, and each module comes with numerical checks of the derivations.

Demonstrations tied to results. Thirty-nine browser demonstrations let you run the algorithms step by step. The notes open each one already set to the case being discussed, and each demonstration links back to the notes.

Before you start

Prerequisites. Linear algebra (eigenvectors, determinants, positive definite matrices), multivariable calculus, and elementary probability. The course is self-contained and builds on itself: it starts at Chapter 1, and each chapter lists the earlier chapters and sections it uses, as links. Readers who already know the material can start at any chapter. The identities used most often are proved once in the mathematical toolkit.

The book. Bishop's book is available as a free PDF from Microsoft Research. Keep it open next to the notes: section, equation, figure and exercise numbers match.

Chapters

Chapter 1

Introduction

Polynomial curve fitting and over-fitting, probability theory, the curse of dimensionality, decision theory and information theory.

Chapter 2

Probability Distributions

Binomial, beta, multinomial, Dirichlet and Gaussian distributions, conjugate Bayesian inference, the exponential family and nonparametric density estimation.

Chapter 3

Linear Models for Regression

Least squares and ridge regression, the bias-variance decomposition, Bayesian linear regression, the equivalent kernel and the evidence approximation.

Chapter 4

Linear Models for Classification

Discriminant functions, Fisher's discriminant, the perceptron, generative and discriminative models, logistic regression with IRLS, the Laplace approximation and Bayesian logistic regression.

Chapter 5

Neural Networks

Network functions, training, backpropagation and the Hessian, regularisation, mixture density networks and Bayesian neural networks.

Chapter 6

Kernel Methods

Dual representations, constructing kernels, radial basis function networks and Gaussian processes for regression and classification.

Chapter 7

Sparse Kernel Machines

Maximum margin classifiers, support vector machines for classification and regression, and the relevance vector machine.

Chapter 8

Graphical Models

Bayesian networks and Markov random fields, conditional independence and d-separation, factor graphs, the sum-product and max-sum algorithms, and loopy belief propagation.

Chapter 9

Mixture Models and EM

K-means, Gaussian mixtures by maximum likelihood, the EM algorithm in general and why it never decreases the likelihood, Bernoulli mixtures, EM for Bayesian linear regression.

Chapter 10

Approximate Inference

Variational inference and mean field, the variational mixture of Gaussians, variational linear and logistic regression, local variational bounds, and expectation propagation.

Chapter 11

Sampling Methods

Transformation and rejection sampling, importance sampling and SIR, Monte Carlo EM, Markov chains, Metropolis–Hastings, Gibbs sampling, slice sampling, Hamiltonian (hybrid) Monte Carlo, and estimating partition functions.

Chapter 12

Continuous Latent Variables

PCA by maximum variance and minimum error, probabilistic PCA and its maximum-likelihood solution, EM for PCA, Bayesian PCA, factor analysis, kernel PCA, and nonlinear latent variable models.

Chapter 13

Sequential Data

Markov models, hidden Markov models with forward-backward, scaling, Viterbi and Baum-Welch, linear dynamical systems with the Kalman filter and smoother, and particle filters.

Chapter 14

Combining Models

Bayesian model averaging versus combination, committees and bagging, AdaBoost as stagewise minimisation of the exponential error, decision trees, and conditional mixtures up to mixtures of experts.

Shared resources

Toolkit

Mathematical toolkit

Jensen's inequality, KL divergence, Lagrange multipliers, matrix derivatives, the Woodbury identity, Gaussian identities, exponential families, and the Gamma, Dirichlet, Wishart and Student t distributions, each with a proof.

Python

Code that reproduces the figures

One module per chapter, one function per figure, readable implementations of every algorithm, and numerical checks of the derivations. Runs with numpy, scipy and matplotlib.

Using the material in class

  1. Before the lecture, students read a section of the book and the matching section of the notes, with the derivations closed.
  2. In the lecture, state a result, ask the class to predict what it implies, then open the demonstration at the linked preset and test the prediction.
  3. In the tutorial, open the derivations one at a time and work through the book exercises in the Exercises section of each chapter.
  4. For assignments, students change one setting in the Python code (a prior, an initialisation, a data set) and explain what changes in the figure.