KMeans can produce empty clusters. To solve this, I used the same approach as scikit-learn: reassign the points with the largest distances to the empty clusters. Additionally, I removed an unnecessary variable from the KMeans main loop, refactored the cluster-assign / assign-cluster functions to remove duplicate code, and removed the acceptance condition for empty clusters in the test. Closes #3 .
KMeans can produce empty clusters. To solve this, I used the same approach as scikit-learn: reassign the points with the largest distances to the empty clusters. Additionally, I removed an unnecessary variable from the KMeans main loop, refactored the cluster-assign / assign-cluster functions to remove duplicate code, and removed the acceptance condition for empty clusters in the test. Closes #3 .