Skip to content

Instantly share code, notes, and snippets.

@archie
Created April 19, 2012 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archie/2422239 to your computer and use it in GitHub Desktop.
Save archie/2422239 to your computer and use it in GitHub Desktop.
Clustering
...
# 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