DBSCAN: distinguish noise from a bad density setting
In this article (3 sections)
DBSCAN labels rows in low-density regions as -1. That label means “not density-connected under this eps and min_samples setting.” It does not mean fraud, bad data or a business exception.
Change one setting and observe four different stories
Our fixture contains 400 points sampled from two noisy interlocking moons. We standardize both coordinates and hold min_samples=5 fixed.
| eps | Clusters | Noise rows | ARI against generator shape |
|---|---|---|---|
| 0.10 | 34 | 92 | 0.0398 |
| 0.20 | 2 | 4 | 0.9801 |
| 0.30 | 2 | 0 | 1.0000 |
| 0.50 | 1 | 0 | 0.0000 |
At eps=0.10, neighbourhoods are too tight and the data fragment into 34 clusters. At 0.50, density chains connect everything into one cluster. The same row can be “noise” or part of a large cluster solely because the scale setting changed.
The scikit-learn clustering guide describes DBSCAN's density connectivity and noise label. Generator ARI is available here only because the synthetic shape was authored.
from unsupervised_cases import dbscan_case
r = dbscan_case()
assert r['min_samples'] == 5
assert [row['noise_rows'] for row in r['candidates']] == [92, 4, 0, 0]
assert [row['clusters'] for row in r['candidates']] == [34, 2, 2, 1]
print(r)Run the sweep in the unsupervised lab. It records all declared settings rather than presenting only the most attractive plot.
Make density relative to representation
Scale numeric features and justify the distance metric. A large-unit variable can dominate the neighbourhood radius. In high dimensions, distances can become less informative, making density settings difficult to interpret. Categorical encodings need a metric consistent with their meaning.
Use a k-distance plot as a diagnostic, then test a bounded parameter range. Inspect cluster size, noise rate, stability and representative rows. Varying density across the dataset can defeat a single global eps; OPTICS or HDBSCAN may be relevant, but they introduce new assumptions rather than automatically solving the task.
If noise rows feed review, label the queue “density exceptions” until independent evidence says otherwise. Sample and investigate them. Some will be valid rare customers, boundary cases or data errors. Report how review conclusions change across plausible settings.
Exercise: multiply one moon coordinate by 100 and run DBSCAN before and after standardization. Trace five row IDs across the parameter grid. Define the evidence required before any noise label can trigger a real action.
NeuraPath's Data Science course connects density algorithms to parameter sensitivity and review evidence. A DBSCAN noise label is a model output with a documented setting, not a verdict.
Continue learning
This article is part of the Clustering, reduction and recommendations sequence. Use the neighbouring tasks when you need the prerequisite or the next application.
- Review the prerequisite or neighbouring task in Silhouette scores: useful signal and common misinterpretations.
- Continue with Hierarchical clustering with a defensible distance metric.
Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.
This article is part of our Data Science programme — 6 months. From data foundations to machine learning, deep learning and deployment.
Explore Data Science