Using NumPy to Speed Up K-Means Clustering by 70x | Paperspace Blog

In Part 1 of our series on how to write efficient code using NumPy, we covered the important topics of vectorization and broadcasting. In this part we will put these concepts into practice by implementing an efficient version of the K-Means clustering algorithm using NumPy. We will benchmark it against a naive version implemented entirely using looping in Python. In the end we'll see that the NumPy version is about 70 times faster than the simple loop version.


This is a companion discussion topic for the original entry at https://blog.paperspace.com/speed-up-kmeans-numpy-vectorization-broadcasting-profiling