Forked from StuartGordonReid/AdditionaToClustering.py
Created
February 26, 2019 14:57
-
-
Save vitasiku/c77bda6421b8adeb812b7e3b7522bd0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): | |
self.assign_patterns() | |
self.update_centroids(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment