Skip to content
AI.info

Unsupervised learning

DBSCAN: Core, Border, and Noise

Understand DBSCAN neighborhoods, core points, border points, noise labels, and the sensitivity of epsilon and min-samples.

By the end you can

Key idea

One global epsilon struggles with varying density

A radius suitable for a dense urban region may fragment a sparse rural region. Increase epsilon to recover the sparse group and the dense groups merge into one. This is a structural limitation, not a poor parameter search — and that is not the lesson's opinion. It is the opening premise of the 1999 paper that invented OPTICS, written by four people from DBSCAN's own research group in Munich, Kriegel and Sander among them. Their motivation section begins: “An important property of many real-data sets is that their intrinsic cluster structure cannot be characterized by global density parameters. Very different local densities may be needed to reveal clusters in different regions of the data space.” The abstract puts it harder still: “for many real-data sets there does not even exist a global parameter setting for which the result of the clustering algorithm describes the intrinsic clustering structure accurately”.

Twenty years on, a different group in a different journal said the same thing about the same algorithm. The authors of the R dbscan package wrote in 2019: “The inability to find clusters of varying density is a notable drawback of DBSCAN resulting from the fact that a combination of a specific neighborhood size with a single density threshold minPts is used to determine if a point resides in a dense neighborhood.” OPTICS and HDBSCAN can explore several density scales at once. They bring their own choices with them.

The limitation is the published premise of a 1999 paper, not a failure of your parameter search.

The award citation that states the strength and the condition in one sentence

Two machine regimes form curved bands around a central operating state. K-Means cuts across the bands, because the means of the bands overlap. DBSCAN follows dense connected paths instead, and leaves sparse points unassigned. The improvement comes from a different structural rule: DBSCAN defines clusters through local density connectivity, not through proximity to one representative center.

The field has said so formally. In 2014 ACM SIGKDD gave its KDD Test of Time Award to the 1996 paper that introduced DBSCAN, and the awarding body's own citation reads: “It proposed the now well-known clustering algorithm DBSCAN, which finds clusters of arbitrary shape, is robust to noise, and scales well to large databases, if the intrinsic dimensionality is not too high so that spatial index structures can be effective in supporting range queries.”

Read it to the end. The arbitrary shapes and the robustness to noise arrive attached to a clause most summaries drop. The scaling holds if the intrinsic dimensionality is not too high, so that spatial index structures can be effective in supporting range queries. That caveat is why a method praised for shape can still disappoint on a wide feature table. The R dbscan authors record the same award in 2019, describing the paper “whose impact earned it the SIGKDD 2014's Test of Time Award”.

Density connectivity represents shape that centroid partitions cannot — while the intrinsic dimensionality stays low enough for range queries.

Analogy

Finding neighborhoods through overlapping gatherings

On a city map, a location becomes a community hub when enough people gather within walking distance. Communities grow where hubs overlap. Isolated walkers stay outside.

Nobody in the data chooses to join, and density carries no social meaning. DBSCAN only counts neighbors under a fixed geometric radius and a fixed threshold. The count, as the next section shows, includes the walker standing at the center.

Clusters grow through chains of dense neighborhoods, not through one central landmark.

Visual

The three point roles, and the point that counts itself

A point's role depends on how many observations fall inside its epsilon neighborhood. That count includes the point itself. This is not a convention the lesson is choosing; it is what the shipping implementations document. scikit-learn's API reference describes min_samples as “The number of samples (or total weight) in a neighborhood for a point to be considered as a core point. This includes the point itself.” The library ships eps=0.5 and min_samples=5. Under those defaults a core point needs four other points plus itself.

The R dbscan package states the same convention in its first definition: “Note that together with p ∈ D this definition implies that point p is always part of its own ϵ-neighborhood, i.e., p ∈ Nϵ(p) always holds.” The off-by-one this creates is not cosmetic. It changes which k you plot when you go looking for epsilon. Four of DBSCAN's authors, writing again in 2017, spelled it out in a footnote: “The k-nearest neighbors do not include the query point, but the RangeQuery does include the query point for density estimation. Therefore, k corresponds to minPts = k + 1”.

A core point clears that count. A border point sits inside a core point's neighborhood without clearing it itself. A noise point is reachable from no core region at all, under the parameters you chose.

FigureHierarchy · 4 levels
  • Core point

    Has at least the required neighborhood mass within epsilon, including itself under common conventions.

    • Border point

      Falls near a core point but does not independently meet the core-density requirement.

      • Noise point

        Is not density-reachable from any core region under the selected parameters.

        • Density-connected cluster

          Contains points linked through chains of core neighborhoods plus attached border points.

Noise is a parameter-dependent label, not a permanent property of an observation.

Steps

Tune DBSCAN from the geometry outward

Parameter search should stay tied to feature scale and to the smallest meaningful local group. Every step after the first has a published answer you can argue with. In two cases the published answers disagree with each other.

Step 1 — standardize the relation. Units, metric and feature scaling are decided before any neighborhood is inspected. Both parameters are measured in whatever space you hand the algorithm.

Step 2 — set density evidence. There is no settled rule for min-samples. Three peer-reviewed sources give three different answers. A 2017 follow-up, written by four of DBSCAN's original authors together with Erich Schubert, restates two of them: “Its purpose is to smooth the density estimate, and for many datasets it can be kept at the default value of minPts = 4 (for two-dimensional data) [16]. Sander et al. [40] suggest setting it to twice the dataset dimensionality, i.e., minPts = 2 · dim.” The R dbscan authors give a third in 2019: “The rule of thumb for setting minPts is to use at least the number of dimensions of the dataset plus one.” Four, 2 · dim, dim + 1. This parameter is a judgement call with named advocates. Pick one rule and say which.

Step 3 — inspect neighbor distances. The k-distance graph is a diagnostic, not an epsilon oracle, and its inventors said so in 1996: “In general, it is very difficult to detect the first "valley" automatically, but it is relatively simple for a user to see this valley in a graphical representation. Therefore, we propose to follow an interactive approach for determining the threshold point.” The R package describes the same manual step in 2019 — plot the kNN distances in decreasing order “and look for a knee in the plot”, with a horizontal reference line added by hand. The plot also degrades on real data. Run these heuristics on the UCI Household data and this is what the 2017 authors report: “This dataset has 5% duplicate records, and attributes have only 32 to 4,186 different values each, so it has a low numerical resolution. This causes artifacts (visible steps) in some of the plots due to tied distances.”

Step 4 — sweep plausible radii, and know what a bad sweep looks like in numbers. The 2017 paper gives two thresholds: “The desirable amount of noise will usually be between 1% and 30%. The size of the largest component (i.e., the largest cluster) can also be used to detect if a clustering has degenerated.” The passage continues: “If the largest component contains more than 20% to 50% of the clustered points, either a hierarchical approach such as OPTICS [3], or HDBSCAN* [13] should be used, or DBSCAN should be run again with a smaller ε radius.” The far end of the sweep has a name of its own. Gan and Tao defined it in 2015: “Every dataset has a unique collapsing radius, which is the smallest ǫ such that exact DBSCAN returns a single cluster.” They fixed MinPts at 100 and swept ǫ from 5,000 up to that radius.

Step 5 — review border cases. The instability is documented, not hypothetical. The scikit-learn user guide opens its implementation note on DBSCAN: “The DBSCAN algorithm is deterministic, always generating the same clusters when given the same data in the same order. However, the results can differ when data is provided in a different order.” Then it names the mechanism: “Second and more importantly, the clusters to which non-core samples are assigned can differ depending on the data order. This would happen when a non-core sample has a distance lower than eps to two core samples in different clusters.” The R dbscan package reports the same effect: “In the DBSCAN algorithm, core points are always part of the same cluster, independent of the order in which the points in the dataset are processed. This is different for border points.” So do DBSCAN's own authors in 2017: “The result of this DBSCAN algorithm is deterministic, but may change if the dataset is permuted.” The check is cheap. Shuffle the rows, refit, and list the points whose label moved.

FigureProcess · 5 steps
  1. 1. Standardize the relation

    Choose units, metric, and feature scaling before inspecting neighborhoods.

  2. 2. Set density evidence

    Relate min-samples to dimensionality, noise tolerance, and minimum local support.

  3. 3. Inspect neighbor distances

    Use k-distance distributions as a diagnostic, not an automatic epsilon oracle.

  4. 4. Sweep plausible radii

    Record cluster count, noise share, sizes, and example memberships across epsilon values.

  5. 5. Review border cases

    Examine points that switch between cluster, border, and noise status.

Comparison

DBSCAN and K-Means make opposite commitments — and DBSCAN's cost is disputed in print

DBSCAN and K-Means differ in cluster shape, assignment policy, and parameterization. There is a fourth axis, cost, and on it DBSCAN's own literature argues with itself in public.

In 2015 Gan and Tao opened their paper by attacking the founding performance claim: “The original KDD’96 paper claimed an algorithm with O(n log n) running time, where n is the number of objects. Unfortunately, this is a mis-claim; and that algorithm actually requires O(n2) time.” Their abstract also states a lower bound for d ≥ 3 and offers a ρ-approximate alternative in O(n) expected time. The paper won that year's ACM SIGMOD Best Paper Award, recorded on the official list as “DBSCAN Revisited: Mis-Claim, Un-Fixability, and Approximation. Yufei Tao, Junhao Gan”.

Two years later the original authors answered. They accepted the bound and disputed the reading: “Calling even the worst-case complexity of O(n2) 'intractable' is a stretch of the terminology as used in theoretical computer science.” Both papers remain in print. Shape, assignment policy and parameterization are settled differences between the two methods. Cost is a documented dispute between two named groups, and a comparison table that leaves it out is quietly taking a side.

FigureComparison · 3 columns

DBSCAN

Builds clusters from local density-connected neighborhoods.

  • Does not require K in advance
  • Can label points as noise
  • Finds non-convex connected shapes
  • Assumes one effective density scale

K-Means

Partitions all points by nearest centroid.

  • Requires K before fitting
  • Assigns every point
  • Creates convex Voronoi regions
  • Scales efficiently to large numeric data

Shared dependency

Both inherit the feature space and distance definition.

  • Scaling changes neighborhoods
  • Irrelevant features weaken structure
  • Duplicates alter local mass
  • Domain validation remains necessary

Example

How epsilon and min-samples change the same data

Moving a parameter alters which points provide density support and which regions connect. The published thresholds tell you when you have moved it too far.

  • Small epsilon: most points become noise, because neighborhoods are too narrow to accumulate enough local support. A noise share far above the 1% to 30% band DBSCAN's own authors call desirable is a diagnosis, not a result.
  • Large epsilon: nearby regimes merge through broad neighborhoods. The end state has a name — Gan and Tao's collapsing radius, the smallest ǫ at which exact DBSCAN returns a single cluster. The 2017 warning fires earlier: a largest cluster holding more than 20% to 50% of the clustered points already signals degeneration.
  • Low min-samples: small accidental groups and noise fluctuations can become clusters. The 1996 default of 4 was set for two-dimensional data, and carrying it into a wide table is a choice, not an inheritance.
  • High min-samples: only very dense regions survive, and legitimate small populations disappear into noise. The 2 · dim rule and the dim + 1 rule can differ by roughly a factor of two on the same table.
  • Duplicate records: repeated observations can create artificial core points and inflate density, unless you deduplicate or weight deliberately. The UCI Household data used in the 2017 study has 5% duplicate records — enough to put visible steps in the k-distance plot through tied distances.

DBSCAN makes abstention part of clustering

Leaving some points as noise can be more honest than forcing every record into the nearest group. The noise set still depends on scale, density, sampling and row order. A non-core sample sitting within eps of two core samples in different clusters lands wherever the traversal reached it first.

Use DBSCAN when density connectivity matches the phenomenon and one neighborhood scale is defensible. When it is not, the 1999 OPTICS motivation already told you what you are looking at. The practical tests are numeric: a noise share outside 1% to 30%, a largest component over 20% to 50% of the clustered points, or labels that move when the rows are shuffled.

Noise labels express insufficient density support under chosen parameters.

Case

The parameter DBSCAN's authors removed by hand

DBSCAN has two parameters. Its authors had already fixed one of them by hand, in 1996, in the paper that introduced the algorithm. It gives the reasoning and the decision in one breath: “our experiments indicate that the k-dist graphs for k > 4 do not significantly differ from the 4-dist graph and, furthermore, they need considerably more computation. Therefore, we eliminate the parameter MinPts by setting it to 4 for all databases (for 2-dimensional data).” Epsilon then came off the sorted 4-dist graph, chosen by a person. Two parameters became one by fiat and a plot. Thirty years of practice inherited the number.

Case

62,584 landmarks, and a speed-up between 250 and 1900

The 1996 paper that introduced DBSCAN measured speed on the SEQUOIA 2000 benchmark data. Its “point data set contains 62,584 Californian names of landmarks, extracted from the US Geological Survey’s Geographic Names Information System, together with their location”. On subsets of it, “DBSCAN outperforms CLARANS by a factor of between 250 and 1900 which grows with increasing size of the database”. That is the measurement that made the method practical. The range spans a factor of 7.6 from end to end, with the low end belonging to the small subsets and the high end to the large ones.

Figure

The speed claim that made DBSCAN practical, drawn as a range rather than a number — with the parameter its authors fixed by hand.

Key takeaways