The eps and min_samples Parameters in DBSCAN
DBSCAN sorts every point into a core point, a boundary point, or noise, based on distance eps and the neighborhood count min_samples.
Start with the labels
DBSCAN returns a cluster label for each point. One label has a special meaning: -1 marks a point that DBSCAN classified as noise. The other entries are cluster labels. Reading the output starts with matching each array position to its point, then locating every -1.
For example, consider this illustrative label array: [0, 0, -1, 1, -1]. The entries at positions 2 and 4 are -1, so those two corresponding points were labeled as noise. The array positions matter: the noise points are the points at those positions in the original data, not the numbers 2 and 4 themselves.
Classify each point by its neighborhood
DBSCAN sorts points into three groups. A core point has enough samples in its neighborhood to meet min_samples. The neighborhood is determined by eps: it includes samples no farther away than eps. A boundary point is not core, but it lies within eps of a core point. A noise point is neither core nor within eps of any core point. In short, min_samples sets the neighbor-count requirement for being core, while eps determines which samples count as neighbors.
The neighborhood picture is a way to keep the two settings distinct. First, eps decides which samples are in a point's neighborhood. Then the neighborhood count is compared with min_samples to decide whether the point is core. A point that fails the core test may still be boundary if it is within eps of a core point; otherwise it is noise.
Work from a label array
Find noise in an illustrative output
Given the generated label array [0, 0, -1, 1, -1], identify which positions correspond to noise.
- 1Scan for -1
The noise label is -1. In this array it appears at positions 2 and 4.
- 2Map positions to points
Use the same positions in the input data to find the two points that received those labels.
- 3Keep labels and positions separate
The values 2 and 4 identify array positions in this example. They are not cluster labels.
The points at positions 2 and 4 are labeled as noise.
When a boundary point touches two clusters
A boundary point is within eps of a core point but does not meet the core-point requirement itself. A boundary point can be near core samples from more than one cluster. In that situation, its assigned cluster membership can depend on the order in which points are visited. The point's status as non-core does not change; what can vary is which cluster claims it.
The diagram contrasts two possible visit orders to make the order-dependence visible. It is not a claim that every boundary point is ambiguous: the issue arises when a boundary point can neighbor core samples from more than one cluster.
How parameter changes affect noise
Changing eps changes which samples fall inside neighborhoods. Raising eps tends to reduce the number of noise points and can merge clusters. The word tends matters: the exact labels depend on the data and the settings together, so treat this as a general effect rather than a promise about every point.
Raising min_samples makes the core-point test harder to meet because a point needs a larger neighborhood count to qualify as core. The source comparison shows that raising min_samples can increase the number of noise points. As with eps, inspect the output for the particular data and settings rather than assuming that every individual point changes in the same way.
Check your interpretation
A DBSCAN result contains the illustrative labels [2, -1, 2, 0, -1]. Which positions are noise? Then explain, using the point categories, what must be true of a point labeled -1.
Hints
- Scan the array for -1 and use zero-based positions.
- A noise point is not core and is not within eps of any core point.
Common mistake Treating every point that is not core as noise
What it looks likeA point fails the min_samples requirement but lies within eps of a core point.
Why it failsThat point is a boundary point, not noise.
Do this insteadCheck whether the non-core point is within eps of any core point before calling it noise.
Common mistake Reading the value -1 as an ordinary cluster label
What it looks likeA label array contains -1 at one position.
Why it failsDBSCAN uses -1 to mark noise.
Do this insteadIdentify the corresponding point by its array position and treat it as noise.
Common mistake Assuming a boundary point always joins the same cluster
What it looks likeA boundary point can neighbor core samples from more than one cluster.
Why it failsIts cluster membership can depend on visit order.
Do this insteadWhen discussing an ambiguous boundary point, include the visit order as part of the explanation.
Common mistake Treating the usual parameter trends as guarantees for every point
What it looks likeRaising eps tends to reduce noise, while raising min_samples can increase it.
Why it failsThese are general effects, not a guarantee that every individual label changes in one fixed way.
Do this insteadCompare the actual label arrays produced by the settings being studied.
Key Takeaways
- eps determines which samples are in a point's neighborhood;
min_samplessets the neighborhood-count requirement for being core. - A boundary point is non-core but within eps of a core point. Noise is neither core nor within eps of any core point.
- In a DBSCAN label array, -1 marks noise; use the array position to identify the corresponding point.
- Raising eps tends to reduce noise and can merge clusters, while raising
min_samplescan increase noise. - A boundary point near core samples from multiple clusters can have cluster membership that depends on visit order.