Algorithm |
- Mean center the data (optional)
|
- Compute the covariance matrix of the dimensions
|
- Find eigenvectors of covariance matrix
|
- Sort eigenvectors in decreasing order of eigenvalues
|
- Project onto eigenvectors in order
|
- Assume data matrix is
of size 
|
- For each dimension, compute mean

|
- Mean center
by subtracting from each column to get 
|
- Compute covariance matrix
of size 
|
|
- If mean centered,

|
- Find eigenvectors and corresponding eigenvalues
of 
|
- Sort eigenvalues such that

|
- Project step-by-step onto the principal components
, etc.
|