# Is this description of linear discriminant analysis (LDA) correct?

Hang Nguyen writes the following in "Machine learning basics (part 14): Linear Discriminant Analysis":

If there are two classes then the LDA draws one hyperplane and projects the data onto this hyperplane in such a way as to maximize the separation of the two categories. This hyperplane is created according to the two criteria considered simultaneously:

• Maximizing the distance between the means of two classes;
• Minimizing the variation between each category.

Is that correct?

• It has been a while since I learned LDA. What I have kept in my memory is that LDA can be viewed as a special case of the Bayes classifier. There, the focus is on priors, likelihoods and posteriors instead of optimizing means and variances. I suppose there can be alternative representations of the same optimization problem, so I wonder if this one is correct or not. Commented Mar 2, 2023 at 9:24
• In Fisher's LDA the ratio of the between-group sum of squares to the within-group sum of squares is maximized. But there are different discriminant rules (ML, Bayes, ...). Commented Mar 2, 2023 at 10:01
• @statmerkur, so I take it to mean the quoted interpretation is incorrect? Commented Mar 2, 2023 at 10:15
• Yes. For 2 groups Fisher's method amounts to maximizing the ratio of the squared Euclidean distance between the group means to the sum of the two within-group "variations" (of the projected data). Commented Mar 2, 2023 at 14:30

Fisher's approach was ingenious and intuitively clear: separate the populations $$\Pi_i$$ based on the linear function $$\mathbf a^\top \mathbf x$$ that maximizes the ratio of between-groups of sum of squares to within-group sum of squares:

Consider $$\mathbf y=\mathbf X\mathbf a, ~\mathbf X$$ being the data matrix. Total sum of squares $$\mathbf y^\top \mathbf H\mathbf y=\mathbf a^\top \mathbf X^\top\mathbf H\mathbf X\mathbf a$$ can be decomposed into sum of within-groups sum of squares $$\sum\mathbf y_i^\top\mathbf H_i\mathbf y_i=\sum \mathbf a^\top \mathbf X_i^\top\mathbf H_i\mathbf X_i\mathbf a:= \mathbf a^\top \mathbf W\mathbf a,$$ (here $$\mathbf H_i$$ being the centering matrices) and between-groups sum of squares $$\sum_i n_i(\bar y_i-\bar y) :=\mathbf a^\top\mathbf B\mathbf a.$$

We seek to find $$\mathbf a$$ that maximizes the ratio (as remarked by statmerkur) $$\frac{\mathbf a^\top\mathbf B\mathbf a}{\mathbf a^\top\mathbf W\mathbf a}$$ which would be nothing but the largest eigenvalue's eigenvector of $$\mathbf W^{-1}\mathbf B.$$

Coming to the stated blog: while I won't say it is outright wrong, it is indeed problematic:

$$\bullet$$ The author defined $$\mathbf S_b$$ in terms of $$\boldsymbol\mu_i,$$ the population means. But then used sample within groups matrix $$\sum_i (n_i-1) \mathbf S_i=\sum_i\sum_{j=1}^{n_i}(\mathbf x_{ij} -\bar{\mathbf x}_i) (\mathbf x_{ij} -\bar{\mathbf x}_i)^\top.$$ The former is used when the population parameters $$(\boldsymbol\mu_i, \mathbf\Sigma)$$ are known. Otherwise, in place of $$\mathbf S_b, ~\sum_i(\mathbf{\bar x}_i-\mathbf{\bar x}) (\mathbf{\bar x}_i-\mathbf{\bar x}) ^\top$$ has to be substituted. The author is plausibly confusing things using Fisher's sample LDs.

$$\bullet$$

Maximizing the distance between the means of two classes;

Now they are talking about two classes instead of $$g$$ classes. For $$g=2,$$ the interpretation would be to find $$\mathbf a$$ such that maximum separation is achieved between $$\bar y_1$$ and $$\bar y_2,$$ measured in standard deviation units.

## References:

$$\rm [I]$$ Applied Multivariate Statistical Analysis, Wolfgang Karl Härdle, Léopold Simar, Springer-Verlag, $$2015,$$ sec. $$14.2,$$ pp. $$418-419.$$

$$\rm [II]$$ Applied Multivariate Statistical Analysis, Richard A. Johnson, Dean A. Wichern, Pearson, $$2013,$$ sec. $$11.6,$$ pp. $$622-623; ~590.$$

• Thank you for the answer! If the LDA does not involve maximization of the distance between the means of the two classes, then the statement is simply incorrect, is it not? Commented Mar 2, 2023 at 14:44
• I would say we are seeking maximization of the separation of the two means measured in standard deviation units; in other words maximize the ratio. So, yes, the statement provided is misleading. I think the author wanted to argue like since we are seeking maximization of $a/b,$ it can be achieved by maximizing $a$ and minimizing $b.$ But this is too oversimplification and can be misleading. Commented Mar 2, 2023 at 14:56
• Overall the whole blog seemed to, though in good spirit, be outright confusing and dubious. Commented Mar 2, 2023 at 15:01
• Thanks! That answers my question. Commented Mar 2, 2023 at 16:08

In "The use of multiple measurements in taxonomic problems" Fisher asked the question

What linear function of the four measurements $$X=\lambda_1x_1 + \lambda_2x_2 + \lambda_3x_3 + \lambda_4x_4$$ will maximize the ratio of the difference between the specific means to the standard deviations within species?

So you can see LDA as finding the linear combination of the measured variables that maximizes the F-ratio in an ANOVA test.

If there are two classes then the LDA draws one hyperplane and projects the data onto this hyperplane in such a way as to maximize the separation of the two categories. This hyperplane is created according to the two criteria considered simultaneously:

• Maximizing the distance between the means of two classes;
• Minimizing the variation between each category.

The quote is more or less correct.

It is more precisely about maximizing the ratio of the 'distance between the means of two classes' to 'the variation within each category'.

The projection is onto a line, not onto a hyperplane. Although the line defines a range of hyperplanes that can be used in categorisation.

LDA can be viewed as a special case of the Bayes classifier.

If you estimate the distributions as multivariate normal distributions with the same covariance, then the Bayes classifier is a hyperplane perpendicular to the LDA-axis.

An example of the hyperplane is below (which also shows the hyperplane for qda, which relaxes the assumption of equal covariance matrices)

• Amazing plots, as always! Regarding the last quote, does your answer support or contradict it? Commented Mar 16, 2023 at 10:41
• The image is a copy from stats.stackexchange.com/a/501450 it actually doesn't show the point in the best way as it draws the distributions assuming that the covariance is different. But, if you would have the same covariance, then the line of LDA will flow through the intersections of the iso-lines, where the distributions are equal (currently the QDA line does this). Commented Mar 16, 2023 at 10:52
• You could say in a way that LDA works as a Bayes classifier. It can draw the same boundary. (You would have to apply the correct weights between the prior groups, and the Bayes needs to assume equal covariance) Commented Mar 16, 2023 at 10:55
• It is more precisely about maximizing the ratio of the 'distance between the means of two classes' to 'the variation within each category. - Exactly, this is the correct statement. As I said earlier too, the blog is not wrong but imo, it is a bit confusing and then there was bit of hotchpotch in terminologies. Commented Mar 16, 2023 at 11:26