DBSCAN Clustering: A Practical Guide for SEO Portfolios

October 22, 2026
<!-- Author LinkedIn URL omitted because no verified profile URL was supplied. Add only after author verification. --> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Person", "name": "Ilyas Baba", "description": "Portfolio operator, ex-Lazard" } </script>

TL;DR: DBSCAN clustering finds density-connected groups without requiring a predefined cluster count. For SEO portfolios, it can reveal keyword neighborhoods and isolate terms needing separate review. Its main settings are eps, the neighborhood radius, and min_samples, the density threshold. However, semantic similarity does not establish same-page intent, site ownership, or backlink suitability. Portfolio operators should validate candidate groups against SERP overlap, existing URLs, and editorial relevance. Variable-density datasets and memory requirements also need attention. The Python example below is an external analytical experiment—not a claim that 25links uses DBSCAN in production.

What is DBSCAN clustering?

DBSCAN—Density-Based Spatial Clustering of Applications with Noise—is an unsupervised method that groups observations through local density while leaving unsupported observations unassigned. Unlike methods requiring a predetermined cluster count, it discovers groups from a neighborhood radius and a minimum density requirement. For an illustrative portfolio containing 12,000 keywords across six sites, an analyst could explore semantic neighborhoods without first declaring that the dataset contains 80 topics. Those numbers describe an experimental setup, not a performance benchmark. The important distinction is that DBSCAN identifies density-connected observations: it does not determine whether a group deserves one article, several pages, or coverage on a particular property. That decision requires additional SEO evidence. <!-- TODO -->

Three point types explain the output:

For the Python implementation below, min_samples=5 includes the observation itself: four additional neighbors are sufficient. For alternative approaches, see the guide to clustering algorithms.

How does DBSCAN clustering work?

DBSCAN expands a cluster from a core observation through connected neighborhoods, allowing another core observation to extend the group farther. Consequently, observations at opposite ends of a cluster do not need to be directly close. This property supports irregularly shaped groups, but it also creates an SEO risk: intermediate keywords can bridge topics that require different content treatments. A portfolio analyst should therefore distinguish density connectivity from search-intent equivalence. In the numerical example below, each three-point neighborhood forms a separate group because its points satisfy the radius and density requirements. The isolated final observation remains noise. This is a worked example, not empirical evidence of keyword-clustering accuracy. <!-- TODO -->

Points:       0.00, 0.03, 0.06, 0.40, 0.43, 0.46, 0.95
eps:         0.07
min_samples: 3

Cluster A:   0.00, 0.03, 0.06
Cluster B:   0.40, 0.43, 0.46
Noise:       0.95

A semantic chain might connect “project management software,” “project management software pricing,” and “project planning template.” Their relationship does not establish that one URL should satisfy all three.

Which keyword data should a portfolio cluster?

The analytical unit should be a keyword representation accompanied by explicit portfolio metadata, rather than an arbitrary mixture of numeric business fields. A practical record preserves the keyword, language, search market, candidate site, existing URL, and embedding version. Keeping these fields separate makes it possible to explore semantic relationships without allowing site identifiers or commercial scores to distort distance calculations. For an illustrative five-site portfolio, “invoice reminder email” could fit a finance-operations publication, a software property, or an agency resource library. The embedding alone cannot resolve that ownership question. Candidate-site eligibility and existing coverage should remain visible during review, even when the initial experiment spans the entire portfolio. <!-- TODO -->

Field Illustrative value Purpose
Keyword invoice reminder email Text being represented
Language and market English, United Kingdom Search context
Candidate site Finance publication Routing constraint
Existing URL Article identifier Consolidation review
Embedding version Recorded model version Reproducibility

Topic discovery is also distinct from page assignment. The related guide explains what is topic modeling? and how broader themes differ from individual content targets.

How should eps and min_samples be selected?

Parameter selection should follow the intended research task rather than a preferred number of clusters. eps determines neighborhood reach, while min_samples determines how much local support qualifies an observation as a core point. With a fixed density threshold, increasing the radius generally connects more observations; with a fixed radius, increasing the density threshold can leave more observations unassigned. A practical experiment might compare three radii against three density thresholds, producing nine configurations on one frozen dataset. That is a proposed test design, not a recommended universal grid. Each result needs inspection for giant connected components, excessive fragmentation, and site-routing ambiguity before it becomes useful input to an editorial workflow. <!-- TODO -->

A defensible tuning sequence is:

  1. Freeze preprocessing, embedding model, and distance metric.
  2. Inspect nearest-neighbor distance distributions.
  3. Test a small parameter grid.
  4. Review large clusters and boundary pairs.
  5. Compare results against labeled editorial judgments.

For unit-normalized vectors:

Euclidean distance² = 2 × cosine distance

A cosine distance of 0.10 therefore corresponds to a Euclidean distance of approximately 0.447. Applying eps=0.10 to both metrics would create different neighborhoods. This conversion follows directly from the normalized-vector distance identity.

What happens when keyword clusters have different densities?

A single global radius can struggle when a portfolio mixes dense, repetitive terminology with sparse specialist queries. A radius that separates detailed software subtopics may leave most niche industrial queries unassigned; a larger radius may recover those sparse groups while merging the software terms into an oversized component. Consider an illustrative dataset with 4,000 closely related accounting-software terms and 600 specialist procurement terms. The appropriate response is not automatically to increase eps until both groups look populated. Instead, the analyst should inspect their neighbor-distance distributions, consider justified segmentation, and evaluate whether a variable-density method belongs in the experiment. These counts illustrate the problem rather than establish its frequency. <!-- TODO -->

Three responses are worth testing:

Separate runs should remain documented. Their cluster labels are not automatically comparable across sites or parameter settings.

How can DBSCAN be tested in Python without exhausting memory?

A reproducible Python experiment should validate its inputs, retain noise labels, and establish resource limits before processing a large portfolio. The embedding matrix is only part of the memory requirement: neighborhood discovery and the clustering implementation can consume substantially more. For scale, 100,000 embeddings with 768 float32 dimensions occupy approximately 307 MB before metadata and working memory. A dense 100,000-by-100,000 float64 distance matrix would require approximately 80 GB, or 74.5 GiB. Those are arithmetic storage estimates, not measured runtime benchmarks. They explain why a modest-looking keyword inventory can exceed a workstation’s capacity, particularly when an experiment materializes pairwise distances or finds very large neighborhoods. <!-- TODO -->

import numpy as np
import pandas as pd
from sklearn.cluster import DBSCAN
from sklearn.preprocessing import normalize

keywords = pd.read_csv("portfolio_keywords.csv")
vectors = np.load("keyword_embeddings.npy")

if vectors.ndim != 2 or len(keywords) != len(vectors):
    raise ValueError("Embedding shape or row count is invalid")
if not np.isfinite(vectors).all():
    raise ValueError("Embeddings contain non-finite values")
if (np.linalg.norm(vectors, axis=1) == 0).any():
    raise ValueError("Zero vectors require investigation")

vectors = normalize(vectors.astype(np.float32))

model = DBSCAN(
    eps=0.12,
    min_samples=5,
    metric="cosine",
    n_jobs=1,
)

keywords["cluster_id"] = model.fit_predict(vectors)

print(
    keywords.groupby("cluster_id").agg(
        keyword_count=("keyword", "size"),
        candidate_sites=("site_id", "nunique"),
    )
)

Here, -1 denotes noise. The settings are illustrative, and n_jobs=1 is not a memory guarantee.

Before scaling, test smaller subsets, measure peak memory, and define a stop condition. Arbitrary chunking changes the clustering problem because points in different chunks cannot become neighbors. Record package versions, input snapshots, parameters, and resource measurements. <!-- TODO -->

How should clustering quality be benchmarked?

A useful benchmark tests editorial decisions as well as cluster structure. Cluster count, noise share, and visual separation cannot independently establish whether a result improves publishing assignments across several sites. A practical evaluation could label 200 keyword pairs: 100 sampled within clusters and 100 sampled across nearby boundaries. Reviewers should score topical relatedness and same-page suitability separately, because those judgments answer different questions. They should also record whether the proposed destination property is appropriate. This is a proposed benchmark design, not a validated industry standard. Its value comes from making acceptance criteria explicit and comparing configurations against the same reviewed sample rather than selecting whichever visualization looks most convincing. <!-- TODO -->

Measure Decision it supports
Noise share How much requires separate review?
Largest-cluster share Has a broad component absorbed unrelated intents?
Same-page agreement Are content groups actionable?
Routing conflicts Which properties have ambiguous ownership?
Runtime and peak memory Can the experiment operate within budget?
Stability across runs Are conclusions sensitive to small changes?

If 2,300 of 10,000 keywords remain unassigned, the noise share is 23%. That arithmetic says nothing about whether those terms lack commercial value.

Where does DBSCAN fit in 25links’ orchestration workflow?

DBSCAN fits here as an exploratory technique, not as an asserted implementation detail of 25links’ production clustering. The documented product scope includes keyword research, cluster generation with SERP-overlap classification, an LLM article pipeline with relevance filtering and fact-checking, webhook publishing, and GSC, GA4, and DataForSEO analytics across a portfolio dashboard. Relevant components include ExpandSeed, KeywordFilterer, KeywordRelevanceFilter, SerpPairwiseCompare, ClusterAssembler, Cluster, and ClusterGenerationRun, followed by ArticleWriter and ArticlePublisher. An illustrative six-site, 18,000-keyword exercise therefore needs separate research, grouping, routing, and publishing decisions. An external DBSCAN experiment could inform analysis, but no native import, DBSCAN execution, or automatic handoff is established here.

The operational questions remain distinct:

SERP overlap supplies observable search-result evidence; it should still be evaluated rather than treated as an infallible intent label. <!-- TODO -->

Can keyword clusters support backlink matching safely?

Keyword clusters can supply topical context for backlink review, but they cannot establish editorial justification or Google-policy compliance. A source article and destination should have a specific, reader-serving relationship beyond sharing an embedding neighborhood. For example, an invoice-reminder guide might reference an explanation of payment terms across two independently operated sites; semantic similarity alone would not justify every available link. Google’s link spam policies explicitly identify excessive link exchanges and exchanges involving goods or services for links among problematic patterns when intended to manipulate rankings. Domain verification, independent ownership, and relevant anchors therefore do not create an automatic exemption for a credit-mediated exchange.

25links’ network connects domain-verified operators across organizations. Operators give links to earn credits and spend credits to receive DoFollow links, with topical relevance and anchor rotation built into matching.

Its components include DomainVerifier, BacklinkSuggester, NetworkAuthorityCalculator, NetworkLink, NetworkLinkRecorder, and CreditLedger. Verification establishes domain control—not policy approval. Google’s outbound-link qualification guidance remains relevant when an arrangement requires qualification.

How can MCP-native agents keep analysis separate from action?

MCP-native access gives agents a programmatic interface, but it does not turn a clustering result into permission to publish or claim links. The Model Context Protocol specification defines interfaces for capabilities such as tools; editorial authorization remains an application and operator responsibility. 25links exposes five named capabilities relevant here: RegisterSite, RegisterArticle, SuggestBacklinks, ClaimLinks, and GetCredits. An illustrative workflow could register an approved article, request backlink suggestions, inspect the credit balance, and make an authorized claim. The approval conditions in that example are a recommended operating pattern, not a claim that a particular approval engine or audit interface exists in the product.

Across a portfolio, action records should preserve site identity, article identity, proposed destination, authorization, and result. A temporary label such as cluster 17 is not a suitable permanent article identifier.

What questions commonly arise about DBSCAN clustering?

Is DBSCAN better than k-means for keyword clustering?

Neither is universally better. DBSCAN does not require a chosen cluster count and can leave observations unassigned; k-means requires a cluster count and assigns observations to centroids. A portfolio comparison should use the same input data and assess editorial agreement, routing conflicts, runtime, and memory. <!-- TODO -->

Does DBSCAN automatically prevent keyword cannibalization?

No. Related keyword vectors do not establish whether existing URLs compete unnecessarily. That assessment needs page targeting and search-result evidence. Across multiple properties, operators should also distinguish legitimate coverage from duplicated assignments.

Should noise keywords be deleted?

No. Noise means the selected density conditions were not met. An isolated specialist query may still be highly relevant to one portfolio property. Retaining noise for review avoids turning a parameter choice into an unsupported business decision.

Does 25links use DBSCAN in production?

DBSCAN is not established here as 25links’ production algorithm. The product workflow described uses relevance filtering and SERP-overlap classification. The Python example is a separate research experiment.

Where can portfolio operators connect research with execution?

Explore 25links for portfolio-wide SEO orchestration, a domain-verified backlink exchange, and MCP-native tools—while keeping clustering evidence, editorial approval, and Google’s link policies distinct.