Skip to content

Commit

Permalink
make IVF_PQ less brittle
Browse files Browse the repository at this point in the history
  • Loading branch information
jparismorgan committed Aug 23, 2024
1 parent 8c9beab commit cc08dd4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apis/python/test/test_type_erased_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,18 +500,18 @@ def test_construct_IndexIVFPQ_with_empty_vector(tmp_path):
a.add(training_set)

_, ids = a.query_infinite_ram(query_set, k_nn, nprobe)
assert recall(ids, groundtruth_set, k_nn) >= 0.88
assert recall(ids, groundtruth_set, k_nn) >= 0.87

index_uri = os.path.join(tmp_path, "array")
a.write_index(ctx, index_uri)

b = vspy.IndexIVFPQ(ctx, index_uri)

_, ids = b.query_infinite_ram(query_set, k_nn, nprobe)
assert recall(ids, groundtruth_set, k_nn) >= 0.88
assert recall(ids, groundtruth_set, k_nn) >= 0.87

_, ids = b.query_finite_ram(query_set, k_nn, nprobe, 500)
assert recall(ids, groundtruth_set, k_nn) >= 0.88
assert recall(ids, groundtruth_set, k_nn) >= 0.87


def test_inplace_build_query_IndexIVFPQ(tmp_path):
Expand All @@ -536,18 +536,18 @@ def test_inplace_build_query_IndexIVFPQ(tmp_path):
a.add(training_set)

_, ids = a.query_infinite_ram(query_set, k_nn, nprobe)
assert recall(ids, groundtruth_set, k_nn) >= 0.895
assert recall(ids, groundtruth_set, k_nn) >= 0.87

index_uri = os.path.join(tmp_path, "array")
a.write_index(ctx, index_uri)

b = vspy.IndexIVFPQ(ctx, index_uri)

_, ids = b.query_infinite_ram(query_set, k_nn, nprobe)
assert recall(ids, groundtruth_set, k_nn) >= 0.895
assert recall(ids, groundtruth_set, k_nn) >= 0.87

_, ids = b.query_finite_ram(query_set, k_nn, nprobe, 500)
assert recall(ids, groundtruth_set, k_nn) >= 0.895
assert recall(ids, groundtruth_set, k_nn) >= 0.87


def test_construct_IndexIVFFlat():
Expand Down

0 comments on commit cc08dd4

Please sign in to comment.