Skip to main content
QUICK REVIEW

[Paper Review] Rk-means: Fast Clustering for Relational Data

Ryan R. Curtin, Ben Moseley|arXiv (Cornell University)|Oct 11, 2019
Data Mining Algorithms and ApplicationsComputer Science34 references5 citations
TL;DR

Rk-means is a novel algorithm that enables fast, approximate k-means clustering on relational databases without materializing the full data matrix. It constructs a small grid coreset from marginal relations, achieving constant-factor approximation to the k-means objective while delivering orders-of-magnitude speedups over traditional methods that require expensive feature extraction queries.

ABSTRACT

Conventional machine learning algorithms cannot be applied until a data matrix is available to process. When the data matrix needs to be obtained from a relational database via a feature extraction query, the computation cost can be prohibitive, as the data matrix may be (much) larger than the total input relation size. This paper introduces Rk-means, or relational k -means algorithm, for clustering relational data tuples without having to access the full data matrix. As such, we avoid having to run the expensive feature extraction query and storing its output. Our algorithm leverages the underlying structures in relational data. It involves construction of a small {\it grid coreset} of the data matrix for subsequent cluster construction. This gives a constant approximation for the k -means objective, while having asymptotic runtime improvements over standard approaches of first running the database query and then clustering. Empirical results show orders-of-magnitude speedup, and Rk-means can run faster on the database than even just computing the data matrix.

Motivation & Objective

  • To address the high computational and storage cost of feature extraction queries (FEQs) that generate large data matrices from relational databases before clustering.
  • To enable k-means clustering directly on relational data without materializing the full data matrix, avoiding the performance bottleneck of FEQs.
  • To provide a provably good approximation to the k-means objective using a compact coreset derived from marginal relations.
  • To achieve asymptotic and empirical speedups over standard k-means pipelines that first compute and then cluster the full data matrix.

Proposed method

  • Rk-means constructs a grid coreset by clustering each individual relational table (e.g., product, store, transaction) separately using a lightweight k-means variant.
  • It leverages the factorization structure of relational data and functional aggregate query (FAQ) techniques to efficiently compute weighted k-means on the cross-product of relations without materializing the full data matrix.
  • The algorithm uses a dynamic programming-based clustering method on the marginal relations to build a small, representative grid coreset that summarizes the joint distribution.
  • The coreset is used to compute a weighted k-means clustering on the full data space, with weights derived from the frequencies of tuple combinations across the relations.
  • It applies a theoretical framework connecting coresets to optimal transport to ensure a constant-factor approximation to the true k-means objective.
  • The method supports a tunable trade-off between speed and approximation by adjusting the number of clusters ($\kappa$) used in the coreset construction relative to the final $k$ clusters.

Experimental results

Research questions

  • RQ1Can k-means clustering be performed on relational data without materializing the full data matrix, thereby avoiding the computational cost of feature extraction queries?
  • RQ2What is the theoretical approximation guarantee of a coreset constructed from marginal relational tables for the k-means objective?
  • RQ3How does the performance of Rk-means compare to standard k-means pipelines in terms of runtime and memory usage when the data matrix is large?
  • RQ4Can the coreset construction be made efficient enough to outperform even the time required to compute the data matrix in practice?
  • RQ5What is the impact of tuning the coreset size ($\kappa$) on the trade-off between speed and clustering quality?

Key findings

  • Rk-means achieves up to 115× speedup over mlpack on the Retailer dataset and up to 208× speedup when using $\kappa < k$, while still maintaining moderate approximation error.
  • On the Favorita dataset, Rk-means completed clustering in 334.65 seconds with $k=50$, while mlpack timed out after six hours, demonstrating significant scalability improvements.
  • The memory footprint of Rk-means was drastically reduced—18 GiB vs. over 900 GiB for mlpack on the same dataset with $k=20$, enabling in-memory clustering where standard methods fail.
  • The coreset size was up to 180× smaller than the full data matrix, enabling efficient computation without sacrificing clustering quality.
  • The relative approximation error of Rk-means was consistently below the theoretical 9-approximation bound, with values as low as 0.00 for some configurations.
  • For all datasets, Rk-means ran faster than just computing the data matrix with psql, demonstrating that the coreset approach is not only faster but also more efficient than the baseline FEQ step.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.