Skip to content

Instantly share code, notes, and snippets.

@yenchenlin
Created June 17, 2016 13:22
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 yenchenlin/524c5cd37072be257a0c5a8a27574d59 to your computer and use it in GitHub Desktop.
Save yenchenlin/524c5cd37072be257a0c5a8a27574d59 to your computer and use it in GitHub Desktop.
import timeit
import numpy as np
from sklearn.cluster import KMeans

np.random.seed(5)
X = np.random.rand(200000, 20)
X = np.float32(X)
estimator = KMeans()

def time_this_function():
    estimator.fit(X)

timer = timeit.Timer(time_this_function)
print timer.timeit(number=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment