Skip to content

Commit

Permalink
HNSW support for soft-remove and hard-remove. (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzhu committed Sep 12, 2023
1 parent 8baa603 commit c98c145
Show file tree
Hide file tree
Showing 3 changed files with 457 additions and 146 deletions.
5 changes: 3 additions & 2 deletions benchmark/indexes/jaccard/hnsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def search_hnsw_minhash_jaccard_topk(index_data, query_data, index_params, k):
for i in tqdm.tqdm(
range(len(index_keys)),
desc="Indexing",
unit=" query",
unit=" minhash",
total=len(index_keys),
):
index.insert(i, index_minhashes[num_perm][i])
Expand Down Expand Up @@ -156,7 +156,8 @@ def search_hnsw_minhash_jaccard_topk(index_data, query_data, index_params, k):
# Recover the retrieved indexed sets and
# compute the exact Jaccard similarities.
result = [
[index_keys[i], compute_jaccard(query_set, index_sets[i])] for i in result
[index_keys[i], compute_jaccard(query_set, index_sets[i])]
for i, _ in result
]
# Sort by similarity.
result.sort(key=lambda x: x[1], reverse=True)
Expand Down
Loading

0 comments on commit c98c145

Please sign in to comment.