I have a data set consisting of 15K labeled samples (of 10 groups). I want to apply dimensionality reduction into 2 dimensions, that would take into consideration the knowledge of the labels.

When I use "standard" unsupervised dimensionality reduction techniques such as PCA, the scatter plot seems to have nothing to do with the known labels.

Does what I am looking for have a name? I would like to read some references of solutions.

  • 3
    $\begingroup$ If you are looking for linear methods, then linear discriminant analysis (LDA) is what you should be using. $\endgroup$
    – amoeba
    Jul 14, 2015 at 11:57
  • $\begingroup$ @amoeba: Thanks. I used it and it performed much better! $\endgroup$
    – Roy
    Jul 14, 2015 at 13:18
  • $\begingroup$ Glad that it helped. I provided a brief answer with some further references. $\endgroup$
    – amoeba
    Jul 14, 2015 at 14:17
  • 1
    $\begingroup$ One possibility would be to first reduce to the nine-dimensional space spanning the class centroids, and then use PCA to further reduce to two dimensions. $\endgroup$
    – A. Donda
    Jul 25, 2015 at 15:46
  • $\begingroup$ Related: stats.stackexchange.com/questions/16305 (possibly duplicate, though perhaps the other way round. I will come back to this after I update my answer below.) $\endgroup$
    – amoeba
    Jun 5, 2018 at 10:56

1 Answer 1


The most standard linear method of supervised dimensionality reduction is called linear discriminant analysis (LDA). It is designed to find low-dimensional projection that maximizes class separation. You can find a lot of information about it under our tag, and in any machine learning textbook such as e.g. freely available The Elements of Statistical Learning.

Here is a picture that I found here with a quick google search; it shows one-dimensional PCA and LDA projections when there are two classes in the dataset (origin added by me):


Another approach is called partial least squares (PLS). LDA can be interpreted as looking for projections having highest correlation with the dummy variables encoding group labels (in this sense LDA can be seen as a special case of canonical correlation analysis, CCA). In contrast, PLS looks for projections having highest covariance with group labels. Whereas LDA only yields 1 axis for the case of two groups (like on the picture above), PLS will find many axes ordered by the decreasing covariance. Note that when there are more than two groups present in the dataset, there are different "flavours" of PLS that will produce somewhat different results.

Update (2018)

I should find time to expand this answer; this thread seems to be popular but my original answer above is very short and not detailed enough.

In the meantime, I will mention Neighbourhood Components Analysis -- a linear method that finds the projection maximizing $k$-nearest-neighbours classification accuracy. There is a nonlinear generalization using neural networks, see Learning a Nonlinear Embedding by Preserving Class Neighbourhood Structure. One can also use neural network classifiers with a bottleneck, see Deep Bottleneck Classifiers in Supervised Dimension Reduction.

  • 1
    $\begingroup$ nice graphic, explains much $\endgroup$
    – Titou
    Feb 2, 2017 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.