From the course: Data Science Foundations: Data Mining in Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

LDA

LDA - Python Tutorial

From the course: Data Science Foundations: Data Mining in Python

Start my 1-month free trial

LDA

- [Instructor] Another interesting approach to dimensionality reduction is found in LDA or linear discriminant analysis. What's unusual about this is it's not actually a dimensionality reduction algorithm. It's a classification algorithm that uses dimensionality reduction to do its classification tasks. So I want to show you how this works and you'll see that to a certain extent, it looks a lot like principle component analysis but it gives some different output. Let's start by loading several packages including scikit-learn or sklearn here, which will give us the linear discriminant analysis function and we'll import the data set and split it into testing and training with X for the attribute or pixel data variables and Y for the class variable that says whether a digit is a one, a six or a nine. And we'll take a look at the first few rows of the training data. And here we have the first five rows and the variables P0…

Contents