Linear Discriminant Analysis
Linear Discriminant Analysis finds the linear combination of predictors that best separates classes, via Fisher's criterion and scatter matrices.
4 min read · Updated August 8, 2026
Linear Discriminant Analysis (LDA), introduced by R. A. Fisher in 1936, searches for a linear combination of the predictors that best separates two classes. It is simple, mathematically robust, and — when the classes are roughly Gaussian with shared covariance — often as accurate as far more complex methods.
Unlike logistic regression, which models the posterior probability directly, LDA models each class distribution and derives the separating boundary from their geometry.
Fisher’s criterion
The idea: project the data onto a direction so that the projected class means are far apart while the projected within-class scatter is small. Fisher captured this as a score to maximize — the ratio of between-class scatter to within-class scatter:
For two classes with means and :
Maximizing has a closed-form solution — no iterative fitting required:
A new point is classified by projecting it onto this maximally separating direction and comparing the score against a threshold derived from the projected class means and priors: assign if , otherwise .
Worked example: small-business default
A bank provides data on small-business clients who defaulted and those who did not, described by two predictors: delinquent days (DAYSDELQ) and months in business (BUSAGE). LDA fits the optimal linear model separating default (Y) from non-default (N).

The computation proceeds in three steps:
- Class statistics. Compute the mean vector and covariance matrix of each class, plus the class priors.
- Pooled covariance. Average the class covariances into a single pooled matrix and invert it.
- Coefficients. The discriminant direction is , giving a linear score in the two predictors.
For this dataset the Mahalanobis distance between the classes is 2.32 — modest but usable separation. Scoring each client and classifying N when the score exceeds the threshold of −1.1, the model misclassifies just 2 of the training cases.
Which predictors matter?
Correlate each predictor with the model’s discriminant scores. A correlation near −1 or 1 means the predictor drives the separation (the sign only sets direction); a correlation near 0 means it contributes nothing to the discriminant function.
Quadratic Discriminant Analysis
QDA relaxes LDA’s shared-covariance assumption, estimating a separate covariance matrix per class. The discriminant function becomes quadratic in :
and the classification rule is simply . QDA is more flexible — curved decision boundaries — but estimates many more parameters, so it needs more data per class to stay stable.
In practice
sklearn.discriminant_analysis.LinearDiscriminantAnalysis and QuadraticDiscriminantAnalysis cover both variants; LDA also doubles as a supervised dimensionality-reduction method via its transform. LDA remains a strong baseline when classes are well separated and roughly Gaussian, and it is a standard preprocessing step before feeding compact discriminants into other models. For high-dimensional data, use the shrinkage solver (solver='lsqr', shrinkage='auto') to regularize the covariance estimate.
Common pitfalls
- Non-Gaussian or heavily skewed classes. LDA’s optimality rests on Gaussian classes with equal covariance; strong violations degrade it.
- Unequal covariances. If class spreads differ markedly, switch to QDA rather than forcing a linear boundary.
- Singular covariance. With more predictors than observations — or collinear predictors — can’t be inverted without regularization.
- Reading coefficients like correlations. Standardize predictors first if you want comparable coefficient magnitudes.
Summary
LDA finds the projection direction that maximizes the ratio of between-class to within-class scatter, with the closed-form solution . Classification is projection plus threshold, and the Mahalanobis distance tells you how separable the classes really are. When classes have different shapes, QDA trades a linear boundary for a quadratic one at the cost of estimating more parameters.