Skip to content
Back to search results

UMAP

Introduced by
McInnes, L.; Healy, J.; Melville, J.
Year
2018
Type
Nonlinear manifold-learning dimension reduction
Font size

What does it do?

UMAP (Uniform Manifold Approximation and Projection) is a fast, scalable nonlinear dimension-reduction method grounded in manifold-learning theory, introduced by McInnes, Healy and Melville in 2018.

It compresses high-dimensional data into a low-dimensional embedding for visualisation and downstream analysis.

The intuition behind the method

Real data with many features often lies on a much lower-dimensional curved surface, or manifold, embedded in the high-dimensional space. UMAP tries to learn the shape of that surface from how points cluster near their neighbours, then unfolds it into two or three dimensions so the structure becomes visible. Compared with t-SNE it tends to keep more of the global layout while remaining far faster on large datasets.

History

UMAP was introduced in 2018 by Leland McInnes, John Healy and James Melville, who built it on manifold-learning theory as a faster, more scalable alternative to t-SNE. It quickly became a standard tool for dimension reduction and visualisation, particularly in fields with very high-dimensional data, because it preserves more global structure while scaling to large datasets.

When to use it

Use UMAP to visualise or compress continuous, high-dimensional data on at least about 50 observations, whether for exploration or as a preprocessing step before classification. The n_neighbors and min_dist hyperparameters should be tuned to the structure you care about, and a random_state should be fixed for reproducibility. Below about 50 observations the manifold cannot be learned reliably and linear PCA is the safer choice.

Limitations and considerations

  • Distances between clusters in the embedding can be misleading and should not be over-interpreted.
  • Results depend on the n_neighbors and min_dist hyperparameters, which must be tuned.
  • Output is not deterministic unless a random_state is fixed.
  • On small samples (n below about 50) the manifold cannot be learned reliably and the visual becomes misleading; PCA is preferable.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Fast and scalable to large datasets, far quicker than t-SNE.
  • Preserves global structure better than t-SNE while still capturing local clusters.
  • Captures nonlinear structure that linear methods such as PCA cannot.
  • Produces 2- or 3-dimensional embeddings well suited to visualisation.

Applications

  • Visualising high-dimensional continuous data in two or three dimensions.
  • Exploratory analysis to reveal clusters and structure before formal modelling.
  • Dimension reduction as a preprocessing step ahead of classification.
  • Compressing large, high-feature datasets where speed matters.

How it works

How it works

1

UMAP first builds a weighted neighbourhood graph of the high-dimensional data: each point is connected to its nearest neighbours, controlled by the n_neighbors hyperparameter, which sets how much local versus global structure is captured. This graph is UMAP's approximation of the underlying manifold.

2

A low-dimensional layout is then optimised so that its own neighbourhood graph matches the high-dimensional one as closely as possible, by minimising the cross-entropy between the two graph representations. The min_dist hyperparameter governs how tightly points are allowed to pack together, shaping the density of the resulting clusters.

Formula
Y = \arg\min_{Y} \; \text{cross-entropy}(G_{\text{high}}, G_{\text{low}})
3

The result is a 2- or 3-dimensional embedding in which similar observations sit close together, ready for plotting or for feeding into clustering or classification. Cluster shapes are preserved, but distances between clusters should be read with caution, and a fixed random_state is needed for reproducible output.

Common pitfalls

  • Reading distances between clusters as if they were meaningful quantities.
  • Leaving n_neighbors and min_dist at defaults instead of tuning them to the data.
  • Forgetting to set a random_state, so the embedding is not reproducible.
  • Running UMAP on fewer than about 50 observations and trusting the resulting plot.

Frequently asked questions

How is UMAP different from t-SNE?

Both are nonlinear methods for visualising high-dimensional data, but UMAP is built on manifold-learning theory, tends to preserve global structure better, and is much faster on large datasets.

Can I interpret distances between clusters in the plot?

Be cautious. UMAP preserves cluster shapes, but the distances between clusters can be misleading and should not be read as precise quantities.

Which hyperparameters matter most?

n_neighbors controls the balance between local and global structure, and min_dist controls how tightly points pack together. Both should be tuned, and a random_state should be fixed so the embedding is reproducible.

What if I have very few observations?

Below about 50 observations the manifold cannot be learned reliably and the embedding becomes misleading. In that case a linear method such as PCA is the safer choice.

Related methods

Sources

  1. McInnes, L., Healy, J. & Melville, J. (2018). UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction. arXiv:1802.03426.

    Open publication reference
    Copied.