Skip to content

Commit

Permalink
working around issue in kmc2
Browse files Browse the repository at this point in the history
  • Loading branch information
clark-hive committed Sep 9, 2022
1 parent e7726a4 commit 11b57d4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/bolt/bolt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ def _learn_centroids(X, ncentroids, ncodebooks):
start_col = i * subvect_len
end_col = start_col + subvect_len
X_in = X[:, start_col:end_col]
if np.unique(X_in).size == 1 and X_in.size > 1:
#kmc2 has a bug if all rows of matrix are duplicates
X_in[0,0] += 0.001
centroids, labels = kmeans(X_in, ncentroids)
ret[:, i, :] = centroids

Expand Down

0 comments on commit 11b57d4

Please sign in to comment.