Skip to content
StackDecode
AI & ML Atlas
Machine LearningalgorithmInteractive simulation

Linear Discriminant Analysis (LDA)

Classifies using a straight boundary between class averages, assuming equal spread.

The idea

LDA models each class as a Gaussian with its own mean but one shared covariance. Under that assumption, the boundary between classes is a straight line placed between the class means, adjusted for the spread of the data. It is simple, fast and has a closed form.

δₖ(x) = xᵀΣ⁻¹μₖ − ½μₖᵀΣ⁻¹μₖ + ln πₖ

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • class 0
  • class 1

All the data starts in one box. The tree will ask yes/no questions to separate the classes.

impurity:
0.5
1/4

Every cut is axis-aligned, so each region is a rectangle. Deeper trees carve finer boxes and can overfit.

Step by step

  1. 1Compute each class mean and the pooled covariance.
  2. 2For a point compute a discriminant score for each class.
  3. 3Choose the class with the highest score.
  4. 4The boundary is where two scores are equal, which is a line.

Where it is used

Small datasets with roughly Gaussian classes, face recognition (Fisherfaces).

Watch out for

Poor if classes have very different shapes; QDA can handle that.

Related