# DBSCAN

> A cluster is a dense region grown from points with at least minPts neighbours within ε; points in no dense region are noise.

Source: https://www.mlfoundry.in/learn/dbscan  
Section: ML Algorithms › Unsupervised · Clustering  
Level: core · 16 min read · updated 2026-10-07

**DBSCAN:** (*Density-Based Spatial Clustering of Applications with Noise*, Ester et al., 1996) calls a point **core** if at least $\text{minPts}$ points lie within distance $\varepsilon$ of it, links core points that are within $\varepsilon$ of each other, and returns each linked group — plus the non-core points hanging on its edge — as a cluster. Everything else is labelled **noise**. The number of clusters is not an input; it falls out of the data.

- **Task:** Unsupervised clustering with built-in outlier detection
- **Input → output:** points $x_1,\dots,x_n$ and a distance → a label per point: cluster $1\dots k$ or **noise** ($-1$)
- **Learns:** which points are core / border / noise, and the connected groups of core points; no centroids or parameters
- **Training:** $n$ range queries: $O(n^2)$ brute force; roughly $O(n\log n)$ with a k-d / ball tree in low dimensions and small $\varepsilon$
- **Prediction:** not defined by the algorithm; the usual rule is one range query: join the cluster of a core point within $\varepsilon$, else noise
- **Hyperparameters:** $\varepsilon$ (neighbourhood radius), $\text{minPts}$ (`min_samples`), the distance metric
- **Assumes:** clusters are regions of roughly **one common density**, separated by sparser gaps; distances are meaningful (features scaled)

## The problem

k-means and Gaussian mixtures describe each cluster by a **centre** (and for GMMs a covariance). That builds in three assumptions that real data often breaks: clusters are blob-shaped, you know how many there are, and **every point belongs somewhere**. Give k-means two interleaved crescents and it cuts them with a straight line; give it a handful of sensor glitches and it drags a centroid toward them, because an outlier's squared distance is the most expensive thing in its objective.

Look at a scatter plot the way a person does and you see something different: clusters are **places where points are crowded**, separated by places where they are sparse. A crescent is a cluster because you can walk along it without ever crossing an empty gap. DBSCAN turns that picture into an algorithm: measure crowding locally, then connect the crowded points.

## The idea

Draw a disc of radius $\varepsilon$ around every point and count who is inside it (the point itself included). If the count reaches $\text{minPts}$, the point sits in a dense spot: it is a **core point**. Two core points whose discs contain each other belong to the same cluster, and so does every chain of such links — a cluster is grown like a flood fill, hopping from core point to core point. Non-core points that sit inside some core point's disc are swept in as the **border** of that cluster, but the flood never continues *through* them. Points that no flood ever reaches are **noise**.

**Vocabulary**

- **ε-neighbourhood:** $N_\varepsilon(p)$: all points within distance $\varepsilon$ of $p$, **including $p$** (scikit-learn's convention, used throughout this article)
- **minPts:** the density threshold: how many points an $\varepsilon$-ball must contain to count as dense (scikit-learn: `min_samples`)
- **Core point:** $|N_\varepsilon(p)|\ge\text{minPts}$ — the interior of a cluster
- **Border point:** not core, but inside the $\varepsilon$-ball of at least one core point — the fringe of a cluster
- **Noise point:** neither core nor border: not within ε of any core point. Gets label −1
- **Directly density-reachable:** $q$ from $p$: $p$ is core and $q\in N_\varepsilon(p)$. Not symmetric — a border point is reachable from a core point but not vice versa
- **Density-reachable:** there is a chain $p=p_1,\dots,p_m=q$ where each $p_{i+1}$ is directly density-reachable from $p_i$ (all links except the last start at core points)
- **Density-connected:** $p$ and $q$ are both density-reachable from some common point $o$. This is the symmetric relation that defines a cluster
- **k-distance:** distance from a point to its $k$-th nearest point (itself counted first). A point is core exactly when its $\text{minPts}$-distance is $\le\varepsilon$

> **Counting the point itself:** The 1996 paper and scikit-learn count $p$ inside its own neighbourhood, so `min_samples=4` means *the point plus 3 others*. Some textbooks and R's older packages count only the others. Off-by-one differences between implementations almost always come from this.

## The math

Fix a dataset $D$, a distance $d$, a radius $\varepsilon>0$ and an integer $\text{minPts}\ge1$. Everything follows from one set:

$$
N_\varepsilon(p)=\{\,q\in D:\ d(p,q)\le\varepsilon\,\},\qquad \text{core}(p)\iff |N_\varepsilon(p)|\ge \text{minPts}
$$

- $D$: the dataset (n points)
- $d(p,q)$: the distance between points p and q — usually Euclidean
- $\varepsilon$: neighbourhood radius
- $N_\varepsilon(p)$: the $\varepsilon$-neighbourhood of $p$ (contains $p$ itself)
- $\text{minPts}$: minimum neighbourhood size for a point to be core

$$
p \rightarrow q \iff \text{core}(p)\ \wedge\ q\in N_\varepsilon(p)
$$

- $p\rightarrow q$: $q$ is **directly density-reachable** from $p$

$$
p \sim q \iff \exists\, o\in D:\ o \rightarrow^{*} p\ \ \text{and}\ \ o\rightarrow^{*} q
$$

- $\rightarrow^{*}$: a chain of one or more $\rightarrow$ steps (density-reachability)
- $p\sim q$: $p$ and $q$ are **density-connected**
- $o$: a core point from which both are reachable

A **cluster** is a non-empty set $C\subseteq D$ that is *maximal* (if $p\in C$ and $p\rightarrow^* q$ then $q\in C$) and *connected* (every $p,q\in C$ satisfy $p\sim q$). Noise is whatever belongs to no cluster.

**Deriving the algorithm from the definition**

1. **Restrict to core points.** Between two core points $\rightarrow$ is symmetric: if both are core and $d(p,q)\le\varepsilon$, then $p\rightarrow q$ and $q\rightarrow p$. So on core points, $\rightarrow^*$ is "connected by a path of edges of length $\le\varepsilon$" — an equivalence relation.
2. **Clusters are graph components.** Build the graph $G$ whose nodes are core points and whose edges join core points within $\varepsilon$. Two core points are density-connected iff they lie in the same connected component of $G$ (a common $o$ exists exactly when there is a path). By maximality each component, with everything reachable from it, is one cluster — so the cores of different clusters never mix, and the number of clusters $k$ is the number of components.
3. **Attach the borders.** A non-core point $q$ is reachable only in the last hop of a chain, so it joins the cluster of any core point $p$ with $q\in N_\varepsilon(p)$ — and adds no further edges. That is why the flood fill must not expand from a border point: doing so would glue together two clusters that merely touch the same fringe point.
4. **Search the components.** Breadth-first search from each not-yet-labelled core point visits exactly one component plus its borders. Every point is enqueued at most once, so after the $n$ range queries the search is linear in the number of neighbour pairs.

> **DBSCAN is a density level set:** $|N_\varepsilon(p)|/(n\,V_d\,\varepsilon^d)$ is a kernel density estimate at $p$ with a flat (uniform) kernel of radius $\varepsilon$, where $V_d\varepsilon^d$ is the volume of the $d$-dimensional ball. So *core* means $\hat f(p)\ge\lambda$ with $\lambda=\text{minPts}/(n V_d\varepsilon^d)$, and DBSCAN's clusters are the connected pieces of the **level set** $\{\hat f\ge\lambda\}$. In the worked example below, $\lambda=4/(14\cdot\pi\cdot1.5^2)=0.040$ points per unit area. One fixed $\lambda$ is DBSCAN's biggest limitation: see **HDBSCAN** and **OPTICS**, which sweep over all levels at once.

**What each hyperparameter does, mathematically**

- **ε up:** every $N_\varepsilon$ grows, so more points become core and the graph $G$ gains edges: components **merge**, noise shrinks. In the limit one cluster, no noise.
- **ε down:** $G$ loses edges: components **split**, then core points disappear and everything becomes noise. The density threshold scales as $\varepsilon^{-d}$, so in high dimensions tiny changes in ε swing it enormously.
- **minPts up:** raises $\lambda$ at fixed ε: fewer core points, more noise, thin bridges between clusters are cut. It also smooths: one stray point can no longer form or connect a cluster.
- **minPts = 1 or 2:** every point is core (minPts = 1) or every pair within ε is linked (minPts = 2): DBSCAN reduces to **single-linkage** clustering cut at height ε (isolated points as noise), with its chaining problem.

## Worked example: 14 points

Two groups of points, a couple of stragglers, Euclidean distance, $\varepsilon=1.5$ and $\text{minPts}=4$ (the point itself plus at least 3 others).

The data, with each point's ε-neighbourhood (ε = 1.5, distances in brackets) and the resulting type. Highlighted: the core points.

| Point | (x, y) | Others within ε = 1.5 | \|N_ε\| | Type |
| --- | --- | --- | --- | --- |
| P1 | (1, 1) | P2 (1.00), P3 (1.00), P4 (1.41) | 4 | core |
| P2 | (2, 1) | P1 (1.00), P3 (1.41), P4 (1.00) | 4 | core |
| P3 | (1, 2) | P1 (1.00), P2 (1.41), P4 (1.00), P5 (1.41) | 5 | core |
| P4 | (2, 2) | P1 (1.41), P2 (1.00), P3 (1.00), P5 (1.00) | 5 | core |
| P5 | (2, 3) | P3 (1.41), P4 (1.00), P6 (1.34) | 4 | core |
| P6 | (3.2, 3.6) | P5 (1.34) | 2 | border of A |
| P7 | (6, 5) | P8 (1.00), P9 (1.00), P10 (1.41) | 4 | core |
| P8 | (7, 5) | P7 (1.00), P9 (1.41), P10 (1.00), P11 (1.41) | 5 | core |
| P9 | (6, 6) | P7 (1.00), P8 (1.41), P10 (1.00) | 4 | core |
| P10 | (7, 6) | P7 (1.41), P8 (1.00), P9 (1.00), P11 (1.00), P12 (1.20) | 6 | core |
| P11 | (8, 6) | P8 (1.41), P10 (1.00) | 3 | border of B |
| P12 | (7, 7.2) | P10 (1.20) | 2 | border of B |
| P13 | (4.5, 1) | — (nearest: P2 at 2.50) | 1 | noise |
| P14 | (5, 7.5) | — (nearest: P9 at 1.80) | 1 | noise |

**DBSCAN by hand**

1. **Neighbourhoods.** Compute all pairwise distances and count, for each point, how many lie within 1.5 (itself included) — the $|N_\varepsilon|$ column. Example: P5 = (2, 3) reaches P4 at 1.00, P3 at $\sqrt{2}=1.41$ and P6 at $\sqrt{1.2^2+0.6^2}=\sqrt{1.8}=1.34$, so $|N_\varepsilon(\text{P5})|=4$.
2. **Core test.** $|N_\varepsilon|\ge4$ for P1–P5 and P7–P10: **9 core points**. P11 has 3, P6 and P12 have 2, P13 and P14 have only themselves.
3. **Cluster A.** Scan in order: P1 is an unlabelled core point, so it seeds cluster A. Its neighbours P2, P3, P4 join and are queued. Popping P2 adds nothing new; popping P3 adds **P5**; P4 adds nothing; popping P5 (core) adds **P6**.
4. **Stop at the border.** P6 is popped but is not core, so the search does not continue from it. Cluster A = {P1, …, P6} — 5 core points + 1 border point. Note the asymmetry: P6 is reachable from P5, but P5 is not reachable from P6.
5. **Cluster B.** The scan continues to P7, the next unlabelled core point: it seeds B and brings in P8, P9, P10. P8 adds **P11**, P10 adds **P12**; both are border points and expand nothing. Cluster B = {P7, …, P12} — 4 core + 2 border.
6. **Noise.** P13 and P14 were never reached: P13's nearest point is P2 at 2.50, and P14 is 1.80 from P9 — both farther than ε. Result: **2 clusters, 2 noise points**, with no number of clusters ever specified.
7. **A new point.** DBSCAN has no centroids, so a new $x$ is assigned the cluster of a core point within $\varepsilon$. $x=(3, 2.5)$ is 1.118 from both P4 and P5 (core) → **cluster A**. $x=(4.5, 4.5)$: the nearest core point is P7 at 1.581 > 1.5 → **noise**.

The same 14 points under other settings. Lower ε or higher minPts removes core points; ε = 1.5, minPts = 5 makes P5 non-core (only 4 points), which strands P6 as noise.

| ε | minPts | Core points | Clusters | Noise | What changed |
| --- | --- | --- | --- | --- | --- |
| 1.0 | 4 | 2 | 2 | 6 | only P4 and P10 are core; P1, P6, P7, P12, P13, P14 become noise |
| 1.5 | 3 | 10 | 2 | 2 | P11 (3 points) becomes core |
| **1.5** | **4** | **9** | **2** | **2** | **the worked example** |
| 1.5 | 5 | 4 | 2 | 3 | only P3, P4, P8, P10 core; P6 is now noise |
| 2.0 | 4 | 11 | 2 | 1 | P14 joins B (1.80 from P9) |
| 2.5 | 4 | 12 | 2 | 0 | P13 joins A (2.50 from P2) — nothing is noise |

> Figure: Top: the worked example, step by step — each point's ε = 1.5 ball and neighbour count (9 come out core), then the breadth-first flood fill from P1 (cluster A, 6 points) and P7 (cluster B, 6 points), border points P6, P11 and P12 joining without expanding, P13 and P14 left as noise, and the two new points classified. Bottom: 150 two-moon points plus 12 uniform noise points. Drag the ε and minPts sliders: at the default ε = 0.10, minPts = 5 there are 154 core points, 2 clusters, 6 noise points and ARI 1.000 against the true moons; ε = 0.05 shatters them into 11 clusters with 15 noise points; at ε = 0.13 the moons merge into one. The right panel is the sorted 5-distance curve — every point above the dashed ε line is not core. Toggle k-means (k = 2) to see it score ARI 0.356 on the same moons. Drag the probe to see how a new point would be labelled.

## The algorithm, step by step

**DBSCAN(D, ε, minPts)**

1. **Range queries.** For every point $p$, find $N_\varepsilon(p)$ — with a spatial index (k-d tree, ball tree) or a precomputed distance matrix.
2. **Mark core points:** $\text{core}(p)\leftarrow|N_\varepsilon(p)|\ge\text{minPts}$.
3. **Scan.** For each point $p$ in order: skip it if it is labelled or not core. Otherwise create a new cluster $C$, label $p$ with $C$ and put it in a queue.
4. **Expand.** Pop $q$ from the queue. If $q$ is core, every unlabelled point in $N_\varepsilon(q)$ gets label $C$ and is pushed. If $q$ is a border point, do nothing more. Repeat until the queue is empty.
5. **Finish.** Points still unlabelled are noise (−1).

**Cost**

- **Range queries:** brute force $O(n^2)$ time; with a tree index about $O(\log n)$ each in low dimensions, so $O(n\log n)$ overall — but this degrades to $O(n)$ per query when ε is large or $d$ is high
- **Expansion:** $O(n + \sum_p|N_\varepsilon(p)|)$: every point is queued once, every core point scans its list once
- **Memory:** $O(n)$ if neighbourhoods are recomputed on the fly; scikit-learn stores all neighbour lists, which is $O(\sum_p|N_\varepsilon(p)|)$ and can reach $O(n^2)$ for a large ε
- **Determinism:** core points and noise are fully determined; only a border point within ε of two clusters can change label with the visiting order

## Choosing ε and minPts

**Pick minPts first.** It is a smoothing level, not a scale: a common rule is $\text{minPts}\ge d+1$, with $\text{minPts}=2d$ a good default (Sander et al., 1998) and larger values for noisy or duplicate-heavy data. Then **pick ε from the k-distance plot**: compute every point's distance to its $\text{minPts}$-th nearest point (itself counted), sort, and plot. Points inside clusters have small k-distances; noise has large ones. Put ε at the **knee**, where the curve turns sharply upward. In the worked example the sorted 4-distances are 1.00, 1.00, 1.41 (×7), 1.56, 1.56, then jump to 2.50, 2.72, 2.91 — any ε from 1.56 up to just under 2.5 keeps those last three as non-core.

The knobs that matter in practice (scikit-learn names).

| Setting | Effect | Advice |
| --- | --- | --- |
| `eps` | radius of the neighbourhood; the main scale knob | read it off the k-distance knee after scaling features; small changes can merge or split clusters |
| `min_samples` | density threshold and smoothing | start at 2·d (at least d+1); raise it for noisy data |
| `metric` | what “close” means | Euclidean for scaled numeric data; cosine for embeddings / text; haversine for lat-lon (in radians) |
| `algorithm` | neighbour search: auto, ball_tree, kd_tree, brute | trees for low d; `brute` with a precomputed sparse radius graph for high d |
| `sample_weight` | a point of weight w counts w times toward min_samples | compress duplicate rows instead of repeating them |

**Variants and relatives**

- **DBSCAN*:** border points are treated as noise, so the result no longer depends on the visiting order (used inside HDBSCAN)
- **OPTICS:** orders points by reachability distance once, so clusterings for every ε ≤ ε_max can be read off one plot — see the **OPTICS** article
- **HDBSCAN:** builds the full hierarchy over all density levels and keeps the most stable clusters; handles clusters of different densities and needs only a minimum cluster size — see **HDBSCAN**
- **GDBSCAN / ST-DBSCAN:** generalize the neighbourhood predicate and the density count, e.g. separate radii in space and time for trajectories
- **Mean shift:** another density method, but it climbs to the modes of a smooth KDE instead of thresholding a flat one — see **Mean Shift**

> **One ε cannot fit clusters of different densities:** If one cluster is tight and another is diffuse, an ε small enough to keep the tight cluster apart from its neighbour turns the diffuse one into noise, and an ε large enough for the diffuse one merges the tight ones. This is a direct consequence of thresholding density at a single level $\lambda$. Use **HDBSCAN** or **OPTICS** instead.

> **Scale your features — and beware high dimensions:** ε is one radius in all directions, so a feature measured in thousands drowns one measured in fractions: standardize first. In tens or hundreds of dimensions, distances concentrate (nearest and farthest neighbours become almost equally far), the k-distance plot loses its knee, and ε becomes nearly impossible to set. Reduce dimension first (PCA, UMAP) or use a metric suited to the data, such as cosine for embeddings.

## In code

```python
import numpy as np

def dbscan(X, eps, min_pts):
    n = len(X)
    D = np.sqrt(((X[:, None] - X[None]) ** 2).sum(-1))   # pairwise distances
    nbrs = [np.flatnonzero(D[i] <= eps) for i in range(n)] # N_eps(i), includes i
    core = np.array([len(nb) >= min_pts for nb in nbrs])
    labels = np.full(n, -1)                                # -1 = noise / unvisited
    c = -1
    for i in range(n):
        if labels[i] != -1 or not core[i]:
            continue                                       # only an unlabelled core starts a cluster
        c += 1
        labels[i] = c
        queue = [i]
        while queue:                                       # breadth-first flood fill
            p = queue.pop(0)
            if not core[p]:
                continue                                   # border point: joins, never expands
            for q in nbrs[p]:
                if labels[q] == -1:
                    labels[q] = c
                    queue.append(q)
    return labels, core

X = np.array([[1, 1], [2, 1], [1, 2], [2, 2], [2, 3], [3.2, 3.6],
              [6, 5], [7, 5], [6, 6], [7, 6], [8, 6], [7, 7.2],
              [4.5, 1], [5, 7.5]])
labels, core = dbscan(X, eps=1.5, min_pts=4)
kind = np.where(core, "core", np.where(labels >= 0, "border", "noise"))
for i, (l, k) in enumerate(zip(labels, kind), 1):
    print(f"P{i:<2} cluster {l:>2}  {k}")
# P1-P5 cluster 0 core, P6 cluster 0 border, P7-P10 cluster 1 core,
# P11, P12 cluster 1 border, P13, P14 cluster -1 noise
```

From scratch in NumPy: neighbourhoods, core test, breadth-first expansion. Prints the labels from the worked example.

```python
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn.neighbors import NearestNeighbors

X = np.array([[1, 1], [2, 1], [1, 2], [2, 2], [2, 3], [3.2, 3.6],
              [6, 5], [7, 5], [6, 6], [7, 6], [8, 6], [7, 7.2],
              [4.5, 1], [5, 7.5]])

db = DBSCAN(eps=1.5, min_samples=4).fit(X)        # min_samples counts the point itself
print("labels:", db.labels_)                       # -1 = noise
print("core:  ", db.core_sample_indices_ + 1)      # 1-based point names

# Choosing eps: distance to the 4th nearest point (the point itself is the 1st)
d4 = NearestNeighbors(n_neighbors=4).fit(X).kneighbors(X)[0][:, -1]
print("sorted 4-distances:", np.sort(d4).round(3))

# DBSCAN has no predict(): attach a new point to a core point within eps, else noise
core = X[db.core_sample_indices_]
nn = NearestNeighbors(n_neighbors=1).fit(core)
dist, idx = nn.kneighbors([[3, 2.5], [4.5, 4.5]])
new = np.where(dist[:, 0] <= db.eps, db.labels_[db.core_sample_indices_][idx[:, 0]], -1)
print("new points:", new, "nearest-core distances:", dist[:, 0].round(3))

# labels: [ 0  0  0  0  0  0  1  1  1  1  1  1 -1 -1]
# core:   [ 1  2  3  4  5  7  8  9 10]
# sorted 4-distances: [1. 1. 1.414 1.414 1.414 1.414 1.414 1.414 1.414 1.562 1.562 2.5 2.72 2.907]
# new points: [ 0 -1] nearest-core distances: [1.118 1.581]
```

scikit-learn on the same data, the k-distance values used to choose ε, and labelling new points via the core samples.

> **Why no fit_predict on new data:** `DBSCAN.fit_predict` clusters the data you pass it from scratch; there is no `predict`. Adding points can turn border points into core points and merge clusters, so the honest options are to re-run DBSCAN, or to use the core-point rule above (HDBSCAN offers `approximate_predict` for the same purpose).

**Strengths**

- Clusters have arbitrary shapes — crescents, rings, road networks, river bends.
- You do not know the number of clusters, and want it found from the data.
- The data contain outliers that should be flagged, not forced into a cluster.
- Clusters have similar density and a meaningful distance scale (e.g. metres on a map).

**Limitations**

- Clusters differ a lot in density — use HDBSCAN or OPTICS.
- The data are high-dimensional without a good metric: ε cannot be chosen.
- Clusters touch through thin bridges of points: they get chained into one.
- You need a model that labels new points cheaply, or soft memberships — use a Gaussian mixture.

- **Geospatial hot spots:** GPS fixes, crime reports or taxi pickups with the haversine metric and ε in metres: dense places become clusters, isolated pings become noise.
- **Anomaly and fraud screening:** Transactions or log events that land in no dense region are the noise label — an outlier detector with no training labels.
- **Point clouds and imagery:** Segmenting LiDAR scans into objects, and grouping detections or pixels in astronomy and microscopy where shapes are irregular.
- **Trajectories and sensors:** Finding stay points in movement data and recurring operating modes in machine telemetry (with ST-DBSCAN for space + time).

> **Noise is an answer, not a failure:** A label of −1 means *this point is not in any region at least as dense as you asked for*. If too much is noise, the question is about density, not about the algorithm: lower minPts, raise ε, or accept that the data have no structure at that scale.

**Question:** With ε = 1.5 and minPts = 4, point P11 = (8, 6) has 3 points in its ε-ball (itself, P8, P10), and P10 is a core point. P11 is…

- A. a core point
- B. a border point of P10's cluster
- C. noise
- D. a cluster of its own

**Answer:** B. a border point of P10's cluster — 3 < 4, so P11 is not core; but it lies within ε of the core point P10 (distance 1.00), so it is directly density-reachable and joins B as a border point.

**Question:** In the worked example, keep ε = 1.5 but raise minPts from 4 to 5. What happens to P6 = (3.2, 3.6)?

- A. It becomes core
- B. It stays a border point of A
- C. It becomes noise
- D. It forms a new cluster with P5

**Answer:** C. It becomes noise — P6's only neighbour is P5. With minPts = 5, P5 has only 4 points in its ball, so it is no longer core; P6 is then within ε of no core point and becomes noise (the run gives 4 core points, 2 clusters, 3 noise).

**Question:** Why does the expansion step never continue from a border point?

- A. To save time
- B. Because a border point is not dense, so following it could join two clusters that only share a fringe point
- C. Because border points are always noise
- D. Because border points have no neighbours

**Answer:** B. Because a border point is not dense, so following it could join two clusters that only share a fringe point — Density-reachability chains may only pass through core points. Expanding from border points would turn DBSCAN into single-linkage clustering and chain separate clusters together through sparse fringes.

**Question:** On the two-moons explorer (minPts = 5), what happens as ε increases from 0.05 to 0.13?

- A. The number of clusters grows from 2 to 11
- B. 11 clusters merge to the 2 moons (at 0.08–0.12) and then into 1 cluster
- C. The noise count increases
- D. Nothing — DBSCAN is insensitive to ε

**Answer:** B. 11 clusters merge to the 2 moons (at 0.08–0.12) and then into 1 cluster — At ε = 0.05 the moons fall apart into 11 clusters with 15 noise points; from 0.08 to 0.12 there are exactly the 2 moons (ARI 1.000); at 0.13 the ε-balls bridge the gap and everything is one cluster. Noise only falls as ε grows.

**Key points**

- A point is **core** if its $\varepsilon$-ball holds at least $\text{minPts}$ points (itself included); **border** if it is within $\varepsilon$ of a core point; otherwise **noise**.
- Clusters are the connected components of the graph of core points linked within ε, plus their border points — found by breadth-first search that never expands from a border point.
- The number of clusters is an output, shapes can be arbitrary, and outliers are labelled −1 rather than forced into a cluster.
- DBSCAN thresholds a flat-kernel density estimate at one level $\lambda=\text{minPts}/(nV_d\varepsilon^d)$, so it cannot handle clusters of very different densities — that is what OPTICS and HDBSCAN fix.
- Choose minPts ≈ 2·d, then read ε off the knee of the sorted k-distance plot — after scaling features.

---

From MLFoundry (https://www.mlfoundry.in). The web page adds interactive figures and diagrams.
