Created
July 14, 2018 16:29
-
-
Save ogrisel/5cdf1aedf3dddc94dd82270ab40f91f1 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
from sklearn.datasets import make_blobs | |
from sklearn.cluster import KMeans | |
from sklearn.externals import joblib | |
m = joblib.Memory(cachedir='/tmp/joblib') | |
make_blobs = m.cache(make_blobs) | |
data, labels = make_blobs(n_samples=10**5, n_features=50, cluster_std=100, | |
centers=10, random_state=777) | |
max_it = 100 | |
cl = KMeans(n_clusters=10, algorithm='full', max_iter=max_it, tol=0) | |
cl.fit(data) | |
print(cl.n_iter_) | |
assert cl.n_iter_ == max_it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment