Abstract
This paper presents txmeans, an automated, parameter-free clustering algorithm designed for "mass clustering"—the efficient processing of transactional data for millions of individual users. By adapting the Bayesian Information Criterion (BIC) for categorical data and utilizing a hierarchical divisive strategy, txmeans identifies optimal cluster counts and representative behaviors without manual tuning. Experimental results on synthetic and real-world retail data demonstrate that txmeans significantly outperforms existing methods in both clustering quality and computational efficiency.
Introduction
In the modern digital economy, users generate vast streams of transactional data, such as grocery baskets, web navigation paths, or media consumption logs. To provide personalized services, it is essential to cluster this data for each user to uncover distinct behavioral patterns—for instance, distinguishing a user's "routine grocery shopping" from "occasional party planning."
However, "mass clustering" at the scale of millions of users presents three significant challenges:
- Parameter Sensitivity: Traditional algorithms require pre-defined cluster counts ($k$) or distance thresholds, which cannot be manually tuned for every individual user.
- Data Sparsity: Transactional data is high-dimensional and categorical, rendering standard Euclidean distance metrics ineffective.
- Scalability: Automated methods must be fast enough to process massive populations of users within reasonable timeframes.
The txmeans Algorithm
The authors propose txmeans, a hierarchical divisive clustering algorithm that operates top-down. It begins with all transactions in a single cluster and iteratively attempts to bisect them into sub-clusters.
Key Innovations
- Representative Baskets: Instead of traditional centroids, txmeans uses a "representative basket"—a virtual transaction that minimizes the Jaccard distance to all other items in the cluster.
- Adapted BIC: To automate the stopping criterion, the algorithm employs a modified Bayesian Information Criterion (BIC). A split is only accepted if the BIC of the resulting sub-clusters exceeds that of the parent.
- Item Cleaning: Before attempting a split, the algorithm identifies and temporarily removes items common to all baskets in the cluster. This "noise reduction" step prevents ubiquitous items from masking subtle behavioral variances.
- Scalability via Sampling: For extremely large individual datasets, txmeans can process a statistical sample and subsequently assign the remaining transactions to the discovered clusters.
Experimental Evaluation
The algorithm was evaluated against synthetic datasets (simulating 100,000 users with varying noise and overlap) and a massive real-world dataset from an Italian supermarket chain involving 2.6 million sessions from 10,000 customers.
Key Results
As shown in the performance summary above, txmeans achieves superior results across all critical dimensions:
- Quality: It reached a median Normalized Mutual Information (NMI) of 0.97, outperforming methods like
clopeandpractical. - Accuracy: While other parameter-free methods often overestimated cluster counts by dozens, txmeans typically stayed within two clusters of the ground truth ($δ_k \approx 2.0$).
- Speed: The execution time for txmeans was one to two orders of magnitude faster than its closest competitors, with a median RT of 1.4.
The robustness of the algorithm is further highlighted when examining performance under varying noise levels. As cluster overlap ($O$) increases, txmeans maintains high NMI and low cluster count error, whereas competing methods like clope or coolcat degrade significantly.
Discussion: The Matrioska Effect
A significant insight from the retail case study is the "Matrioska Effect." User behaviors are often nested: a large monthly stock-up trip often contains a "kernel" of items found in smaller, frequent trips for perishables. By removing common items during the divisive process, txmeans successfully navigates these nested structures to identify distinct shopping modes.
Conclusion
txmeans provides a robust, scalable, and parameter-free solution for mass clustering of transactional data. Its ability to automatically determine the number of clusters and provide representative baskets makes it ideal for real-world applications like the "Personal Cart Assistant" developed by the authors. Future work will focus on incorporating temporal dynamics to track how user behaviors evolve over time.
Summary updated