Skip to content

Instantly share code, notes, and snippets.

Created June 15, 2015 14:38
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
class Clustering:
def k_means_clustering(self, n, s=1.0):
This method performs the K-means clustering algorithm on the data for n iterations. This involves updating the
centroids using the mean-shift heuristic n-times and reassigning the patterns to their closest centroids.
:param n: number of iterations to complete
:param s: the scaling factor to use when updating the centroids
pick on which has a better solution (according to some measure of cluster quality)
for i in range(n):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment