Principal component analysis by the SVD
PCA centers each feature and uses the leading right singular vectors of the centered data matrix as principal directions. Projecting onto the first few directions gives a lower-dimensional summary.
What you will learn
- Center features and find the leading direction
- Calculate principal-component scores
- Explain variance ratios and reconstruction
A principal direction that is not a coordinate axis
- Use centered data rows (2,2),(−2,−2),(1,−1),(−1,1); both feature means are zero.
- XᵀX=[[10,6],[6,10]] has eigenvalues 16 and 4. The leading unit direction is v=(1,1)/√2, not either coordinate axis.
- Scores Xv are 2√2,−2√2,0,0. The leading component explains 16/(16+4)=80% of centered squared variation.
- Rank-one reconstruction uses (Xv)vᵀ: the first two rows are recovered exactly, and the last two become (0,0). Squared reconstruction loss is 4.
Objective 1: Center features and find the leading direction
- Confirm centering and find the leading unit direction from XᵀX=[[10,6],[6,10]].
- Both column means are zero. The larger eigenvalue is 16, with unit direction (1,1)/√2.
Objective 2: Calculate principal-component scores
- Compute scores for the four centered rows using v=(1,1)/√2.
- Xv=(2√2,−2√2,0,0).
Objective 3: Explain variance ratios and reconstruction
- What fraction of centered squared variation does one component retain?
- The retained fraction is 16/20=80%. Reconstructed rows are (2,2),(−2,−2),(0,0),(0,0); squared loss is 4.
A common mistake
State the assumptions before using the formula.
Review first
Continue learning
Principal component analysis by the SVD
Interactive diagnosis and practice load in the learning app. You can read these lesson notes without JavaScript.