← Back to work

Mathematical foundations

PCA from Scratch

How much structure survives when we reduce the dimensions?

I built PCA from the underlying linear algebra to understand how it compresses handwritten digit images. I explore what information stays and what gets lost.

View repository ↗
MNIST digits projected onto the first two principal components.
MNIST digits projected onto the first two principal components.

About the project

What it is

This project builds principal component analysis from its linear algebra. I use handwritten digits to see how covariance, eigenvectors, and maximum-variance directions turn a large image space into a smaller representation.

The visualizations show the first two components, the patterns learned by the components, and how well digits can be rebuilt after compression. This makes the tradeoff between fewer dimensions and lost detail visible.