Created
April 19, 2012 16:47
-
-
Save archie/2422239 to your computer and use it in GitHub Desktop.
Clustering
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
... | |
# Read the vectors | |
data = read_from_file(sys.argv[1]) | |
items = numpy.array(data) | |
# Normalise vectors | |
normalised_items = whiten(items) | |
# Cluster time! | |
centroids, labels = kmeans2(normalised_items, int(sys.argv[2]), minit='points', iter=20) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment