Preface VII Mathematical Notation Xi Contents Xiii
Preface VII Mathematical Notation Xi Contents Xiii
Preface vii
Mathematical notation xi
Contents xiii
1 Introduction 1
1.1 Example: Polynomial Curve Fitting . . . . . . . . . . . . . . . . . 4
1.2 Probability Theory . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2.1 Probability densities . . . . . . . . . . . . . . . . . . . . . 17
1.2.2 Expectations and covariances . . . . . . . . . . . . . . . . 19
1.2.3 Bayesian probabilities . . . . . . . . . . . . . . . . . . . . 21
1.2.4 The Gaussian distribution . . . . . . . . . . . . . . . . . . 24
1.2.5 Curve fitting re-visited . . . . . . . . . . . . . . . . . . . . 28
1.2.6 Bayesian curve fitting . . . . . . . . . . . . . . . . . . . . 30
1.3 Model Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1.4 The Curse of Dimensionality . . . . . . . . . . . . . . . . . . . . . 33
1.5 Decision Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.5.1 Minimizing the misclassification rate . . . . . . . . . . . . 39
1.5.2 Minimizing the expected loss . . . . . . . . . . . . . . . . 41
1.5.3 The reject option . . . . . . . . . . . . . . . . . . . . . . . 42
1.5.4 Inference and decision . . . . . . . . . . . . . . . . . . . . 42
1.5.5 Loss functions for regression . . . . . . . . . . . . . . . . . 46
1.6 Information Theory . . . . . . . . . . . . . . . . . . . . . . . . . . 48
1.6.1 Relative entropy and mutual information . . . . . . . . . . 55
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
xiii
xiv CONTENTS
2 Probability Distributions 67
2.1 Binary Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.1.1 The beta distribution . . . . . . . . . . . . . . . . . . . . . 71
2.2 Multinomial Variables . . . . . . . . . . . . . . . . . . . . . . . . 74
2.2.1 The Dirichlet distribution . . . . . . . . . . . . . . . . . . . 76
2.3 The Gaussian Distribution . . . . . . . . . . . . . . . . . . . . . . 78
2.3.1 Conditional Gaussian distributions . . . . . . . . . . . . . . 85
2.3.2 Marginal Gaussian distributions . . . . . . . . . . . . . . . 88
2.3.3 Bayes theorem for Gaussian variables . . . . . . . . . . . . 90
2.3.4 Maximum likelihood for the Gaussian . . . . . . . . . . . . 93
2.3.5 Sequential estimation . . . . . . . . . . . . . . . . . . . . . 94
2.3.6 Bayesian inference for the Gaussian . . . . . . . . . . . . . 97
2.3.7 Students t-distribution . . . . . . . . . . . . . . . . . . . . 102
2.3.8 Periodic variables . . . . . . . . . . . . . . . . . . . . . . . 105
2.3.9 Mixtures of Gaussians . . . . . . . . . . . . . . . . . . . . 110
2.4 The Exponential Family . . . . . . . . . . . . . . . . . . . . . . . 113
2.4.1 Maximum likelihood and sufficient statistics . . . . . . . . 116
2.4.2 Conjugate priors . . . . . . . . . . . . . . . . . . . . . . . 117
2.4.3 Noninformative priors . . . . . . . . . . . . . . . . . . . . 117
2.5 Nonparametric Methods . . . . . . . . . . . . . . . . . . . . . . . 120
2.5.1 Kernel density estimators . . . . . . . . . . . . . . . . . . . 122
2.5.2 Nearest-neighbour methods . . . . . . . . . . . . . . . . . 124
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
3 Linear Models for Regression 137
3.1 Linear Basis Function Models . . . . . . . . . . . . . . . . . . . . 138
3.1.1 Maximum likelihood and least squares . . . . . . . . . . . . 140
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
CONTENTS xvii
8 Graphical Models 359
8.1 Bayesian Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 360
8.1.1 Example: Polynomial regression . . . . . . . . . . . . . . . 362
8.1.2 Generative models . . . . . . . . . . . . . . . . . . . . . . 365
8.1.3 Discrete variables . . . . . . . . . . . . . . . . . . . . . . . 366
8.1.4 Linear-Gaussian models . . . . . . . . . . . . . . . . . . . 370
8.2 Conditional Independence . . . . . . . . . . . . . . . . . . . . . . 372
8.2.1 Three example graphs . . . . . . . . . . . . . . . . . . . . 373
8.2.2 D-separation . . . . . . . . . . . . . . . . . . . . . . . . . 378
8.3 Markov Random Fields . . . . . . . . . . . . . . . . . . . . . . . 383
8.3.1 Conditional independence properties . . . . . . . . . . . . . 383
8.3.2 Factorization properties . . . . . . . . . . . . . . . . . . . 384
8.3.3 Illustration: Image de-noising . . . . . . . . . . . . . . . . 387
8.3.4 Relation to directed graphs . . . . . . . . . . . . . . . . . . 390
8.4 Inference in Graphical Models . . . . . . . . . . . . . . . . . . . . 393
8.4.1 Inference on a chain . . . . . . . . . . . . . . . . . . . . . 394
8.4.2 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
8.4.3 Factor graphs . . . . . . . . . . . . . . . . . . . . . . . . . 399
8.4.4 The sum-product algorithm . . . . . . . . . . . . . . . . . . 402
8.4.5 The max-sum algorithm . . . . . . . . . . . . . . . . . . . 411
8.4.6 Exact inference in general graphs . . . . . . . . . . . . . . 416
8.4.7 Loopy belief propagation . . . . . . . . . . . . . . . . . . . 417
8.4.8 Learning the graph structure . . . . . . . . . . . . . . . . . 418
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
9 Mixture Models and EM 423
9.1 K-means Clustering . . . . . . . . . . . . . . . . . . . . . . . . . 424
9.1.1 Image segmentation and compression . . . . . . . . . . . . 428
9.2 Mixtures of Gaussians . . . . . . . . . . . . . . . . . . . . . . . . 430
9.2.1 Maximum likelihood . . . . . . . . . . . . . . . . . . . . . 432
9.2.2 EM for Gaussian mixtures . . . . . . . . . . . . . . . . . . 435
9.3 An Alternative View of EM . . . . . . . . . . . . . . . . . . . . . 439
9.3.1 Gaussian mixtures revisited . . . . . . . . . . . . . . . . . 441
9.3.2 Relation to K-means . . . . . . . . . . . . . . . . . . . . . 443
9.3.3 Mixtures of Bernoulli distributions . . . . . . . . . . . . . . 444
9.3.4 EM for Bayesian linear regression . . . . . . . . . . . . . . 448
9.4 The EM Algorithm in General . . . . . . . . . . . . . . . . . . . . 450
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
10 Approximate Inference 461
10.1 Variational Inference . . . . . . . . . . . . . . . . . . . . . . . . . 462
10.1.1 Factorized distributions . . . . . . . . . . . . . . . . . . . . 464
10.1.2 Properties of factorized approximations . . . . . . . . . . . 466
10.1.3 Example: The univariate Gaussian . . . . . . . . . . . . . . 470
10.1.4 Model comparison . . . . . . . . . . . . . . . . . . . . . . 473
10.2 Illustration: Variational Mixture of Gaussians . . . . . . . . . . . . 474
xviii CONTENTS
10.2.1 Variational distribution . . . . . . . . . . . . . . . . . . . . 475
10.2.2 Variational lower bound . . . . . . . . . . . . . . . . . . . 481
10.2.3 Predictive density . . . . . . . . . . . . . . . . . . . . . . . 482
10.2.4 Determining the number of components . . . . . . . . . . . 483
10.2.5 Induced factorizations . . . . . . . . . . . . . . . . . . . . 485