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

Unlock the full course today

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

PCA

PCA

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

Start my 1-month free trial

PCA

- [Instructor] The first method of dimensionality reduction I want to show you is the most common, probably the most useful. It's PCA, or principal component analysis. To do this, I'm going to load a few packages. One is ggbiplot, which allows me to create biplots or two dimensional plots for components. I'm going to load that, and then I'm going to load the training and test data sets for the opdigits that we created and saved in the R data serialized format. We'll load the first one into TRN for train, and the second one into TST for test. Now, there are several ways to do principal components in R. The most common is prcomp which is built in. You also have princomp. Principle comes from the psych package and then PCA comes from the facto minor. All of these are common choices but I'm going to stick with the most common prcomp. What I'm going to do is I'm going to take the training data, I'm going to exclude the class…

Contents