Reducing the dimensions using the kernel version of PCA
Principal Components Analysis (PCA) transforms a correlated set of variables into a set of principal components: variables that are linearly uncorrelated (orthogonal). PCA can produce as many principal components as there are variables but normally it would reduce the dimensionality of your data. The first principal component accounts for the highest amount of variability in the data, with the following principal components accounting for decreasingly less variance explained and the restriction of orthogonality (uncorrelated) to the other principal components.
Getting ready
To execute this recipe, you will need pandas
, NumPy
, and MLPY
. For the plotting, you will need Matplotlib
with MPL Toolkits. No other prerequisites are required.
How to do it…
In a fashion similar to the previous recipes, we wrap our model building efforts within a method so that we can time it using the timeit
decorator (the reduce_pca.py
file):
@hlp.timeit def reduce_PCA...