∑GATE DA Atlas

Linear Discriminant Analysis

LDA as a generative classifier with Gaussian class-conditional densities and a shared covariance matrix, the linear discriminant functions and decision boundaries, the one-dimensional case and the effect of priors, quadratic discriminant analysis when covariances differ, Fisher's LDA as supervised dimensionality reduction (between- vs within-class scatter), and comparisons with logistic regression and PCA.

Section 68 practice questions

LDA as a classifier

LDA is a generative model: it models how each class generates its features, then classifies with Bayes' theorem.

  • Prior: P(y=k)=πkP(y = k) = \pi_k (estimated by class proportions).
  • Class-conditional density: x∣y=k∼N(μk,Σ)\mathbf x \mid y = k \sim N(\boldsymbol\mu_k, \Sigma) — Gaussian with a class-specific mean and a shared covariance.

Classify by the largest posterior, i.e. the largest discriminant function (log of πk p(x∣k)\pi_k\,p(\mathbf x\mid k) with common terms dropped):

δk(x)=x⊤Σ−1μk−12μk⊤Σ−1μk+ln⁡πk.\delta_k(\mathbf x) = \mathbf x^\top\Sigma^{-1}\boldsymbol\mu_k - \frac12\boldsymbol\mu_k^\top\Sigma^{-1}\boldsymbol\mu_k + \ln\pi_k.

δk\delta_k is linear in x\mathbf x, so the boundary {δk=δj}\{\delta_k = \delta_j\} between any two classes is a hyperplane.

Estimation: π^k=nk/n\hat\pi_k = n_k/n, μ^k\hat{\boldsymbol\mu}_k = class sample mean, Σ^\hat\Sigma = pooled within-class covariance 1n−K∑k∑i∈k(xi−μ^k)(xi−μ^k)⊤\frac{1}{n - K}\sum_k\sum_{i\in k}(\mathbf x_i - \hat{\boldsymbol\mu}_k)(\mathbf x_i - \hat{\boldsymbol\mu}_k)^\top.

The one-dimensional case

With means μ1,μ2\mu_1, \mu_2, common variance σ2\sigma^2 and priors π1,π2\pi_1, \pi_2, the boundary is

x∗=μ1+μ22+σ2μ2−μ1ln⁡π1π2.x^* = \frac{\mu_1 + \mu_2}{2} + \frac{\sigma^2}{\mu_2 - \mu_1}\ln\frac{\pi_1}{\pi_2}.

Equal priors give the midpoint; a larger prior for class 1 pushes the boundary towards class 2.

class 1class 2 equal priors: boundary at the midpoint (μ₁ + μ₂)/2
Same-shape Gaussians: the posterior is equal where the (prior-weighted) densities cross.

Quadratic discriminant analysis (QDA)

If each class has its own covariance Σk\Sigma_k, the quadratic terms no longer cancel:

δk(x)=−12ln⁡∣Σk∣−12(x−μk)⊤Σk−1(x−μk)+ln⁡πk,\delta_k(\mathbf x) = -\frac12\ln\lvert\Sigma_k\rvert - \frac12(\mathbf x - \boldsymbol\mu_k)^\top\Sigma_k^{-1}(\mathbf x - \boldsymbol\mu_k) + \ln\pi_k,

giving quadratic boundaries. QDA is more flexible (lower bias) but estimates Kd(d+1)2K\frac{d(d+1)}{2} covariance parameters (higher variance). Gaussian naive Bayes is QDA with diagonal covariances.

ModelCovarianceBoundaryParameters (covariance)
LDAshared Σ\Sigmalineard(d+1)2\frac{d(d+1)}{2}
QDAΣk\Sigma_k per classquadraticKd(d+1)2K\frac{d(d+1)}{2}
Gaussian NBdiagonal Σk\Sigma_kquadratic (axis-aligned)KdKd

Fisher's LDA: supervised dimensionality reduction

Find a projection z=w⊤xz = \mathbf w^\top\mathbf x that separates the class means while keeping each class compact. For two classes, maximise Fisher's criterion

J(w)=(w⊤(m1−m2))2w⊤SWw=w⊤SBww⊤SWw,J(\mathbf w) = \frac{(\mathbf w^\top(\mathbf m_1 - \mathbf m_2))^2}{\mathbf w^\top S_W\mathbf w} = \frac{\mathbf w^\top S_B\mathbf w}{\mathbf w^\top S_W\mathbf w},

with within-class scatter SW=∑k∑i∈k(xi−mk)(xi−mk)⊤S_W = \sum_k\sum_{i\in k}(\mathbf x_i - \mathbf m_k)(\mathbf x_i - \mathbf m_k)^\top and between-class scatter SB=(m1−m2)(m1−m2)⊤S_B = (\mathbf m_1 - \mathbf m_2)(\mathbf m_1 - \mathbf m_2)^\top. The solution is

w∝SW−1(m1−m2).\mathbf w \propto S_W^{-1}(\mathbf m_1 - \mathbf m_2).

For KK classes, the directions are the top eigenvectors of SW−1SBS_W^{-1}S_B, at most K−1K - 1 of them. Under LDA's Gaussian assumptions, classifying in this projected space is equivalent to the LDA classifier.

PCA: max total variance LDA: separates classes projecting on the PCAdirection mixes the classes;LDA's direction keeps them apart
PCA finds the direction of largest spread; LDA finds the direction that separates labelled classes.
LDALogistic regressionPCA
Uses labelsyesyesno
Modelsp(x∣y)p(\mathbf x\mid y), P(y)P(y) (generative)P(y∣x)P(y\mid\mathbf x) (discriminative)covariance of x\mathbf x
Outputclass + projectionclass probabilitiesprojection
AssumptionsGaussian classes, shared covariancelinear log-oddsnone (linear structure)

Quick revision

Practice questions

GATE-style questions: 2 one-mark and 6 two-mark. Wrong MCQs cost ⅓ of their marks in the real exam; MSQ and NAT have no negative marking. Attempt each before opening the solution.

Q1NAT2 marks

A one-dimensional LDA model has class means μ1=0\mu_1 = 0 and μ2=4\mu_2 = 4, common variance σ2=1\sigma^2 = 1 and equal priors. The decision boundary is at x=x = ______.

Q2NAT2 marks

Same model (μ1=0\mu_1 = 0, μ2=4\mu_2 = 4, σ2=1\sigma^2 = 1) but with priors π1=0.8\pi_1 = 0.8 and π2=0.2\pi_2 = 0.2. The decision boundary is at x=x = ______ (round to two decimals).

Q3MCQ1 mark

LDA produces linear decision boundaries because it assumes

Q4NAT2 marks

Two classes have within-class scatter matrix SW=(2001)S_W = \begin{pmatrix}2&0\\0&1\end{pmatrix} and mean difference m1−m2=(4,2)⊤\mathbf m_1 - \mathbf m_2 = (4, 2)^\top. Fisher's discriminant direction is w∝SW−1(m1−m2)\mathbf w \propto S_W^{-1}(\mathbf m_1 - \mathbf m_2). The ratio w1/w2w_1/w_2 is ______.

Q5NAT1 mark

For a classification problem with 4 classes and 10 features, the maximum number of useful Fisher discriminant directions (LDA components) is ______.

Q6MSQ2 marks

Which statements are correct?

One or more options are correct.

Q7MCQ2 marks

Compared with logistic regression, LDA

Q8NAT2 marks

LDA with d=10d = 10 features estimates one shared covariance matrix. The number of distinct parameters in that symmetric covariance matrix is ______.