Skip to content

Instantly share code, notes, and snippets.

@TheLoneNut
Created February 6, 2019 18:35
Show Gist options
  • Save TheLoneNut/7343e11e603dfed359daec85f4e087a2 to your computer and use it in GitHub Desktop.
Save TheLoneNut/7343e11e603dfed359daec85f4e087a2 to your computer and use it in GitHub Desktop.
from sklearn.cluster import MiniBatchKMeans
num_clusters = 80
kn = MiniBatchKMeans(n_clusters=num_clusters, init_size=max(300, 3*num_clusters)).fit(X)
labels = kn.labels_
n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment