Linear and Quadratic Discriminant Analysis › Advantages

Michael BrenndoerferOctober 27, 20263 min read
Machine Learning from ScratchAll chapters
Part 7 of 15Supervised Learning Beyond Linear Models
Chapter 55Linear and Quadratic Discriminant Analysis › Advantages
Reading section 2 of 10 · Advantages · 3 minSection 2 of 10 · 3 min

Section 2 of 10 · 3 min read

Linear and Quadratic Discriminant Analysis › AdvantagesSection view · Sections in this chapter2 / 10 ↓
Reading tools Definitions, links & notes

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Notes & comments

With the true class means, priors, and shared positive-definite covariance, LDA is the Bayes-optimal classifier for Gaussian classes under zero-one loss. Here, "optimal" means minimizing the expected probability of misclassification under that generative model: at each feature vector, predicting the class with the largest true posterior minimizes conditional error. The Gaussian discriminant derivation explains this population rule. Estimating its parameters introduces uncertainty, so fitted LDA need not attain the Bayes error in a finite sample.

LDA shares covariance information across classes. It estimates one d×dd \times d covariance matrix, KK mean vectors, and K−1K - 1 priors. For d=100d = 100 features and two classes (K=2K = 2), the covariance contributes 100(101)2=5,050\frac{100(101)}{2} = 5{,}050 distinct entries, the means contribute 2⋅100=2002 \cdot 100 = 200, and the priors contribute K−1=1K - 1 = 1, for exactly 5,2515{,}251 free generative parameters. Ordinary binary logistic regression has d+1=101d + 1 = 101 coefficients including its intercept; fitting two separate one-vs-rest models would store 2(d+1)=2022(d + 1) = 202 coefficients, with redundant representations for two complementary classes. The larger generative parameter count does not by itself determine classification efficiency. Efron (1975) studied the asymptotic relative classification efficiency of logistic regression and normal discriminant analysis for two multivariate normal classes with different means and a common covariance. That comparison concerns asymptotic classification performance, rather than a guarantee of more accurate finite-sample coefficient estimates.

QDA gives the corresponding population Bayes rule for Gaussian classes with their own positive-definite covariances, provided the true parameters and priors are used. Fitting it requires KK full covariance estimates, each with d(d+1)2\frac{d(d+1)}{2} free parameters, instead of one. When class covariances differ, its quadratic score differences can represent curved decision boundaries that a linear classifier cannot express. For independent Gaussian samples with a truly common covariance, the pooled covariance has lower entrywise sampling variance than an unbiased class estimate when that class has at least two observations and the other classes add residual degrees of freedom.

For dense full-covariance matrix kernels, computing within-class scatter from NN observations once class subsets are available costs O(Nd2)O(Nd^2). QDA then factors KK covariance matrices at a cost of O(Kd3)O(Kd^3) and scores one new observation in O(Kd2)O(Kd^2). LDA factors a single shared covariance and can precompute its class weights: the additional work is O(d3+Kd2)O(d^3 + Kd^2), after which a prediction costs O(Kd)O(Kd). These are matrix-kernel bounds; solver choices can change them. The primitive fits below additionally scan all labels once per class, adding O(NK) class-mask comparisons, plus separate input validation and np.unique work. Large feature counts also impose quadratic covariance storage, so an adequate sample size alone does not make either dense method practical.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy