
Linear discriminant analysis (LDA),normal discriminant analysis (NDA),canonical variates analysis (CVA), ordiscriminant function analysis is a generalization ofFisher's linear discriminant, a method used instatistics and other fields, to find alinear combination of features that characterizes or separates two or more classes of objects or events. The resulting combination may be used as alinear classifier, or, more commonly, fordimensionality reduction before laterclassification.
LDA is closely related toanalysis of variance (ANOVA) andregression analysis, which also attempt to express onedependent variable as a linear combination of other features or measurements.[2][3] However, ANOVA usescategoricalindependent variables and acontinuousdependent variable, whereas discriminant analysis has continuousindependent variables and a categorical dependent variable (i.e. the class label).[4]Logistic regression andprobit regression are more similar to LDA than ANOVA is, as they also explain a categorical variable by the values of continuous independent variables. These other methods are preferable in applications where it is not reasonable to assume that the independent variables are normally distributed, which is a fundamental assumption of the LDA method.
LDA is also closely related toprincipal component analysis (PCA) andfactor analysis in that they both look for linear combinations of variables which best explain the data.[5] LDA explicitly attempts to model the difference between the classes of data. PCA, in contrast, does not take into account any difference in class, and factor analysis builds the feature combinations based on differences rather than similarities. Discriminant analysis is also different from factor analysis in that it is not an interdependence technique: a distinction between independent variables and dependent variables (also called criterion variables) must be made.
LDA works when the measurements made on independent variables for each observation are continuous quantities. When dealing with categorical independent variables, the equivalent technique is discriminant correspondence analysis.[6][7]
Discriminant analysis is used when groups are known a priori (unlike incluster analysis). Each case must have a score on one or more quantitative predictor measures, and a score on a group measure.[8] In simple terms, discriminant function analysis is classification - the act of distributing things into groups, classes or categories of the same type.
The originaldichotomous discriminant analysis was developed by SirRonald Fisher in 1936.[9] It is different from anANOVA orMANOVA, which is used to predict one (ANOVA) or multiple (MANOVA) continuous dependent variables by one or more independent categorical variables. Discriminant function analysis is useful in determining whether a set of variables is effective in predicting category membership.[10]
Consider a set of observations (also called features, attributes, variables or measurements) for each sample of an object or event with known class. This set of samples is called thetraining set in asupervised learning context. The classification problem is then to find a good predictor for the class of any sample of the same distribution (not necessarily from the training set) given only an observation.[11]: 338
LDA approaches the problem by assuming that the conditionalprobability density functions and are boththe normal distribution with mean andcovariance parameters and, respectively. Under this assumption, theBayes-optimal solution is to predict points as being from the second class if the log of the likelihood ratios is bigger than some threshold T, so that:
Without any further assumptions, the resulting classifier is referred to asquadratic discriminant analysis (QDA).
LDA instead makes the additional simplifyinghomoscedasticity assumption (i.e. that the class covariances are identical, so) and that the covariances have full rank.In this case, several terms cancel:
and the above decision criterionbecomes a threshold on thedot product
for some threshold constantc, where
This means that the criterion of an input being in a class is purely a function of this linear combination of the known observations.
It is often useful to see this conclusion in geometrical terms: the criterion of an input being in a class is purely a function of projection of multidimensional-space point onto vector (thus, we only consider its direction). In other words, the observation belongs to if corresponding is located on a certain side of a hyperplane perpendicular to. The location of the plane is defined by the threshold.
The assumptions of discriminant analysis are the same as those for MANOVA. The analysis is quite sensitive to outliers and the size of the smallest group must be larger than the number of predictor variables.[8]
It has been suggested that discriminant analysis is relatively robust to slight violations of these assumptions,[12] and it has also been shown that discriminant analysis may still be reliable when using dichotomous variables (where multivariate normality is often violated).[13]
Discriminant analysis works by creating one or more linear combinations of predictors, creating a newlatent variable for each function. These functions are called discriminant functions. The number of functions possible is either where = number of groups, or (the number of predictors), whichever is smaller. The first function created maximizes the differences between groups on that function. The second function maximizes differences on that function, but also must not be correlated with the previous function. This continues with subsequent functions with the requirement that the new function not be correlated with any of the previous functions.
Given group, with sets of sample space, there is a discriminant rule such that if, then. Discriminant analysis then, finds “good” regions of to minimize classification error, therefore leading to a high percent correct classified in the classification table.[14]
Each function is given a discriminant score[clarification needed] to determine how well it predicts group placement.
Aneigenvalue in discriminant analysis is the characteristic root of each function.[clarification needed] It is an indication of how well that function differentiates the groups, where the larger the eigenvalue, the better the function differentiates.[8] This however, should be interpreted with caution, as eigenvalues have no upper limit.[10][8]The eigenvalue can be viewed as a ratio ofSSbetween andSSwithin as in ANOVA when the dependent variable is the discriminant function, and the groups are the levels of theIV[clarification needed].[10] This means that the largest eigenvalue is associated with the first function, the second largest with the second, etc..
Some suggest the use of eigenvalues aseffect size measures, however, this is generally not supported.[10] Instead, thecanonical correlation is the preferred measure of effect size. It is similar to the eigenvalue, but is the square root of the ratio ofSSbetween andSStotal. It is the correlation between groups and the function.[10] Another popular measure of effect size is the percent of variance[clarification needed] for each function. This is calculated by: where is the eigenvalue for the function and is the sum of all eigenvalues. This tells us how strong the prediction is for that particular function compared to the others.[10] Percent correctly classified can also be analyzed as an effect size. The kappa value can describe this while correcting for chance agreement.[10]Kappa normalizes across all categorizes rather than biased by a significantly good or poorly performing classes.[clarification needed][17]
Canonical discriminant analysis (CDA) finds axes (k − 1canonical coordinates,k being the number of classes) that best separate the categories. These linear functions are uncorrelated and define, in effect, an optimalk − 1 space through then-dimensional cloud of data that best separates (the projections in that space of) thek groups. See “Multiclass LDA” for details below.
Because LDA uses canonical variates, it was initially often referred as the "method of canonical variates"[18] or canonical variates analysis (CVA).[19]
The termsFisher's linear discriminant andLDA are often used interchangeably, althoughFisher's original article[2] actually describes a slightly different discriminant, which does not make some of the assumptions of LDA such asnormally distributed classes or equal classcovariances.
Suppose two classes of observations havemeans and covariances. Then the linear combination of features will havemeans andvariances for. Fisher defined the separation between these twodistributions to be the ratio of the variance between the classes to the variance within the classes:
This measure is, in some sense, a measure of thesignal-to-noise ratio for the class labelling. It can be shown that the maximum separation occurs when
When the assumptions of LDA are satisfied, the above equation is equivalent to LDA.

Be sure to note that the vector is thenormal to the discriminanthyperplane. As an example, in a two dimensional problem, the line that best divides the two groups is perpendicular to.
Generally, the data points to be discriminated are projected onto; then the threshold that best separates the data is chosen from analysis of the one-dimensional distribution. There is no general rule for the threshold. However, if projections of points from both classes exhibit approximately the same distributions, a good choice would be the hyperplane between projections of the two means, and. In this case the parameter c in threshold condition can be found explicitly:
Otsu's method is related to Fisher's linear discriminant, and was created to binarize the histogram of pixels in agrayscale image by optimally picking the black/white threshold that minimizes intra-class variance and maximizes inter-class variance within/between grayscales assigned to black and white pixel classes.


In the case where there are more than two classes, the analysis used in the derivation of the Fisher discriminant can be extended to find asubspace which appears to contain all of the class variability.[20] This generalization is due toC. R. Rao.[21] Suppose that each of C classes has a mean and the same covariance. Then the scatter between class variability may be defined by the sample covariance of the class means
where is the mean of the class means. The class separation in a direction in this case will be given by
This means that when is aneigenvector of the separation will be equal to the correspondingeigenvalue.
If is diagonalizable, the variability between features will be contained in the subspace spanned by the eigenvectors corresponding to theC − 1 largest eigenvalues (since is of rankC − 1 at most). These eigenvectors are primarily used in feature reduction, as in PCA. The eigenvectors corresponding to the smaller eigenvalues will tend to be very sensitive to the exact choice of training data, and it is often necessary to use regularisation as described in the next section.
If classification is required, instead ofdimension reduction, there are a number of alternative techniques available. For instance, the classes may be partitioned, and a standard Fisher discriminant or LDA used to classify each partition. A common example of this is "one against the rest" where the points from one class are put in one group, and everything else in the other, and then LDA applied. This will result in C classifiers, whose results are combined. Another commonmethod is pairwise classification, where a new classifier is created for each pair of classes (givingC(C − 1)/2 classifiers in total), with the individual classifiers combined to produce a final classification.
The typical implementation of the LDA technique requires that all the samples are available in advance. However, there are situations where the entire data set is not available and the input data are observed as a stream. In this case, it is desirable for the LDA feature extraction to have the ability to update the computed LDA features by observing the new samples without running the algorithm on the whole data set. For example, in many real-time applications such as mobile robotics or on-line face recognition, it is important to update the extracted LDA features as soon as new observations are available. An LDA feature extraction technique that can update the LDA features by simply observing new samples is anincremental LDA algorithm, and this idea has been extensively studied over the last two decades.[22] Chatterjee and Roychowdhury proposed an incremental self-organized LDA algorithm for updating the LDA features.[23] In other work, Demir and Ozmehmet proposed online local learning algorithms for updating LDA features incrementally using error-correcting and the Hebbian learning rules.[24] Later, Aliyari et al. derived fast incremental algorithms to update the LDA features by observing the new samples.[22]
In practice, the class means and covariances are not known. They can, however, be estimated from the training set. Either themaximum likelihood estimate or themaximum a posteriori estimate may be used in place of the exact value in the above equations. Although the estimates of the covariance may be considered optimal in some sense, this does not mean that the resulting discriminant obtained by substituting these values is optimal in any sense, even if the assumption of normally distributed classes is correct.
Another complication in applying LDA and Fisher's discriminant to real data occurs when the number of measurements of each sample (i.e., the dimensionality of each data vector) exceeds the number of samples in each class.[5] In this case, the covariance estimates do not have full rank, and so cannot be inverted. There are a number of ways to deal with this. One is to use apseudo inverse instead of the usual matrix inverse in the above formulae. However, better numeric stability may be achieved by first projecting the problem onto the subspace spanned by.[25]Another strategy to deal with small sample size is to use ashrinkage estimator of the covariance matrix, whichcan be expressed mathematically as
where is the identity matrix, and is theshrinkage intensity orregularisation parameter.This leads to the framework of regularized discriminant analysis[26] or shrinkage discriminant analysis.[27]
Also, in many practical cases linear discriminants are not suitable. LDA and Fisher's discriminant can be extended for use in non-linear classification via thekernel trick. Here, the original observations are effectively mapped into a higher dimensional non-linear space. Linear classification in this non-linear space is then equivalent to non-linear classification in the original space. The most commonly used example of this is thekernel Fisher discriminant.
LDA can be generalized tomultiple discriminant analysis, wherec becomes acategorical variable withN possible states, instead of only two. Analogously, if the class-conditional densities are normal with shared covariances, thesufficient statistic for are the values ofN projections, which are thesubspace spanned by theN means,affine projected by the inverse covariance matrix. These projections can be found by solving ageneralized eigenvalue problem, where the numerator is the covariance matrix formed by treating the means as the samples, and the denominator is the shared covariance matrix. See “Multiclass LDA” above for details.
In addition to the examples given below, LDA is applied inpositioning andproduct management.
Inbankruptcy prediction based on accounting ratios and other financial variables, linear discriminant analysis was the first statistical method applied to systematically explain which firms entered bankruptcy vs. survived. Despite limitations including known nonconformance of accounting ratios to the normal distribution assumptions of LDA,Edward Altman's1968 model[28] is still a leading model in practical applications.[29][30][31]
In computerisedface recognition, each face is represented by a large number of pixel values. Linear discriminant analysis is primarily used here to reduce the number of features to a more manageable number before classification. Each of the new dimensions is a linear combination of pixel values, which form a template. The linear combinations obtained using Fisher's linear discriminant are calledFisher faces, while those obtained using the relatedprincipal component analysis are calledeigenfaces.
Inmarketing, discriminant analysis was once often used to determine the factors which distinguish different types of customers and/or products on the basis of surveys or other forms of collected data.Logistic regression or other methods are now more commonly used. The use of discriminant analysis in marketing can be described by the following steps:
The main application of discriminant analysis in medicine is the assessment of severity state of a patient and prognosis of disease outcome. For example, during retrospective analysis, patients are divided into groups according to severity of disease – mild, moderate, and severe form. Then results of clinical and laboratory analyses are studied to reveal statistically different variables in these groups. Using these variables, discriminant functions are built to classify disease severity in future patients. Additionally, Linear Discriminant Analysis (LDA) can help select more discriminative samples for data augmentation, improving classification performance.[32]
In biology, similar principles are used in order to classify and define groups of different biological objects, for example, to define phage types of Salmonella enteritidis based on Fourier transform infrared spectra,[33] to detect animal source ofEscherichia coli studying its virulence factors[34] etc.
This method can be used toseparate the alteration zones[clarification needed]. For example, when different data from various zones are available, discriminant analysis can find the pattern within the data and classify it effectively.[35]
Discriminant function analysis is very similar tologistic regression, and both can be used to answer the same research questions.[10] Logistic regression does not have as many assumptions and restrictions as discriminant analysis. However, when discriminant analysis’ assumptions are met, it is more powerful than logistic regression.[36] Unlike logistic regression, discriminant analysis can be used with small sample sizes. It has been shown that when sample sizes are equal, and homogeneity of variance/covariance holds, discriminant analysis is more accurate.[8] Despite all these advantages, logistic regression has none-the-less become the common choice, since the assumptions of discriminant analysis are rarely met.[9][8]
Geometric anomalies in higher dimensions lead to the well-knowncurse of dimensionality. Nevertheless, proper utilization ofconcentration of measure phenomena can make computation easier.[37] An important case of theseblessing of dimensionality phenomena was highlighted by Donoho and Tanner: if a sample is essentially high-dimensional then each point can be separated from the rest of the sample by linear inequality, with high probability, even for exponentially large samples.[38] These linear inequalities can be selected in the standard (Fisher's) form of the linear discriminant for a rich family of probability distribution.[39] In particular, such theorems are proven forlog-concave distributions includingmultidimensional normal distribution (the proof is based on the concentration inequalities for log-concave measures[40]) and for product measures on a multidimensional cube (this is proven usingTalagrand's concentration inequality for product probability spaces). Data separability by classical linear discriminants simplifies the problem of error correction forartificial intelligence systems in high dimension.[41]