Performing dimension reduction with Principal Component Analysis (PCA)
Principal component analysis (PCA) is the most widely used linear method in dealing with dimension reduction problems. PCA is useful when data contains many features and there is redundancy (correlation) within these features. To remove redundant features, PCA maps high-dimension data into lower dimensions by reducing features into a smaller number of principal components that account for most of the variance of the original features. In this recipe, we will introduce how to perform dimension reduction with the PCA method.
Getting ready
In this recipe, we will use the economic freedom dataset as our target to perform PCA. The economic freedom (http://www.heritage.org/index/ranking) dataset includes global standardized economic freedom measures. You can download the dataset from https://github.com/ywchiu/rcookbook/raw/master/chapter12/index2015_data.csv.
How to do it…
Perform the following steps to perform PCA on the...