Created
January 30, 2021 18:00
-
-
Save GeorgeSeif/f8bcc579cb2eddd5abac75f48f89b469 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
s = time.time() | |
k = 10 | |
n_init = 10 | |
max_iter = 300 | |
kmeans = faiss.Kmeans(d=x_train.shape[1], k=k, niter=max_iter, nredo=n_init) | |
kmeans.train(x_train.astype(np.float32)) | |
e = time.time() | |
print("Training time = {}".format(e - s)) | |
s = time.time() | |
kmeans.index.search(x_train.astype(np.float32), 1)[1] | |
e = time.time() | |
print("Prediction time = {}".format((e - s) / len(y_test))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment