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.
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
Learn it in a course
Read about it on the blog
Sources and further reading
Other terms from ML Models & Algorithms
- BERT (Bidirectional Encoder Representations from Transformers)Google's 2018 transformer language model that reads text in both directions to produce context-aware embedding…
- BERTopicA modular topic modelling technique that clusters transformer embeddings and labels each cluster with class-ba…
- BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies)BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies) clusters very large numeric datasets by s…
- BM25A classic ranking function that scores documents by how often query words appear, adjusted for word rarity and…
- Boyer-MooreA fast exact string-search algorithm that compares a pattern from right to left and skips ahead after mismatch…
- c-TF-IDFClass-based TF-IDF: treats each cluster as one document to find the words that best describe it, used by BERTo…
- Centroid-based ClusteringA clustering family that groups data around central points (centroids), each the average of its cluster's memb…
- Convolutional Neural Network (CNN)A deep learning architecture that scans data with small learned filters to detect local patterns; the classic…
- DBSCANDensity-based clustering that groups closely packed points, finds the number of clusters itself and labels iso…

