AppsGuidesAI DictionarySmall FixesOn RecordAboutFollow the lab

Dimensionality reduction

Also called pca, t-sne

Dimensionality reduction squeezes data described by many numbers into just a few, keeping as much of its shape as possible, so it is easier to see and use.

How machines learnTechnical

In plain words

Computers often describe one thing with hundreds or thousands of numbers. A customer might be 300 numbers, a photo millions of pixel values, a sentence perhaps 1,000 numbers called an embedding. Each number is one dimension. Nobody can picture 300 dimensions, and many of those numbers repeat each other.

Dimensionality reduction replaces many numbers with a few new ones that still capture most of what makes items different. Two or three numbers per item can be drawn as a map, where similar items land near each other.

It is used to draw maps of complex data, to speed up training, to cut storage, and to strip out noise before another model runs. The most famous method, principal component analysis (PCA), is more than a century old. Newer ones such as t-SNE and UMAP make the colourful cluster maps you see in AI research. It is usually counted as unsupervised learning, since it needs no answers attached.

Everyday example

Finding the best angle for a group photo

Twenty relatives stand in a garden, spread out in three dimensions. A photo has only two. Shoot from the side and everyone hides behind each other. Shoot from the front and everyone is visible and spread out. You lost one dimension, depth, but kept almost everything you care about. PCA picks that best angle for data automatically.

Where the example breaks: A camera only changes the angle. Methods like t-SNE also bend and stretch the data to keep neighbours together, so on their maps the size of a group and the gap between groups often mean nothing.

Go deeper

How it actually works

There are two broad families: selecting a subset of the original features, or building new features that combine them. PCA and t-SNE are both the second kind.

  1. PCA finds the directions of greatest spread

    Principal component analysis finds a new set of axes for the data. The first points along the direction in which the data varies most, the second along the most remaining variation at right angles to the first, and so on. Keep the first few and drop the rest.

  2. Project onto the kept axes

    Each item's position is measured along the kept axes, giving a short new list of numbers. Because PCA is linear, it is fast and its axes can be inspected. The share of variance kept tells you how much information survived. The classic iris flower data, with 4 measurements per flower, is often drawn on just its top 2 components.

  3. t-SNE and UMAP keep neighbours together

    When the structure is curved, non-linear methods work better for pictures. t-SNE gives each item a spot on a 2D or 3D map so that items close in the original space stay close on the map. UMAP has a similar aim, runs faster and arguably keeps more of the overall layout.

  4. Read the maps with care

    On a t-SNE map, cluster sizes and the gaps between clusters can be artefacts of the method, and even random noise can form clumps. Its settings change the picture a lot, so researchers try several before trusting a pattern.

  5. Why fewer dimensions help

    With many dimensions, data points become sparse, which makes models slower and more prone to overfitting. Reducing dimensions first can make training cheaper and more reliable.

PCA origins
Karl Pearson's 1901 paper, then Harold Hotelling's 1933 paper on "principal components"
t-SNE
Laurens van der Maaten and Geoffrey Hinton, Journal of Machine Learning Research, 2008
UMAP
Leland McInnes, John Healy and James Melville, 2018
Typical uses
Visualising embeddings, compressing features, removing noise, speeding up other models

Questions people ask

What is PCA in simple words?

Principal component analysis finds the directions in which your data spreads out most and describes each item by its position along just the top few. It is like rotating a cloud of points to the view that shows the most, then flattening it.

What is the difference between PCA and t-SNE?

PCA is linear and keeps the big overall spread of the data. t-SNE is non-linear and keeps local neighbours together, which makes clearer clusters but can distort the gaps between them. PCA is quick and its axes can be inspected; t-SNE is mainly for pictures.

Is dimensionality reduction the same as feature selection?

Feature selection is one kind: it keeps some original features and drops others. Methods like PCA instead build new features that blend the originals. Both reduce the count of numbers per item.

What is the curse of dimensionality?

The problems that pile up as you add dimensions. Data gets spread thinly, so models need far more examples to learn reliably, computing and storage costs grow, and models become more prone to overfitting. Reducing dimensions is one remedy.

Was this clear?

1 is confusing, 5 is crystal clear. One tap, no account needed.

Spotted something wrong, or know a better example? Suggest a change

Further reading