0% found this document useful (0 votes)
18 views27 pages

Understanding DBSCAN Clustering Algorithm

The document discusses DBSCAN, a density-based clustering algorithm that identifies clusters without requiring a predefined number of clusters. It explains key concepts such as core points, border points, and noise points, as well as the hyperparameters minPts and eps. Additionally, it covers the algorithm's strengths and weaknesses, internal measures for evaluating clustering quality, and the silhouette coefficient for assessing individual points.

Uploaded by

Istiak Utsab
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views27 pages

Understanding DBSCAN Clustering Algorithm

The document discusses DBSCAN, a density-based clustering algorithm that identifies clusters without requiring a predefined number of clusters. It explains key concepts such as core points, border points, and noise points, as well as the hyperparameters minPts and eps. Additionally, it covers the algorithm's strengths and weaknesses, internal measures for evaluating clustering quality, and the silhouette coefficient for assessing individual points.

Uploaded by

Istiak Utsab
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Data Mining and Machine

Learning
Topic Contents

DBSCAN
Recommended
3

Reading

“Introduction to Data Mining,”


Pang-Ning Tan, Michael Steinbach
and Vipin Kumar, Addison Wesley,
2006.
 Chapter 8 (Cluster Analysis: Basic
Concepts and Algorithms)

3
Clustering

Problem description
 Given:

A data set of N data items which are d-dimensional data


feature vectors.
 Task:

Determine a natural, useful partitioning of the data set into a


number of clusters (k) and noise.
DBSCAN

 Unlike k-means, the desire number of cluster is not given as


input. Rather DBSCAN determine dense cluster from data
point.
 Density is define as a minimum number of point at within a
certain distance of point each other.
 It handled outlier problem easily and efficiently. Since outlier
are not dense hence they can not form a cluster.
DBSCAN

 Minimum point & Threshold value.


 minPts: The minimum number of points (a threshold) clustered
together for a region to be considered dense i.e. the minimum
number of data points that can form a cluster
 eps (ε): A distance measure that will be used to locate the
points in the neighborhood of any point.

This two are the hyperparameter need to tune to use this


algorithm.
DBSCAN

Core Point, Noise Point, Border Point.


[Link] data point: A data point which has at least ‘minPts’ within
the distance of ‘ε’.
[Link] data point: A data point which is in within ‘ε’ distance
from core data point but not a core point.
[Link] data point: A data point which is neither core nor border
data point.
DBSCAN
DBSCAN: Core, Border, and Noise Points
DBSCAN: Determining EPS and MinPts

 Idea is that for points in a cluster, their kth nearest


neighbors are at roughly the same distance
 Noise points have the kth nearest neighbor at farther
distance
 So, plot sorted distance of every point to its kth
nearest neighbor
DBSCAN Algorithm

 Eliminate noise points


 Perform clustering on the remaining points
DBSCAN

 Simplified DBSCAN Algorithm

Step 1 — Identify all points as either core point, border point or


noise point.
Step 2 — For all of the unclustered core points.
Step 2a — Create a new cluster.
Step 2b — add all the points that are unclustered and density
connected to the current point into this cluster.
DBSCAN

 DBSCAN is a density-based algorithm.


– Density = number of points within a specified radius (Eps)

– A point is a core point if it has more than a specified number


of points (MinPts) within Eps
 These are points that are at the interior of a cluster

– A border point has fewer than MinPts within Eps, but is in


the neighborhood of a core point

– A noise point is any point that is not a core point or a border


point.
DBSCAN

 Simplified DBSCAN Algorithm

Step 1 — Identify all points as either core point, border point


or noise point.
Step 2 — For all of the unclustered core points.
Step 2a — Create a new cluster.
Step 2b — add all the points that are unclustered and
density connected to the current point into this cluster.
DBSCAN
DBSCAN
DBSCAN
DBSCAN: Core, Border and Noise Points

Original Points Point types: core,


border and noise

Eps = 10, MinPts = 4


When DBSCAN Works Well

Original Points Clusters

• Resistant to Noise
• Can handle clusters of different shapes and sizes
When DBSCAN Does NOT Work Well

(MinPts=4, Eps=9.75).

Original Points

• Varying densities
• High-dimensional data
(MinPts=4, Eps=9.92)
Statistical Framework for Correlation

 Correlation of incidence and proximity matrices for the


K-means clusterings of the following two data sets.

1 1

0.9 0.9

0.8 0.8

0.7 0.7

0.6 0.6

0.5 0.5
y

0.4 0.4

0.3 0.3

0.2 0.2

0.1 0.1

0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
x x

Corr = -0.9235 Corr = -0.5810


Internal Measures: Cohesion and Separation

 Cluster Cohesion: Measures how closely related


are objects in a cluster
– Example: SSE
 Cluster Separation: Measure how distinct or well-
separated a cluster is from other clusters
 Example: Squared Error
– Cohesion is measured by the within cluster sum of squares (SSE)
WSS   ( x  mi )2
i xC i
– Separation is measured by the between cluster sum of squares

BSS  Ci ( m  mi ) 2

i
– Where |Ci| is the size of cluster i
Internal Measures: Cohesion and
Separation

 Example: SSE
– BSS + WSS = constant
m
  
1 m1 2 3 4 m2 5

K=1 cluster: WSS(1  3) 2  ( 2  3) 2  ( 4  3) 2  (5  3) 2 10


BSS4 (3  3) 2 0
Total 10  0 10

K=2 clusters: WSS(1  1.5) 2  ( 2  1.5) 2  ( 4  4.5) 2  (5  4.5) 2 1


BSS2 (3  1.5) 2  2 ( 4.5  3) 2 9
Total 1  9 10
Internal Measures: Cohesion and Separation

 A proximity graph based approach can also be used for


cohesion and separation.
– Cluster cohesion is the sum of the weight of all links within a cluster.
– Cluster separation is the sum of the weights between nodes in the cluster
and nodes outside the cluster.

cohesion separation
Internal Measures: Silhouette Coefficient

 Silhouette Coefficient combine ideas of both cohesion and separation,


but for individual points, as well as clusters and clusterings
 For an individual point, i
– Calculate a = average distance of i to the points in its cluster
– Calculate b = min (average distance of i to points in another cluster)
– The silhouette coefficient for a point is then given by

s = 1 – a/b if a < b, (or s = b/a - 1 if a  b, not the usual case)

b
– Typically between 0 and 1. a
– The closer to 1 the better.

 Can calculate the Average Silhouette width for a cluster or a


clustering

Common questions

Powered by AI

In DBSCAN, each point is initially classified as either a core, border, or noise point. A core point has at least 'minPts' neighbors within the 'eps' radius, forming the core of a cluster . Border points lie within the 'eps' radius of core points but don't meet the 'minPts' threshold themselves, aiding in connecting clusters but not forming their cores. Noise points are those which are neither core nor border points, effectively being isolated from clusters . DBSCAN examines each unvisited point, marking it as a core point if it meets the neighbor condition, expanding clusters by connecting density-reachable points, and subsequently adjusting points' classifications . This methodology enables it to delineate well-separated clusters and exclude noise effectively .

DBSCAN can perform poorly in situations where there are clusters of varying densities or in high-dimensional spaces. In cases of varying densities, DBSCAN may struggle to differentiate between dense cluster borders and noise, as it applies a uniform density threshold across the dataset . In high-dimensional spaces, the distance metric may become less meaningful due to the curse of dimensionality, making it difficult for DBSCAN to accurately determine the neighborhood (eps distance) of points .

Internal measures such as cohesion and separation provide crucial insights into the quality of clusters formed by DBSCAN. Cohesion, typically measured by the within-cluster sum of squares (WSS), reflects how closely related the data points within a cluster are, indicating cluster compactness . Separation, measured by the between-cluster sum of squares (BSS), assesses how distinct a cluster is from other clusters. For DBSCAN, these metrics can indicate how well the density-based clustering maintains distinct, cohesive groupings, with optimal clustering reflected in high separation and low cohesion scores . Using these measures allows for the tuning of DBSCAN parameters to optimize clustering performance according to the desired balance of cohesion and separation .

Changing the 'eps' parameter in DBSCAN affects the radius of the region considered when determining the neighborhood of points, while 'minPts' determines the minimum number of neighbors required to form a cluster . Increasing 'eps' can merge smaller clusters into larger ones, or include noise points within clusters, whereas a smaller 'eps' may fragment existing clusters. Similarly, increasing 'minPts' may result in fewer, larger clusters by raising the density requirement for core points, whereas decreasing it can lead to more, but possibly less significant, clusters. Choosing these parameters impacts DBSCAN's sensitivity to cluster size and noise, necessitating careful selection based on the dataset's characteristics .

DBSCAN differs from k-means in that it does not require a predefined number of clusters; instead, it identifies clusters based on the density of data points. This makes DBSCAN particularly effective for identifying clusters of arbitrary shapes and handling noise, as it can effectively isolate noise points that do not belong to any cluster . Conversely, k-means assumes spherical clusters and can struggle with datasets that contain noise or clusters of varying shapes and densities, requiring prior knowledge of the number of clusters .

The critical hyperparameters of DBSCAN are 'eps' and 'minPts.' The 'eps' parameter defines the radius within which to search for neighboring data points, while 'minPts' specifies the minimum number of points required to form a dense region, making it a core point . These parameters directly influence the clustering process by determining the size and shape of clusters: smaller 'eps' values can result in more, smaller clusters, while larger 'eps' values can lead to fewer, larger clusters and noise .

DBSCAN classifies a point as a core point if it has at least 'minPts' other points within its 'eps' neighborhood. A border point falls within the 'eps' distance of a core point but does not satisfy the 'minPts' condition itself. A noise point is neither a core nor a border point, as it lacks sufficient neighboring points . These classifications are based on local density, allowing DBSCAN to structure clusters around dense regions while leaving sparse areas as noise .

To handle DBSCAN's limitations with datasets featuring varying densities, one strategy is to employ an adaptive version of DBSCAN, where 'eps' is dynamically adjusted based on local point densities. This can mitigate issues of uniform density requirements across diverse clusters . For high-dimensional data, dimensionality reduction techniques such as PCA (Principal Component Analysis) can be applied prior to clustering with DBSCAN to reduce the noise and make the distance metric more meaningful . Additionally, using alternative distance metrics that are better suited to high-dimensional spaces, such as cosine similarity, can improve DBSCAN's performance by providing more relevant distance calculations in such contexts .

The silhouette coefficient combines cohesion and separation into a single metric, allowing for an assessment of how well-separated a cluster is from others while also considering how compact the cluster is . For each point, it measures the average distance to points within the same cluster (cohesion) versus the minimum average distance to points in another cluster (separation). Values close to 1 indicate well-defined, distinct clusters, whereas values close to -1 may indicate misclassified points or overlapping clusters. This makes it particularly useful for evaluating clustering algorithms like DBSCAN, which can create clusters with varying shapes and densities .

In DBSCAN, core points meet the minimum density requirement and form the cluster's interior, while border points are within the neighborhood boundary of a core point but do not meet the density requirement themselves . Noise points are neither core nor border points and are thus excluded from any cluster. This categorization allows DBSCAN to effectively handle datasets with noise, as it isolates sparse regions of lower density as noise points, maintaining the integrity of dense clusters .

You might also like