Course · Python code

Python code that reproduces the figures

One module per chapter of Murphy, Probabilistic Machine Learning: Advanced Topics (2023), with one function per figure, linked to the lecture notes. The code is written for this course with numpy, scipy, pandas, matplotlib, scikit-learn and PyTorch.

How to run it

  1. Install Python 3 with numpy, scipy, pandas, matplotlib, scikit-learn and PyTorch (CPU is enough).
  2. Run one chapter with python3 ch12_mcmc.py, list its figures with --list, make one with --fig 12.1, or run every chapter with python3 make_all.py --figures.

Data come from scikit-learn's bundled data sets, small files in data/, and simulation; slow results are cached locally. Each figure is written to img/chNN/ as PNG, SVG and PDF. Shared helpers are in common.py.

Chapter 1. Introduction

Module: ch01_introduction.py · Notes: Introduction

1 figures

Chapter 2. Probability

Module: ch02_probability.py · Notes: Probability

23 figures

Chapter 3. Statistics

Module: ch03_statistics.py · Notes: Statistics

30 figures

Chapter 4. Graphical models

Module: ch04_graphical_models.py · Notes: Graphical models

17 figures

Chapter 5. Information theory

Module: ch05_information_theory.py · Notes: Information theory

13 figures

Chapter 6. Optimization

Module: ch06_optimization.py · Notes: Optimization

25 figures

Chapter 7. Inference algorithms: an overview

Module: ch07_inference_overview.py · Notes: Inference algorithms: an overview

6 figures

Chapter 8. Gaussian filtering and smoothing

Module: ch08_gaussian_filtering_smoothing.py · Notes: Gaussian filtering and smoothing

14 figures

Chapter 9. Message passing algorithms

Module: ch09_message_passing.py · Notes: Message passing algorithms

14 figures

Chapter 10. Variational inference

Module: ch10_variational_inference.py · Notes: Variational inference

17 figures

Chapter 11. Monte Carlo methods

Module: ch11_monte_carlo.py · Notes: Monte Carlo methods

9 figures

Chapter 12. Markov chain Monte Carlo

Module: ch12_mcmc.py · Notes: Markov chain Monte Carlo

22 figures

Chapter 13. Sequential Monte Carlo

Module: ch13_sequential_monte_carlo.py · Notes: Sequential Monte Carlo

15 figures

Chapter 14. Predictive models: an overview

Module: ch14_predictive_models_overview.py · Notes: Predictive models: an overview

5 figures

Chapter 15. Generalized linear models

Module: ch15_generalized_linear_models.py · Notes: Generalized linear models

18 figures

Chapter 16. Deep neural networks

Module: ch16_deep_neural_networks.py · Notes: Deep neural networks

3 figures

Chapter 17. Bayesian neural networks

Module: ch17_bayesian_neural_networks.py · Notes: Bayesian neural networks

17 figures

Chapter 18. Gaussian processes

Module: ch18_gaussian_processes.py · Notes: Gaussian processes

30 figures

Chapter 19. Beyond the iid assumption

Module: ch19_beyond_iid.py · Notes: Beyond the iid assumption

12 figures

Chapter 20. Generative models: an overview

Module: ch20_generative_models_overview.py · Notes: Generative models: an overview

3 figures

Chapter 21. Variational autoencoders

Module: ch21_variational_autoencoders.py · Notes: Variational autoencoders

9 figures

Chapter 22. Autoregressive models

Module: ch22_autoregressive_models.py · Notes: Autoregressive models

3 figures

Chapter 23. Normalizing flows

Module: ch23_normalizing_flows.py · Notes: Normalizing flows

4 figures

Chapter 24. Energy-based models

Module: ch24_energy_based_models.py · Notes: Energy-based models

8 figures

Chapter 25. Diffusion models

Module: ch25_diffusion_models.py · Notes: Diffusion models

11 figures

Chapter 26. Generative adversarial networks

Module: ch26_gans.py · Notes: Generative adversarial networks

13 figures

Chapter 27. Discovery methods: an overview

Module: ch27_discovery_overview.py · Notes: Discovery methods: an overview

1 figures

Chapter 28. Latent factor models

Module: ch28_latent_factor_models.py · Notes: Latent factor models

22 figures

Chapter 29. State-space models

Module: ch29_state_space_models.py · Notes: State-space models

21 figures

Chapter 30. Graph learning

Module: ch30_graph_learning.py · Notes: Graph learning

18 figures

Chapter 31. Nonparametric Bayesian models

Module: ch31_nonparametric_bayes.py · Notes: Nonparametric Bayesian models

15 figures

Chapter 32. Representation learning

Module: ch32_representation_learning.py · Notes: Representation learning

8 figures

Chapter 33. Interpretability

Module: ch33_interpretability.py · Notes: Interpretability

8 figures

Chapter 34. Decision making under uncertainty

Module: ch34_decision_making.py · Notes: Decision making under uncertainty

15 figures

Chapter 35. Reinforcement learning

Module: ch35_reinforcement_learning.py · Notes: Reinforcement learning

9 figures

Chapter 36. Causality

Module: ch36_causality.py · Notes: Causality

12 figures