Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andreaschandra/f7140f27a7dfd0a34b9d6b232618292b to your computer and use it in GitHub Desktop.
Save andreaschandra/f7140f27a7dfd0a34b9d6b232618292b to your computer and use it in GitHub Desktop.
Clustering model
minibatch = False
true_k = 4
if minibatch:
km = MiniBatchKMeans(n_clusters = true_k, init='k-means++', n_init=1,
init_size=1000, batch_size=1000, verbose = False)
else:
km = KMeans(n_clusters=true_k, init='k-means++', max_iter=100, n_init=1,
verbose = False)
print("Clustering sparse data with %s" % km)
t0 = time()
km.fit(X)
print("done in %0.3fs" % (time() - t0))
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment