Loading the lesson...
In the print dialog, choose "Save as PDF" as the destination.
Machine Learning and AI - Lab 5
Density-based clustering that finds arbitrary shapes and flags outliers
DBSCAN: Density-Based Spatial Clustering of Applications with NoiseK-Means: no need to pick the number of clusters upfrontminPts points within distance ε (including itself).ε of a core point.ε of any core point.ε)minPtsPick unvisited point
Count neighbors
within ε
≥ minPts?
including the point itself
Mark Core, expand cluster
recursively add each core neighbor's neighbors
Classify remainder
Border or Noise
DBSCAN uses Euclidean distance between pointsSolved Example
12 points P1 through P12 with (x, y) coordinatesminPts = 4, epsilon = 1.9| Point | Coordinates |
|---|---|
| P1 | (3, 7) |
| P2 | (4, 6) |
| P3 | (5, 5) |
| P4 | (6, 4) |
| P5 | (7, 3) |
| P6 | (6, 2) |
| P7 | (7, 2) |
| P8 | (8, 4) |
| P9 | (3, 3) |
| P10 | (2, 6) |
| P11 | (3, 5) |
| P12 | (2, 4) |
12x12)Solved Example
epsilon = 1.9| Point | Neighbors within ε = 1.9 |
|---|---|
| P1 | P2, P10 |
| P2 | P1, P3, P11 |
| P3 | P2, P4 |
| P4 | P3, P5 |
| P5 | P4, P6, P7, P8 |
| P6 | P5, P7 |
| P7 | P5, P6 |
| P8 | P5 |
| P9 | P12 |
| P10 | P1, P11 |
| P11 | P2, P10, P12 |
| P12 | P9, P11 |
P5's neighbors: P4, P6, P7, P8, four neighborsP9's neighbors: P12 only, one neighborSolved Example
minPts = 4, a point needs at least 4 neighbors including itself to be Core| Point | Neighbors (excl. self) | Total incl. self | Core? |
|---|---|---|---|
| P1 | 2 | 3 | No |
| P2 | 3 | 4 | Yes |
| P3 | 2 | 3 | No |
| P4 | 2 | 3 | No |
| P5 | 4 | 5 | Yes |
| P6 | 2 | 3 | No |
| P7 | 2 | 3 | No |
| P8 | 1 | 2 | No |
| P9 | 1 | 2 | No |
| P10 | 2 | 3 | No |
| P11 | 3 | 4 | Yes |
| P12 | 2 | 3 | No |
P2, P5, P11P9 has no core point nearby, so it is classified as Noise| Point | Cluster | Role |
|---|---|---|
| P1 | Cluster 2 | Border |
| P2 | Cluster 2 | Core |
| P3 | Cluster 2 | Border |
| P4 | Cluster 1 | Border |
| P5 | Cluster 1 | Core |
| P6 | Cluster 1 | Border |
| P7 | Cluster 1 | Border |
| P8 | Cluster 1 | Border |
| P9 | - | Noise |
| P10 | Cluster 2 | Border |
| P11 | Cluster 2 | Core |
| P12 | Cluster 2 | Border |
P5, and includes Border Points P4, P6, P7, P8P2, P11, and includes Border Points P1, P3, P10, P12P9 remains unclustered, a genuine noise/outlier pointDBSCAN produced 2 clusters plus 1 noise point from 12 raw points, with no k specified upfrontepsilon and minPtsepsilon and minPtsDBSCAN discovers cluster count automatically from data densityK-Meansepsilon and minPts is essential for good resultsMahmoud Abas|DBSCAN Clustering Algorithm Lab