Density-Based Methods
Density-based methods treat clusters as dense regions separated by sparse regions, so they find clusters of any shape and identify noise.
DBSCAN has two parameters: eps (the radius of the neighbourhood) and MinPts (the minimum number of points in the eps-neighbourhood).
- Core point: has at least MinPts points within eps (counting itself).
- Border point: not a core point but lies within eps of a core point.
- Noise point: neither core nor border.
A cluster is a set of core points that are density-connected, together with their border points. The algorithm picks an unvisited core point and expands a cluster by adding all points reachable from it. It needs no k, but one eps does not suit clusters of very different density.
OPTICS produces a cluster ordering (reachability plot) that works for a range of eps values, and DENCLUE models density with influence functions.
Grid-Based Methods
Grid-based methods divide the space into a finite number of cells and cluster the cells, so the time depends on the number of cells and not on the number of objects (very fast).
- STING: a hierarchy of rectangular cells in which each cell stores statistics (count, mean, standard deviation); a query descends from top cells, discarding irrelevant ones.
- CLIQUE: divides every dimension into intervals, finds dense units and combines them; it also finds clusters in subspaces of high-dimensional data.
- WaveCluster: applies a wavelet transform to the grid to find dense regions.
Definition: Core point. A point with at least MinPts points, including itself, inside its eps-neighbourhood; the cluster grows from core points.
Table 4.3: Density-based and grid-based methods
| Method | Idea | Strength |
|---|---|---|
| DBSCAN | Core, border and noise points | Any shape, finds noise |
| OPTICS | Cluster ordering | Varying density |
| STING | Hierarchy of statistical cells | Very fast |
| CLIQUE | Dense units in subspaces | High-dimensional data |
Example 4.3: DBSCAN with eps = 1.5 and MinPts = 3
Problem: Cluster the one-dimensional points 1, 2, 3, 4, 10, 11, 12 and 25 using DBSCAN with eps = 1.5 and MinPts = 3.
Solution:
- Neighbours within 1.5 (counting the point itself): 1 has 2, 2 has 3, 3 has 3, 4 has 2, 10 has 2, 11 has 3, 12 has 2 and 25 has 1.
- Core points are 2, 3 and 11.
- From core points 2 and 3 the cluster grows to 1 and 4 (border points): cluster 1 = {1, 2, 3, 4}.
- From core point 11 the cluster reaches 10 and 12: cluster 2 = {10, 11, 12}.
- The point 25 has no core point nearby, so it is noise.
Result: Two clusters {1, 2, 3, 4} and {10, 11, 12}, and one noise point 25.
pts = [1, 2, 3, 4, 10, 11, 12, 25]
eps, minpts = 1.5, 3
near = {p: [q for q in pts if abs(p - q) <= eps] for p in pts}
core = [p for p in pts if len(near[p]) >= minpts]
print("Core points:", core)
label, cid = {}, 0
for c in core:
if c in label:
continue
cid += 1
stack = [c]
while stack:
x = stack.pop()
if x in label:
continue
label[x] = cid
if x in core:
stack += near[x]
for k in range(1, cid + 1):
print("Cluster", k, [p for p in pts if label.get(p) == k])
print("Noise:", [p for p in pts if p not in label])
Output
Core points: [2, 3, 11]
Cluster 1 [1, 2, 3, 4]
Cluster 2 [10, 11, 12]
Noise: [25]
Common mistakes
- Choosing eps too small, so that most points become noise.
- Choosing eps too large, so that separate clusters merge.
- Using one eps for clusters with very different densities.
- Forgetting that a point counts itself in MinPts.
Key takeaways
- DBSCAN: eps, MinPts; core, border and noise points.
- Density-based methods find arbitrary shapes and noise.
- Grid methods cluster cells, so their time does not depend on the number of objects.
- STING stores statistics in a hierarchy of cells; CLIQUE finds subspace clusters.
Practice questions
- What are the two parameters of DBSCAN?
- Why are grid-based methods fast?
- What is a noise point?
Answers to the practice questions
- eps (radius) and MinPts (minimum points).
- Their time depends on the number of cells, not the number of objects.
- A point that is neither a core point nor a border point.
Sources
- Official BCA syllabus Data Warehousing and Mining, course code 25BCA406DS03, Unit IV
