Introduction
In the modern landscape of machine learning, dominated by deep neural networks, fundamental statistical classifiers like Linear Discriminant Analysis (LDA) and Quadratic Discriminant Analysis (QDA) are often relegated to "black box" baseline status in introductory courses. However, their underlying mechanics are foundational to understanding how machines learn decision boundaries. This tutorial provides a comprehensive mathematical and conceptual unification of LDA and QDA, moving beyond simple classification formulas to show how these classic methods are deeply interconnected with metric learning, Fisher Discriminant Analysis, and Bayesian optimality.
The core challenge addressed here is the pedagogical bridge between basic probability and advanced machine learning concepts. By exploring why these models work, we can better understand their relationship to modern techniques like Metric Learning and Kernel PCA, as well as their inherent limitations when faced with complex, multi-modal data.
Theoretical Foundations
Decision Boundary Optimization
The derivation of these models begins with first principles: the optimal decision boundary exists where the posterior probabilities of two classes are equal. In a one-dimensional case with Gaussian distributions, this is the point $x^*$ where the probability density functions (PDFs) intersect.
To classify a new point $x$, we assign it to the class $k$ that maximizes the posterior probability $P(C_k | x)$. Using Bayes' Theorem, this is proportional to the product of the class-conditional density $P(x | C_k)$ and the class prior $\pi_k$. For multivariate data in $d$-dimensional space, we utilize the multivariate Gaussian PDF, which incorporates a mean vector $\mu_k$ and a covariance matrix $\Sigma_k$.
The Covariance Assumption: LDA vs. QDA
The fundamental distinction between LDA and QDA lies in their assumptions regarding the data's variance:
- Linear Discriminant Analysis (LDA): Assumes all classes share the same covariance matrix ($\Sigma_1 = \Sigma_2 = \Sigma$). This simplification causes the quadratic terms in the log-posterior to cancel out, resulting in a linear decision boundary.
- Quadratic Discriminant Analysis (QDA): Relaxes this assumption, allowing each class to have its own unique covariance matrix. This flexibility results in a quadratic (curvy) boundary, such as a parabola or ellipse, which can better capture classes with different spreads or orientations.
Key Insights and Conceptual Links
Classification as Metric Learning
A significant insight is that LDA and QDA are essentially forms of metric learning. By using the inverse of the covariance matrix, these models effectively calculate the Mahalanobis distance between a point and the class means. If the covariance is an identity matrix, the models simplify to basic Euclidean distance classification. This perspective links classical statistics directly to modern distance-based learning.
Relationship to Other Models
- LDA $\equiv$ FDA: There is a formal equivalence between Linear Discriminant Analysis and Fisher Discriminant Analysis. While derived differently—one from probability and the other from maximizing the ratio of between-class to within-class variance—they result in the same optimal projection subspace.
- Naive Bayes as "Diet QDA": Gaussian Naive Bayes is a restricted version of QDA where the off-diagonal elements of the covariance matrix are forced to zero, assuming all features are independent.
Results and Dynamics
The Impact of Class Priors
Simulation results confirm that the decision boundary is not solely determined by the class means. The class priors $\pi_k$ (the relative frequency of each class) play a critical role. When class sizes are imbalanced, the decision boundary shifts toward the smaller class. This shift occurs because the model "expects" the more frequent class to appear more often, requiring stronger evidence to classify an instance as the rarer category.
Limitations: The Uni-modal Assumption
The primary limitation of standard LDA and QDA is the assumption that each class follows a single Gaussian distribution (uni-modality). In scenarios where a class is multi-modal—consisting of two or more distinct clusters—these models provide a poor fit. Simulations show that a true Bayes classifier, which accounts for the exact distribution, significantly outperforms LDA/QDA in these cases.
Conclusion
While LDA and QDA are simple, they offer deep insights into the geometry of classification. For complex data that violates the uni-modal assumption, future work often points toward Kernel Discriminant Analysis (KDA). By applying the "kernel trick," data can be projected into a higher-dimensional space where non-linear, multi-modal distributions may become linearly separable, overcoming the geometric constraints of the classical models.
Summary updated