Chapter 5

Linear discriminant analysis

LDA has two connected uses: classifying with shared-covariance Gaussian models and extracting directions that separate labelled classes. Fisher's criterion compares between-class separation with within-class spread.

5.1 Gaussian LDA and nearest means

Past papers · DA 2024–2026 (3 papers): 1 question, 2 marks

Let class cc have mean μc\boldsymbol\mu_c, prior πc>0\pi_c>0 and a common positive-definite covariance matrix Σ\boldsymbol\Sigma. The feature vector is x∈Rd\mathbf x\in\mathbb R^d. The following scores assume multivariate Gaussian class-conditionals.

Estimate class means from their observations. The pooled covariance maximum-likelihood estimate is Σ^=SW/n\hat{\boldsymbol\Sigma}=\mathbf S_W/n, where SW\mathbf S_W is defined in Section 5.2; the pooled unbiased estimate uses n−Cn-C. Use the divisor stated in the question. It can shift a boundary when priors are unequal. If the shared covariance is singular, the displayed inverse is unavailable without a specified modification.

With equal priors, choose the nearest mean in Mahalanobis distance. If also Σ=σ2I\boldsymbol\Sigma=\sigma^2\mathbf I, choose the nearest Euclidean mean. Unequal class covariances generally give quadratic boundaries; Gaussian naive Bayes only requires each covariance to be diagonal, not equal across classes.

5.2 Fisher projection and scatter

Past papers · DA 2024–2026 (3 papers): 1 question, 1 mark

Let xˉ\bar{\mathbf x} be the overall mean, ncn_c the class counts, and μc\boldsymbol\mu_c the class means. Scatter matrices are sums, not averaged covariance matrices.

The total scatter satisfies ST=SW+SB\mathbf S_T=\mathbf S_W+\mathbf S_B, where ST=∑i(xi−xˉ)(xi−xˉ)⊤\mathbf S_T=\sum_i(\mathbf x_i-\bar{\mathbf x})(\mathbf x_i-\bar{\mathbf x})^\top. There are at most min⁡(d,C−1)\min(d,C-1) nonzero discriminant directions. For two classes, SB=[n0n1/(n0+n1)](μ1−μ0)(μ1−μ0)⊤\mathbf S_B=[n_0n_1/(n_0+n_1)](\boldsymbol\mu_1-\boldsymbol\mu_0)(\boldsymbol\mu_1-\boldsymbol\mu_0)^\top. Omitting the positive count factor preserves the direction but changes ρ\rho.

Last-minute recall

  • Shared covariance makes Gaussian discriminant boundaries affine.
  • Equal priors remove the prior shift, but not covariance scaling.
  • Euclidean nearest means need spherical shared covariance and equal priors.
  • Fisher uses labels; PCA does not.
  • Scatter normalisation changes eigenvalues even when directions remain unchanged.
  • Binary Fisher LDA has at most one useful discriminant direction.

Revise offline: the whole Machine Learning handbook as one PDF

42 pages · 1.8 MBFree to read online. Sign in to download the PDF.We save the handbook, version and request time in My downloads. Privacy policy

All chapters · Corrections