10.6 Part II: Principal components analysis
Source: Ideas from Computational Physics (Landau, Páez, Bordeianu), §10.6. Rewritten in original wording. Continues 10.5b. Next: 10.6b.
Why PCA after Fourier / wavelets
Fourier bases are infinite, correlated, and awkward to truncate. Wavelets compress 1D / image-like signals well but are a poor fit for huge, unlabeled, multivariate tables (stellar spectra, EEG arrays, faces, ocean fields). PCA rotates the measurement axes into principal components that point along directions of maximal variance (“power”) in dataspace — unsupervised dimensionality reduction, or equivalently: extract the dominant dynamics in a noisy, redundant cloud.
Same idea as principal axes for rigid-body inertia: choose coordinates where the description is simplest.
Iris warm-up
Four features (cm): sepal length/width, petal length/width. A short set of samples (subset of the classic iris table) is enough to practice means, variances, and covariances before full eigen-PCA.
Data space
At each instant, observables form one sample vector (e.g. eight coordinates from four detectors’ ). Thousands of times × many channels ⇒ enormous tables, often noisy and correlated across detectors.
Variance and SNR
For a scalar channel with samples,
Signal-to-noise ratio
PCA’s working hypothesis: largest variance ≈ most interesting dynamics; orthogonal residual directions may be noise or weaker modes.
Covariance matrix
Center channels , . Pick the sample covariance and the matrix form among lookalikes.
Positive cov ⇒ channels tend to move together; large |cov| ⇒ redundancy; zero ⇒ uncorrelated (for this linear measure). Stack centered detector rows into an matrix (row = all times for one channel; column = one time across channels).
- Diagonal : variances of individual channels.
- Off-diagonal : correlations between channels and .
- is square, symmetric, and positive semidefinite.
PCA pipeline (2D demo)
Classic steps (Smith-style points in the labs):
- Enter the (or ) table.
- Center each feature (subtract column/row means).
- Build (for 2D: , , ).
- Eigendecompose : eigenvalues and orthonormal eigenvectors . The largest is the principal direction — often most of the power ().
- Project: form a feature matrix whose columns (or rows) are the kept PCs; compute (convention: match your layout). Keeping only collapses the cloud onto a line; two PCs recover a rotated plane.
Demonstration numbers (2D)
For the Smith cloud (labs table), after centering you should recover something like
with unit (sign is conventional — flip both components together). is orthogonal and carries the leftover few percent. Projecting a centered sample is the score (and optionally ).
Iris remains your open problem: same pipeline in . Chaotic-pendulum phase-space samples (Chapter 8) make a nice physics follow-on — store cycles past transients and PCA the (or higher) table.
Takeaway
- Center features.
- Form .
- Eigendecompose → ordered PCs.
- Project onto the top PCs (drop small- “noise” directions).
PCA and covariance
1 / 4With centered X (M×N), the covariance matrix is…
Pick an answer to see if you are right.
Next: 10.6b PCA labs.