Fast Density-Peaks Clustering: Multicore-based Parallelization Approach

Daichi Amagata, Takahiro HaraarXiv 2022

TL;DR

Density-Peaks Clustering (DPC) is a powerful algorithm for discovering clusters of arbitrary shapes, but its naive implementation scales quadratically ($O(n^2)$), making it impractical for large datasets. This paper introduces three novel, sub-quadratic algorithms—Ex-DPC, Approx-DPC, and S-Approx-DPC—that leverage $k$d-trees, uniform grids, and parallel multicore processing to accelerate DPC by orders of magnitude while maintaining exceptional clustering accuracy.

What Problem Does This Paper Address?

Clustering is a foundational task in data science, and density-based approaches like DBSCAN are highly popular because they can detect clusters of arbitrary shapes. A recent and powerful alternative is Density-Peaks Clustering (DPC). DPC is uniquely robust to varying data distributions and allows users to easily identify cluster centers and filter out noise using an intuitive 2D "decision graph."

Figure 2: Difference of the clustering results (clustering qual- ity comparison) between DPC and DBSCAN on S2

However, DPC has a massive Achilles' heel: to cluster data, it must compute the local density ($\rho$) for every point and its dependent distance ($\delta$)—the distance to its nearest neighbor with a higher local density. A straightforward implementation requires comparing every point to every other point, resulting in a quadratic time complexity ($O(n^2)$). This paper tackles this scalability barrier, making DPC viable for massive, real-world datasets.

Methods

The authors propose three distinct algorithms to break the quadratic bottleneck, alongside a strategy for multicore parallelization:

  1. Ex-DPC (Exact): This algorithm computes the exact DPC results. It uses a $k$d-tree to accelerate local density range queries. To solve the dependent distance bottleneck, it employs a clever trick: it sorts points by descending local density and builds the $k$d-tree incrementally. This ensures that when a point queries the tree for its nearest neighbor, the tree only contains points of higher density, guaranteeing an exact match in sub-quadratic time.
  2. Approx-DPC (Approximation): This algorithm introduces a uniform grid data structure to group nearby points. It uses a "joint range search" to compute exact local densities quickly. For dependent distances, it applies an approximation: if a point is not the densest point in its grid cell, its dependent point is assumed to be the cell's peak, which can be resolved in $O(1)$ constant time. Crucially, Approx-DPC mathematically guarantees the exact same cluster centers as Ex-DPC.
  3. S-Approx-DPC (Sampling Approximation): Designed for scenarios where speed is paramount and a rougher clustering result is acceptable, this algorithm converts point clustering into cell clustering. It samples one point per grid cell, computes its density, and uses an approximation parameter ($\epsilon$) to bound and compute approximate dependent distances almost linearly.
  4. Multicore Parallelization: Because simple data partitioning can lead to severe load imbalances (dense regions take much longer to process than sparse ones), the authors implement a 3/2-approximation greedy algorithm to dynamically balance the computational load across multiple CPU threads using OpenMP.

Datasets

The algorithms were evaluated on both synthetic and real-world benchmarks:

  • Synthetic Datasets: Syn (100,000 points, 2D, generated via a random walk model) and S1, S2, S3, S4 (datasets containing 15 Gaussian clusters with varying degrees of spatial overlap).
  • Real-World Datasets: Airline (5.8M points, 3D), Household (2.0M points, 4D), PAMAP2 (3.8M points, 4D), and Sensor (928k points, 8D), all sourced from standard open-data repositories like the UCI Machine Learning Archive.

Key Insights and Ideas

  • Incremental Tree Building: The "aha moment" for the exact algorithm is realizing that sorting data by density allows an optimal spatial index ($k$d-tree) to be built on the fly. This completely bypasses the need to search the entire dataset for higher-density neighbors.
  • Grid-Based Pruning: For the approximation algorithms, the authors leverage the fact that points tightly packed within a small geometric cell share nearly identical density profiles. By treating the cell peak as a local proxy, they eliminate millions of redundant distance calculations.
  • Load Balancing is Essential: The paper highlights that parallelizing spatial algorithms requires more than just splitting data evenly. Because spatial density is highly skewed, a cost-based greedy partitioning scheme is required to prevent CPU threads from idling.

Key Results

The experimental results demonstrate massive performance leaps across the board:

  • Blazing Fast Exact Clustering: On the 5.8-million-point Airline dataset, Ex-DPC computed exact results 145 times faster than CFSFDP-A, the previous state-of-the-art exact DPC algorithm.
  • Outperforming Existing Approximations: Approx-DPC and S-Approx-DPC consistently beat rival approximation frameworks (like LSH-DDP), frequently running more than 10 times faster while delivering significantly higher accuracy.
  • High Fidelity: Measured using the Rand Index (where 1.0 is a perfect match to the exact ground truth), Approx-DPC achieved scores near ~0.99 across all real-world datasets, proving that its approximations do not sacrifice clustering quality.
  • Excellent Scaling: Utilizing 48 CPU threads, Approx-DPC successfully clustered millions of points in under 20 seconds.

Limitations and Future Work

  • The Curse of Dimensionality: The underlying efficiency of $k$d-trees and uniform grids degrades as the number of dimensions ($d$) increases. While the authors note that high-dimensional data is typically preprocessed using dimensionality reduction techniques (like UMAP or PCA) before clustering, the algorithms are inherently optimized for low-dimensional spaces.
  • S-Approx-DPC Parameter Tuning: S-Approx-DPC introduces an approximation parameter ($\epsilon$). While it provides a clear knob to trade accuracy for speed, finding the optimal $\epsilon$ value still requires empirical trial and error by the user.

Summary updated

BibTeX
@misc{amagata2022fast,
  author = {Daichi Amagata and Takahiro Hara},
  title = {{Fast Density-Peaks Clustering: Multicore-based Parallelization Approach}},
  year = {2022},
  eprint = {2207.04649},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2207.04649},
}
Figure