
Principal Component Analysis (84 Pages)
You can already ask an AI to run a PCA. The problem is knowing whether the components mean anything — or whether you’ve discovered that one column happened to be recorded in millimeters, kept ninety-five percent of the variance while discarding the one direction that separated your groups, and read a confident story into loadings whose signs are arbitrary. This is the course that gives you that judgment.
Five parts, one algorithm, no gaps:
Part 1 — Intro. How centering, covariance, and eigenvectors — the moves that turn a cloud of correlated measurements into a set of perpendicular axes ranked by how much they explain — find the directions the data actually varies in, with no reference to any label. Why variance is the thing being maximized, what orthogonality buys you, and why that is not the same as finding what matters. The intuition before the notation.
Part 2 — By Hand. A complete worked example, step by step: center the columns, build the covariance matrix entry by entry, then drive the first component out by power iteration, three to five rounds of multiply, normalize, repeat, watching the vector stop moving. Deflate the matrix and do it again for the second. Then check the whole thing against the exact answer from the characteristic equation, so you know the iteration landed where it should. Every product and every square root on the page. Nothing waved away, nothing left “as an exercise.”
Part 3 — In Excel. The same decomposition built out in a spreadsheet with no pasted values anywhere, so you watch each iteration converge row by row — and see for yourself what standardizing the columns, dropping one, or adding a single outlier does to the components, the scree plot, and the share of variance explained.
Part 4 — In Python. A clean, executable reference implementation in plain numpy, checked against both the exact eigendecomposition and the SVD, with the sign convention pinned down so the answer is reproducible — the known-good version you can check any other code against.
Part 5 — With AI. A tested prompt that directs an AI assistant to carry this same algorithm to your data, plus the understanding to catch it when it’s wrong.
By the end you won’t just have working code. You’ll have followed the algorithm from first principles through a hand calculation, a spreadsheet, and production Python — so when you point an AI at your own dataset, you’ll know when to standardize and when standardizing destroys the thing you care about, how many components to keep and on what grounds, how to read loadings without over-reading them, and when to put PCA down because the structure you’re after is nonlinear or simply isn’t in the high-variance directions. The worked example includes a case where the leading component is the least informative one, because that is the mistake PCA invites and it is better met on paper than in production.
Written for practicing engineers and STEM professionals who’d rather understand a method than trust a black box.