What is DBSCAN?

Visualization of the DBSCAN clustering algorithm graph
Title: Visualization of the DBSCAN clustering algorithm.
Source: Finsformer article by Hao An et al on ResearchGate

Introduction

DBSCAN stands for Density-Based Spatial Clustering of Applications with Noise, is an unsupervised clustering algorithm that groups data points based on local density rather than distance to a centroid. The central idea is that clusters are regions in the data space where points are densely packed together, separated by regions of low density. Unlike algorithms such as K-Means, DBSCAN does not require the number of clusters to be specified beforehand and can naturally identify noise and outliers. This makes it particularly effective for real-world data, which is often noisy and contains clusters of arbitrary shapes.

Key Parameters in DBSCAN:

Visualization of DBSCAN: core, border, and noise points
Title: DBSCAN: core, border, and noise points
Source: Clustering Algorithms Survey Paper by Amineh Amini et al

DBSCAN relies on two hyperparameters: ε (epsilon) and MinPts

ε (epsilon), which defines the radius of a neighborhood, and MinPts, which specifies the minimum number of points required to form a dense region.

The ε-neighborhood of a point p is defined as: 

$$N_\varepsilon(p) = \{ q \in D \mid \text{dist}(p, q) \le \varepsilon \}$$

where D is the dataset and dist is a distance metric (commonly, Euclidean distance is used).

A point p is called a core point if: 

$$|N_\varepsilon(p)| \ge \text{MinPts}$$

A point is a border point if it lies within the ε-neighborhood of a core point but does not itself satisfy the MinPts condition. A point that is neither a core nor a border point is labeled as noise.

DBSCAN defines two important connectivity notions. A point q is directly density-reachable from a point p if q∈Nε(p) and p is a core point. Density reachability is transitive, and two points are said to be density-connected if there exists a sequence of points linking them through density reachability. A cluster is then defined as a maximal set of density-connected points.

DBSCAN Algorithm:

Flowchart of the DBSCAN clustering algorithm.
Title: High-Level Intuition Diagram of DBSCAN Algorithm
Source: Research article on the Density Clustering Algorithm By Yanfang Zhang
  • Step 1: Choose two parameters – ε (epsilon), which defines the radius of the neighborhood around a point, and MinPts, the minimum number of points required to form a dense region.
  • Step 2: Mark all data points as unvisited.
  • Step 3: Select an unvisited point p and mark it as visited.
  • Step 4: Find all points within distance ε of point p 
  • Step 5:
    • If the number of points in this neighborhood is less than MinPts, label p as noise (temporarily).
    • If the number of points is greater than or equal to MinPts, label p as a core point and start a new cluster.
  • Step 6: Add all points from p’s ε-neighborhood to the cluster.
  • Step 7: For each point q in the cluster:
    • If q is unvisited, mark it as visited and find its ε-neighborhood.
    • If q has at least MinPts neighbors, add those neighbors to the cluster (this expands the cluster).
    • If q is not yet assigned to any cluster, assign it to the current cluster.
  • Step 8: Repeat the expansion process until no new points can be added to the cluster.
  • Step 9: Return to Step 3 and select another unvisited point.
  • Step 10: Continue until all points are visited. All points assigned to clusters form dense regions; points never assigned to any cluster are labeled as noise.

When to Use DBSCAN

Graph of DBSCAN Clustering Result
Title: DBSCAN Clustering Result
Source: AIML.com Research

DBSCAN can be used when the data contains clusters defined by density rather than shape. Unlike centroid-based algorithms, it does not assume spherical or convex clusters, making it well-suited for datasets with irregular, elongated, or curved cluster structures. When data groups appear as dense regions separated by sparse areas, DBSCAN can accurately recover their structure.

DBSCAN is particularly effective in the presence of noise and outliers. Instead of forcing every point into a cluster, it explicitly labels low-density points as noise, which prevents outliers from distorting cluster formation. This makes DBSCAN useful for data such as sensor readings, spatial data, logs, or embeddings, where noisy or rare observations are common.

DBSCAN is also useful when the number of clusters is unknown and should be inferred from the data itself. It automatically determines the number of clusters based on density connectivity, making it suitable for exploratory analysis. However, it performs best when clusters have similar density levels and when distances are meaningful after proper feature scaling.

Real-World Use Case of DBSCAN:

Now that we have understood and realized the scope of DBSCAN lets explore an example of real-world usage of the DBSCAN Algorithm:

DBSCAN is used in Netflix’s work on outlier detection for streaming quality and telemetry monitoring (automatically collected system and performance data during playback). Netflix continuously collects large volumes of high-dimensional metrics from playback sessions, including startup delay, rebuffering events, bitrate changes, device characteristics, and network conditions. Under normal operating conditions, the majority of sessions exhibit similar behavior and form dense regions in metric space, while problematic sessions caused by infrastructure issues, ISP (Internet Service Provider) failures, or device-specific bugs appear as sparse, abnormal patterns.

Density-based clustering methods such as DBSCAN are well-suited for this setting because they separate dense normal behavior regions from isolated anomalies without requiring labeled data. Rather than assuming a fixed number of behavior profiles, DBSCAN can discover natural groupings in telemetry data while automatically identifying rare or unexpected patterns as noise. This aligns closely with Netflix’s goal of tracking down ‘villains’, that is, unusual system behaviors that negatively impact user experience but occur infrequently and are difficult to detect with rule-based thresholds. By identifying dense clusters of healthy sessions and isolating low-density outliers, Netflix engineers can prioritize investigations, diagnose systemic issues, and improve streaming reliability at scale. 

Conclusion:

DBSCAN is a robust clustering method that models structure through data density rather than geometric assumptions. By forming clusters as dense regions and labeling sparse points as noise, it naturally handles irregular shapes, outliers, and unknown cluster counts common in real-world data. Its effectiveness in applications such as geospatial hotspot detection, user behavior analysis, and large-scale outlier detection highlights its continued practical relevance, making DBSCAN a principled and interpretable alternative to centroid-based methods when distances are meaningful.

Videos:

  • This video, “DBSCAN Clustering Explained with Visualization” by TheDataPost, offers an intuitive, animation-driven walkthrough of how DBSCAN forms clusters. It’s especially useful for understanding how DBSCAN discovers arbitrarily shaped clusters and expands them iteratively without requiring the number of clusters in advance (Runtime: 3 mins).
YouTube video
DBSCAN Clustering Explained with Visualization by TheDataPost
  • This video, “ The DBSCAN Clustering Algorithm Explained” by Kilian Weinberger, offers an intuitive, visual walkthrough of DBSCAN. It also contrasts DBSCAN with K-Means to show why DBSCAN excels at discovering arbitrarily shaped clusters and handling noise (Runtime: 8 mins).
YouTube video
The DBSCAN Clustering Algorithm Explained by Kilian Weinberger

Author

  • Master’s student in Computer Science with a strong focus on machine learning, data science, and AI systems.
    Passionate about building and researching intelligent, data-driven solutions, with hands-on experience in ML research, NLP pipelines, and open data ecosystems.
    Enjoys continuous learning and exploring new ideas in AI and data science.

Help us improve this post by suggesting in comments below:

– modifications to the text, and infographics
– video resources that offer clear explanations for this question
– code snippets and case studies relevant to this concept
– online blogs, and research publications that are a “must read” on this topic

Leave the first comment

Partner Ad
Find out all the ways that you can
Contribute