run gruppi-e-zone-dense.bas
MDN-100:18
DEMO by Michele di Nuzzo

Groups and dense areas

MDN · LAB GROUPS AND DENSE AREAS Clustering compared · 1996
sei clienti / mezzelune / clienti di Ordito
six customers, half-moons, Ordito’s customers: the set of points to work on
K-means / DBSCAN / i gruppi del libro
the algorithm, or the book’s five groups on Ordito’s customers
k
how many groups K-means looks for
Un giro
one round of K-means: assigns the points and moves the centres
Fino alla fine
to the end: repeats the rounds until the groups stop changing
Nuova partenza
new start: starts again from other centres
eps / min_samples
DBSCAN’s radius and minimum number of neighbours

▶ Run ⬇ Download (.html)

Two clustering algorithms that reason in opposite ways, on three sets of points. K-means represents each group with a centre and lowers the inertia round after round; DBSCAN looks for dense areas and leaves the noise out. In the first, the number of groups is chosen by whoever uses the algorithm; in the second, it comes from the data. The lab’s interface is in Italian.

Things to try

  • The worked example. On the six customers K-means starts from A and C: in three rounds it reaches {A, B, C} and {D, E, F}.
  • The half-moons. K-means cuts them with a straight line, DBSCAN with eps = 0.2 recovers the two moons.
  • The cloud of customers. DBSCAN finds a single large group or many fragments, K-means divides anyway.

The article: Groups and dense areas.

The demo is a single HTML file: download it and use it offline, even without an internet connection. Licence: CC BY-NC 4.0 — you may share it, crediting the author and this page, but not for commercial purposes.