Problems with computing PCA using Eigenvalue Decomposition:
- Computing already takes time.
- is poorly conditioned → numerically inaccurate eigenvalues.
Singular Value Decomposition (SVD)
- Every has a singular value decomposition.
- Full SVD vs Compact SVD.
- Just different ranks.
For Full SVD, and are orthogonal matrices. (i.e have unit length and mutually orthogonal)
are singular values of . (By convention). are known as the left singular vectors of . are known as the right singular vectors of .
Claim: is an eigenvector of with eigenvalues .
Proof:
So, if we want to find the singular value of X,
- Compute
- Find eigenvalues of
IMPORTANT: Row i of gives the principal coordinates of sample
In practice, there are fast algorithm for finding singular values of any matrix . Therefore, if we want the PCA of , we compute the singular value of , square it to make it eigenvalues of .Once we have eigenvalues, we can find eigenvectors, which are Principal Components of . This is also the same as (rows of the matrix ) from SVD.
Compact SVD
Note:
- In Compact SVD, .
- Similarly, .
- is always full rank in compact SVD.
- Claim: We can find the
k
largest singular values and corresponding vectors in time. - There are also approximate randomized algorithms that work really well for very large dataset.