Linear Discriminate Analysis Using C#

I wrote an article titled “Linear Discriminate Analysis Using C#” in the October 2015 issue of Microsoft MSDN Magazine. See


Linear Discriminate Analysis (LDA, but not to be confused with another LDA, latent Dirichlet allocation) is an old (from the 1930s) math technique that can be used to perform binary classification. A binary classification problem is one where you want to predict something that can take on only one of two possible values. For example, you might want to predict the sex (male or female) base on their age, annual income, and other predictors. Or you might want to predict the price of a stock one week from now (up or down), based on shares sold, price to earnings ratio, and so on.


In the article, I show how to code LDA using raw (no external libraries) C#. Although there are existing tools that can do LDA, if you need to integrate LDA directly into a software system, using existing tools may not be feasible.

In the end, LDA is very interesting, but I conclude that other binary classification techniques are generally preferable. These alternatives include logistic regression, neural network classification, and decision tree classification.

This entry was posted in Machine Learning. Bookmark the permalink.