Where to go on a Friday evening if you are in St. Petersburg. Comparing geoclustering algorithms

Maxim Shalankin2 Feb 2022

Problem

A ride-hailing team has the destination coordinates ("point B") of many trips and wants the zones that customers travel to most often. Plain clustering does not answer this: the number of zones is unknown, there are no true labels, and the zones have arbitrary size and density. A cluster map also does not say which zone is the top one.

Example from the article: trips between 17 and 24 hours on Fridays in St. Petersburg, with the aim of finding the zones where customers most often arrive.

Solution in brief

Run four families of clustering algorithms on the destination points and compare them by four internal metrics and an expert reading of the map. DBSCAN scored best but returns no ranking. Kernel density estimation (KDE) in a loop gives a ranked list of dense zones, so the author used it for the final answer.

Questions this case answers
  • How to turn a cloud of geographic points into a ranked list of dense zones when the number of zones and the true labels are unknown
  • How to choose between clustering algorithms when no ground truth exists and cluster shapes are irregular with varying density
  • How to turn raw trip drop-off coordinates into a ranked list of popular zones?
  • How to choose a clustering algorithm for geographic points when there are no true labels?

Tools and methods

  • k-means — centroid-based baseline; the number of clusters is tuned with the metrics.
  • Agglomerative clustering — hierarchical variant, same tuning of the number of clusters.
  • DBSCAN — density-based clustering with epsilon and min_samples, handles outliers.
  • Kernel density estimation (KDE) — iterative density polygons that come out already ranked.
  • Four internal metrics (within-cluster sum of squares, silhouette, Calinski-Harabasz, Davies-Bouldin) — compare cluster quality.
  • scikit-learn — ready implementations of the last three metrics.
Continue reading — it's free

Google or a one-time email code. No password.