ML Models & Algorithms

UMAP

In shortA dimensionality reduction algorithm that compresses high-dimensional data such as embeddings into a few dimensions while keeping similar items close.

Updated 24 Oct 2026· 2 min read

UMAP (Uniform Manifold Approximation and Projection) is a dimensionality reduction algorithm. It takes data with many dimensions, such as 384-dimensional text embeddings, and represents it in far fewer while keeping items that were similar close together. It is used both to visualise complex data in 2D and to prepare embeddings for clustering, most notably inside BERTopic and Top2Vec.

How it works

In simplified terms:

  • UMAP looks at each point’s nearest neighbours in the original high-dimensional space and builds a weighted graph of who is close to whom.
  • It then creates a low-dimensional layout and moves points around until that layout’s neighbourhood graph matches the original as closely as possible.

Four settings matter most:

  • n_neighbors: how many neighbours to consider. Low values preserve fine local detail; high values preserve the bigger picture.
  • min_dist: how tightly points can be packed. Low values produce compact clumps, which helps clustering.
  • n_components: how many dimensions to output.
  • metric: how distance is measured; cosine is common for text embeddings.

Compared with PCA, UMAP captures non-linear structure. Compared with t-SNE, it is generally faster and keeps more of the global structure, which makes it more useful as a step before clustering.

How it’s used in SEO and marketing

  • Reducing keyword or page embeddings before clustering with HDBSCAN.
  • Plotting a site’s content or a keyword universe on a 2D map to see topic groups and gaps.
  • Visualising competitors’ content alongside yours.
  • Image clustering, where image feature vectors are reduced before grouping.

Example

In MLforSEO’s BERTopic tutorial, the all-MiniLM-L6-v2 model turns each document into a 384-dimensional embedding. UMAP is then set to n_neighbors=15, n_components=5, min_dist=0.0 and metric=”cosine”, with a fixed random_state so results repeat. HDBSCAN clusters those five-dimensional points into topics, and a separate 2D reduction is used for the topic map you look at.

Limitations and things to watch

  • Results change between runs unless you set random_state, which also makes it slower.
  • Distances and cluster sizes in a UMAP plot are not literal; do not over-read gaps between groups.
  • Settings affect the result a lot; test a few n_neighbors values.
  • Very small datasets may not have enough neighbours for a stable layout.

Learn it on MLforSEO

Where UMAP shows up on MLforSEO

Read about it on the blog

Sources and further reading

Other terms from ML Models & Algorithms

See all 50 ML Models & Algorithms terms →