demo · 02-ml-fundamentals
PCA — finding the axes of maximum variance
Three datasets, one rotation slider. Principal component arrows point in the directions of greatest spread. Variance explained bars show how much signal each axis captures. Toggle "Project to 1D" and watch a 2D cloud collapse to the line that preserves the most information.
Why it matters
PCA is the workhorse of dimensionality reduction: before t-SNE, UMAP, and autoencoders it was how high-dimensional data got plotted and compressed. The principal components are eigenvectors of the covariance matrix — the same eigenvectors explored in the Linear Algebra Lab. Understanding PCA is the bridge between classical ML and the embedding projections you see everywhere in modern AI.
The math
Cov = (1/n) XᵀX # covariance matrix (mean-centred X)
Eigendecomposition (2×2 closed form):
λ = (a+d)/2 ± √(((a-d)/2)² + b²)
PC₁ = eigenvector for λ_max
Variance explained = λᵢ / Σλⱼ
Anchored to 02-ml-fundamentals/unsupervised-learning.