Machine Learning: A Probabilistic PerspectiveΒΆ
This folder contains practical examples and implementations from Kevin Murphyβs βMachine Learning: A Probabilistic Perspectiveβ (MLPP). The book provides a comprehensive introduction to machine learning from a unified probabilistic perspective.
π OverviewΒΆ
The examples are organized by major topics from the book, focusing on hands-on implementation of key concepts and algorithms.
π Notebooks (13 Total)ΒΆ
Part I: Foundations (Chapters 2-5)ΒΆ
01_probability_fundamentals.ipynb - Probability theory basics, Bayesβ rule, probability distributions, information theory
02_generative_models.ipynb - Generative classifiers, Naive Bayes, discriminant analysis (Chapters 3-4)
03_gaussian_models.ipynb - Multivariate Gaussians, MVN inference, missing data, Gaussian mixtures
04_bayesian_statistics.ipynb - Bayesian inference, conjugate priors, posterior computation, empirical Bayes
Part II: Regression and Classification (Chapters 7-8)ΒΆ
05_linear_logistic_regression.ipynb - Linear regression (MLE, Ridge, Bayesian), Logistic regression, Softmax classification
Part III: Sparse Models and Regularization (Chapter 13)ΒΆ
06_sparse_linear_models.ipynb - Lasso, Elastic Net, coordinate descent, feature selection
Part IV: Kernel Methods and Gaussian Processes (Chapter 14)ΒΆ
07_kernels_gaussian_processes.ipynb - Kernel trick, kernel ridge regression, SVMs, GP regression
Part V: Graphical Models and Sequential Data (Chapters 10, 16-17)ΒΆ
08_graphical_models.ipynb - Bayesian networks, d-separation, Naive Bayes, Markov chains
09_hidden_markov_models.ipynb - HMMs, forward-backward algorithm, Viterbi decoding, Baum-Welch learning
Part VI: Sampling and Inference (Chapters 21-24)ΒΆ
10_mcmc_sampling.ipynb - Monte Carlo methods, Metropolis-Hastings, Gibbs sampling, convergence diagnostics
Part VII: Unsupervised Learning (Chapters 9, 11, 12, 25)ΒΆ
11_mixture_models_em.ipynb - Gaussian mixture models, EM algorithm, K-means, mixture of Bernoullis, BIC/AIC
12_dimensionality_reduction.ipynb - PCA, Probabilistic PCA, Factor Analysis, ICA, source separation
13_clustering.ipynb - K-means, hierarchical, spectral, DBSCAN, affinity propagation, evaluation metrics
π― Learning ObjectivesΒΆ
After working through these notebooks, you will:
Understand probability theory and Bayesian inference fundamentals
Implement generative and discriminative classification models
Work with graphical models, Bayesian networks, and HMMs
Apply sparse models, regularization, and feature selection
Use kernel methods, SVMs, and Gaussian processes
Perform Bayesian inference with MCMC sampling methods
Master unsupervised learning: clustering, dimensionality reduction, mixture models
Understand EM algorithm and its applications
Evaluate and compare different clustering algorithms
π Quick StartΒΆ
Step 1: Ensure you have the required dependencies:
pip install numpy scipy matplotlib scikit-learn pandas seaborn
Step 2: Start with the foundational notebooks (01-04) before moving to advanced topics
Step 3: Each notebook contains:
Theory overview
Code implementations
Visualizations
Practical examples
Exercises
π Book ReferenceΒΆ
Murphy, Kevin P. βMachine Learning: A Probabilistic Perspective.β MIT Press, 2012.
The PDF is available in: ../resources/ML Machine Learning-A Probabilistic Perspective.pdf
π‘ TipsΒΆ
The book uses MATLAB examples; these notebooks use Python equivalents
Focus on understanding probabilistic reasoning and Bayesian inference
Practice implementing algorithms from scratch before using libraries
Compare implementations with scikit-learn and other ML libraries
Follow the suggested order for foundational concepts, but feel free to explore topics independently
Each notebook is self-contained with theory, code, and visualizations
π Coverage SummaryΒΆ
This collection covers approximately 50% of Murphyβs MLPP book, focusing on:
β Foundations (probability, Bayesian statistics)
β Supervised learning (regression, classification)
β Unsupervised learning (clustering, dimensionality reduction, mixture models)
β Graphical models (Bayesian networks, HMMs)
β Kernel methods and Gaussian processes
β MCMC and sampling methods
β EM algorithm and latent variable models
Topics not yet covered:
Deep learning (Chapters 27-28)
Advanced variational inference
Advanced reinforcement learning
Some specialized models and techniques
π€ ContributingΒΆ
Feel free to add more examples or improve existing ones following the established format.