111 karma · joined Mar 13, 2023 (3y ago) · 20 submissions
comment 3y ago · link · parent
I suppose that you could adaptively sample points from the dataset to update your parameters of the GMM, and sample more points for parameters of the GMM that you're less certain about.
(To understand how the parameter estimates would converge to their true values, you'd likely need to use the delta method; see Appendix 3 in https://ar5iv.org/pdf/2212.07473.pdf for an example)
Is that what you had in mind?
comment 3y ago · link · parent
This would be a nontrivial engineering effort and I likely won't be able to do it myself (I'm a PhD student about to graduate), but if you or your team is interested in adapting BanditPAM to the streaming setting, please feel free to reach out! My email's motiwari@stanford.edu
comment 3y ago · link · parent
comment 3y ago · link · parent
I suspect that this is because the scikit-learn implementation of KMeans subsamples the data and uses some highly-optimized data structures for larger datasets. I've asked the team to see how we can use some of those techniques in BanditPAM and will update the Github repo as we learn more and improve our implementation.
comment 3y ago · link · parent
comment 3y ago · link · parent
comment 3y ago · link · parent
An implication of this is that if you were to do some invertible data transformation and then perform clustering, that's equivalent to doing clustering with a different dissimilarity measure (without the data transformation in the first place). It should be possible to avoid doing the invertible data transformation in the first place if you're willing to engineer your dissimilarity measure.
Without more details, it's hard to say exactly what would happen to the clustering results under custom dissimilarity measures or data transformations -- but our package supports both use cases!
comment 3y ago · link · parent
You can also use some regularization criterion (AIC, BIC, or other)
comment 3y ago · link · parent
To answer your questions:
1. When looking at k-medoids algorithms, we realized that PAM hadn't been improved since the 80s! Other, faster algorithms had been developed but sacrificed solution quality (clustering loss) for speed. Simultaneously, prior work from my coauthors had recognized that the 1-medoid problem could be solved via randomized algorithms/multi-armed bandit -- much faster but returning the same solution. Our key insight was that every stage of PAM could be recast as a multi-armed bandit problem, and that reusing information across different stages would result in further speedups.
2. Actually, the complexity guarantees/theory were pretty easy because we were able to use proof techniques that are common in the multi-armed bandit literature. The hardest part was implementing it in C++ and making it available to both Python and R via bindings. For the original paper we did everything in Python and measured sample complexity, but to make the algorithm valuable for users we had to implement it in a more performant language.
3. To be honest, this project came about from a chance meeting at a conference (ICML 2019). I was randomly introduced to Martin Zhang (ironically I met him first at the conference even though we were both at Stanford). Martin and Ilan had deep expertise in multi-armed bandits/randomized algorithms (and solved the 1-medoid problem), and I got really interested in their work when talking with them, primarily because it seemed like a straightforward win and useful for a lot of people.
comment 3y ago · link · parent
We definitely think that our approach could be used to make an index structure for ANN search directly, for example in conjunction with Hierarchical Navigable Small World approaches.
16.
Show HN: Want something better than k-means? Try BanditPAM(github.com ↗)
281 points · by motiwari · 3y ago · 41 comments
comment 3y ago · link · parent
Unlike in k-means, the k-medoids problem requires cluster centers to be actual datapoints, which permits greater interpretability of your cluster centers. k-medoids also works better with arbitrary distance metrics, so your clustering can be more robust to outliers if you're using metrics like L1.
Despite these advantages, most people don't use k-medoids because prior algorithms were too slow. In our NeurIPS 2020 paper, BanditPAM, we sped up the best known algorithm from O(n^2) to O(nlogn).
We've released our implementation, which is pip- and CRAN-installable. It's written in C++ for speed, but callable from Python and R. It also supports parallelization and intelligent caching at no extra complexity to end users. Its interface also matches the sklearn.cluster.KMeans interface, so minimal changes are necessary to existing code.
Our previous announcement that went viral: https://www.linkedin.com/posts/motiwari_want-something-bette...
PyPI: https://pypi.org/project/banditpam
CRAN: https://cran.r-project.org/web/packages/banditpam/index.html
Repo: https://github.com/motiwari/BanditPAM
Paper: https://arxiv.org/abs/2006.06856
If you find our work valuable, please consider starring the repo or citing our work. These help us continue development on this project.
I'm Mo Tiwari (https://motiwari.com), a PhD student in Computer Science at Stanford University. A special thanks to my collaborators on this project, Martin Jinye Zhang, James Mayclin, Sebastian Thrun, Chris Piech, and Ilan Shomorony, as well as the author of the R package, Balasubramanian Narasimhan.
(This is my first time posting on HN; I've read the FAQ before posting, but please let me know if I broke any rules)
20.
Show HN: Want something better than k-means? Try BanditPAM(github.com ↗)
7 points · by motiwari · 3y ago · 5 comments