CAB212 · Unit 5: Unsupervised learning
Principal component analysis
7 practice questions
Key points
- Maximise variance along orthogonal axes
- Eigenvectors of the covariance matrix
- Explained ratio = eigenvalue / total
- Scale first
PCA is an unsupervised, linear dimensionality reduction technique. It finds orthogonal directions (principal components) of maximum variance and projects data onto the top few.
Steps: (1) centre (and usually standardize) the data; (2) compute the covariance matrix; (3) find its eigenvectors and eigenvalues; (4) sort by eigenvalue; (5) project onto the top m eigenvectors.
- Eigenvalue = variance captured along that component.
- Explained variance ratio = lambda_i / sum of all lambdas. Keep components until a target such as 95% is reached.
- Components are uncorrelated; first has the most variance.
Worked example: eigenvalues 4, 1 and 1 sum to 6, so PC1 explains 4/6 = 66.7% of variance.
Uses: visualisation, noise reduction, speeding up models, decorrelating features. Limits: linear only, components are hard to interpret, and variance is not always relevant to the target.
Exam pitfall: always scale features first; otherwise large-scale features dominate the components.
Try two questions
PCA is mainly used for:
- Dimensionality reduction
- Label creation
- Classification only
- Hyperparameter tuning
Show the answer
A. It compresses features while keeping variance.
Principal components are:
- Always parallel
- Orthogonal (uncorrelated)
- Identical
- Equal to original features
Show the answer
B. Each is perpendicular to the others.