Back to Classic ML Mind Map
中文·English
📊 Classic MLID: pca

PCA & SVD

PCA 与 SVD
🎯Core Definition
PCA (principal component analysis) is unsupervised dimensionality reduction: it finds the orthogonal directions of maximum variance and projects high-dimensional samples onto the top kk principal components. The first component vv solves the constrained problem maxv  vTΣvs.t.v=1\max_{v} \; v^T \Sigma v \quad \text{s.t.} \quad \Vert v \Vert = 1, where Σ\Sigma is the covariance matrix.The Lagrangian L=vTΣvλ(vTv1)L = v^T \Sigma v - \lambda (v^T v - 1) differentiated w.r.t. vv gives Σv=λv\Sigma v = \lambda v — the solution is the top eigenvector of Σ\Sigma with variance =λ= \lambda (the eigenvalue); the kk-th component is the kk-th largest eigenvector.Hence PCA = SVD of the centered data matrix: X=UΣVTX = U \Sigma V^T, the right singular vectors VV are the principal directions, and the projection is T=XVT = X V taking the first kk columns; by the Eckart-Young theorem the top kk components also minimize reconstruction error (max-variance and min-reconstruction are equivalent).Choosing kk: cumulative explained variance ratio i=1kλii=1dλi0.95\frac{\sum_{i=1}^{k} \lambda_i}{\sum_{i=1}^{d} \lambda_i} \ge 0.95 or the scree-plot elbow; features should be z-scored first.
💡Use Cases
high-dimensional visualization (2D/3D), feature compression to speed up training, decorrelation/whitening, multicollinearity handling, image and genomics analysis; interviews always include the Lagrange derivation and PCA=SVD.
Key Problems Solved
raw features are redundant, collinear, and noisy, and high dimensions bring the curse of dimensionality; PCA captures maximal variance with kdk \ll d orthogonal directions — in practice 5% of the dimensions often retain 90%+ of the variance, while decorrelating and denoising. The cost: principal components are linear combinations of original features, hurting interpretability, and PCA cannot capture nonlinear structure (kernel PCA or autoencoders needed).
🎯5 High-Frequency Exam Points
1
Write PCA's max-variance problem maxvvTΣv  s.t.  v=1\max_v v^T \Sigma v \; \text{s.t.} \; \Vert v \Vert = 1 and use Lagrange multipliers to prove the solution is the top eigenvector.
2
Derive PCA = SVD: why are the right singular vectors of the centered data the principal directions? Relationship between singular values and variance?
3
Why is maximizing variance equivalent to minimizing reconstruction error? What is the reconstruction error expression?
4
How to choose the number of components? Common thresholds for the cumulative explained variance ratio i=1kλii=1dλi\frac{\sum_{i=1}^{k} \lambda_i}{\sum_{i=1}^{d} \lambda_i}?
5
Why must features be standardized before PCA? How does PCA differ from linear/ridge regression and from kernel PCA / autoencoders?
📖 In-depth Guide:📄 clustering-and-knn
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "PCA & SVD"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardDistance Metrics & IndexingNext CardNaive Bayes

🔗 More Classic ML Knowledge Cards

AdaBoost DerivationBagging & Random ForestBaum-Welch (HMM EM)GBDT Negative Gradient