How would you approach clustering a dataset of hundreds of millions of points?
Last updated
Use near-linear algorithms and avoid O(n²) methods like exact DBSCAN, hierarchical, or spectral clustering. Options include
MiniBatchKMeans, BIRCH, GPU k-means (faiss,cuML), or HDBSCAN on a sample.Shrink the problem: fit on a representative sample and assign the rest to nearest centroids. Cut memory with PCA, random projection, or quantization.
Scale out with streaming
partial_fitor Spark MLlibKMeans(or per-partition micro-clusters then clustering centroids). Validate via sampled silhouette and stability checks.
- https://scikit-learn.org/stable/auto_examples/cluster/plot_birch_vs_minibatchkmeans.html
- https://medium.com/@sean.j.moran/data-science-101-an-overview-of-k-means-64afa2717885
- https://medium.com/@Kirtiswagat/unlocking-the-world-of-similarity-search-using-faiss-a-practical-guide-to-the-algorithms-in-faiss-a217a50c2b0d