How Dimensionality Reduction Works
The Curse of Dimensions
More features means exponentially more space
As dimensions increase, the same number of data points become exponentially sparser. In high dimensions, most of the space is empty — data gets lonely. This is the curse of dimensionality.
Step 1 of 6: The Curse of Dimensions
More features means exponentially more space
As dimensions increase, the same number of data points become exponentially sparser. In high dimensions, most of the space is empty — data gets lonely. This is the curse of dimensionality.
Step 2 of 6: PCA — Find the Best Angle
Rotate the data to maximize variance
PCA finds the axis that captures the most spread (variance) in the data. Rotate the line to maximize the explained variance — that is the first principal component.
Step 3 of 6: Choosing Dimensions
How many components to keep?
The scree plot shows variance captured by each component. Look for the elbow — the point where adding more components gives diminishing returns. Fewer components means more compression but higher reconstruction error.
Step 4 of 6: PCA in Action
Compress and reconstruct
PCA compresses 5 features into 2 components, then reconstructs the original. More components = lower error, but less compression. The red shows information lost.
Step 5 of 6: t-SNE — Preserving Neighborhoods
Keeping similar points close in 2D
t-SNE maps high-dimensional data to 2D while preserving local neighborhoods. Similar points stay close. The perplexity parameter controls how many neighbors each point considers — higher values reveal broader structure.
Step 6 of 6: PCA vs t-SNE
Linear simplicity vs non-linear beauty
| PCA | t-SNE | |
|---|---|---|
| Type | Linear | Non-linear |
| Speed | Fast | Slow |
| Distances | Preserved | Distorted |
| Best for | Preprocessing | Visualization |
Use PCA when you need fast, invertible dimensionality reduction (preprocessing, denoising). Use t-SNE when you want to visualize clusters — but remember, distances between clusters are not meaningful.