Stanford ML Group Releases BanditPAM: Fast k-medoids Clustering Algorithm
The Stanford Machine Learning Group has publicly released BanditPAM, a state-of-the-art k-medoids clustering algorithm originally presented at the NeurIPS conference. Unlike the widely used k-means algorithm, k-medoids requires cluster centers to be actual data points, offering greater interpretability and robustness to outliers through support for arbitrary distance metrics. Historically, k-medoids adoption was limited by computational inefficiency, with previous algorithms operating at O(n^2) complexity. BanditPAM addresses this bottleneck by reducing time complexity to nearly linear O(n log n) using multi-armed bandits. The new implementation is written in C++ for high performance, featuring parallelization and intelligent caching. It is designed for ease of use, matching the familiar sklearn.cluster.KMeans interface, allowing developers to integrate it into existing Python codebases with minimal changes. The tool is now available for installation via PyPI. This release aims to make robust, interpretable clustering accessible for large datasets, bridging the gap between theoretical advantages and practical application speed. The group provides additional resources, including a GitHub repository, video summary, and the full academic paper, to facilitate adoption among machine learning practitioners seeking alternatives to standard k-means clustering.
Wire timeline
Stanford ML Group Releases BanditPAM: Fast k-medoids Clustering Algorithm
The Stanford Machine Learning Group has publicly released BanditPAM, a state-of-the-art k-medoids clustering algorithm originally presented at the NeurIPS conference. Unlike the widely used k-means algorithm, k-medoids requires cluster centers to be actual data points, offering greater interpretability and robustness to outliers through support for arbitrary distance metrics. Historically, k-medoids adoption was limited by computational inefficiency, with previous algorithms operating at O(n^2) complexity. BanditPAM addresses this bottleneck by reducing time complexity to nearly linear O(n log n) using multi-armed bandits. The new implementation is written in C++ for high performance, featuring parallelization and intelligent caching. It is designed for ease of use, matching the familiar sklearn.cluster.KMeans interface, allowing developers to integrate it into existing Python codebases with minimal changes. The tool is now available for installation via PyPI. This release aims to make robust, interpretable clustering accessible for large datasets, bridging the gap between theoretical advantages and practical application speed. The group provides additional resources, including a GitHub repository, video summary, and the full academic paper, to facilitate adoption among machine learning practitioners seeking alternatives to standard k-means clustering.
The Stanford AI Lab Blog