Low-rank images and PCA
Keep the largest singular values for a low-rank approximation. For PCA, center each data feature first; the leading right singular vectors identify directions of greatest variation.
What you will learn
- Construct a truncated approximation
- Calculate discarded energy
- Center data and identify PCA directions
Work through one complete example
- An image matrix with singular values 5,2,1 has squared Frobenius norm 25+4+1=30.
- Keeping only the first singular term leaves squared error 4+1=5. Keeping two leaves squared error 1.
- For centered data X with n samples, sample covariance is XᵀX/(n−1). PCA directions are eigenvectors of that matrix.
- For X=[[-1,0],[0,0],[1,0]], covariance=diag(1,0), so the first principal direction is (1,0).
Objective 1: Construct a truncated approximation
- Which term is kept for singular values 5,2,1 at rank one?
- Keep 5u₁v₁ᵀ, preserving squared energy 25.
Objective 2: Calculate discarded energy
- Find squared error after keeping one term.
- 2²+1²=5; original squared energy is 30.
Objective 3: Center data and identify PCA directions
- Find covariance and the principal direction for X=[[-1,0],[0,0],[1,0]].
- The columns are centered. XᵀX/2=diag(1,0), with direction (1,0).
A common mistake
State the assumptions before using the formula.
Review first
Continue learning
Interactive diagnosis and practice load in the learning app. You can read these lesson notes without JavaScript.