PCA
PCA means principal component analysis. It is a technique used to reduce the dimensionality of the dataset.
The idea is very simple, consider a dataset matrix,
We would like to retain the dimension that captures the most variance in the dataset.
Consider the covariance matrix, where . Because we want maximum variance for each dimension, we can perform an eigendecomposition of the covariance matrix.
Now, if is an eigenvector, if the original data has greater variance along , it will have a greater eigenvalue. We can choose ones that have the largest eigenvalues, then,
Then we project to this reduced eigenspace,
Thus accomplishing the task of choosing the important basis (the principal components) of the dataset.
The above process can also be seen as SVD on the dataset matrix .
From the SVD perspective, the principal components are the left singular vectors of . The eigenvalues of the covariance matrix are the square of the singular values of . We look for the singular vectors that has the largest absolute singular values, then cast the data into the reduced singular vector space.
Singular Value Decomposition refers to decomposing a matrix into,
Where and are orthogonal matrices and is a diagonal (maybe not square) matrix. This is a natural extension of the eigendecomposition of a square matrix.
and are the left and right singular vectors of respectively. is the singular values of . For a square matrix, the singular values are the eigenvalues.
is responsible for rotating the vector into a proper basis, then brings the space into a another dimension while performing a stretch, then rotates the target space.
To calculate the SVD,
Because is a square matrix, it has an eigendecomposition. The eigenvectors of are the right singular vectors of . The eigenvalues of are the square of the singular values of .
Similarly,
Thus we can calculate the singular values and vectors of .