K-means is one of the most popular clustering algorithms for vectors. Starting from a number of clusters, generates a random clustering of the objects: then applies iteratively two steps, namely assignment and update until convergence, to identify a proper clustering.
We created a Python script that implements a version of K-means based on lists and a version of kmeans based on numpy vectors. We tested the two implementations providing charts and visual representations that show, depending on the size of the vectors, the number of the vectors and the number of clusters, how the performance changes.
The notebook can be viewed at https://nbviewer.org/github/emanuelecavalleri/K-means/blob/main/K-means.ipynb.