All lessons in Machine Learning Engineering: Reliable Predictive Models
PCA and Variance-Preserving Projections
Center data, project onto directions, and separate reconstruction from prediction.
30 minutes · Free with an account · preview
What you will learn
- Center a small feature table, compute its covariance matrix, and find the principal directions and their variances by hand.
- Compute component scores, explained-variance fractions, and the mean squared reconstruction error of a truncated projection.
- Explain why a high-variance direction is not automatically a predictive one and where PCA must sit inside a training-only pipeline.
The carrier's dispatch table has columns that say almost the same thing. In the hand fixture, load and a proxy represent two measurements of van loading. The executable workbook uses synthetic numeric scores with a correlated proxy; it does not record actual planning timestamps. Plotted against each other they form a tilted cloud: most of the spread lies along a single diagonal line, and only a little spread lies across it. Principal component analysis (PCA) is the tool that finds that diagonal, measures how much of the total spread it carries, and lets you replace two correlated columns with one score plus a small leftover. This lesson works the arithmetic on a tiny fixture, then separates two questions that are easy to confuse: how well a projection reconstructs the features, and how well it predicts late deliveries.