Skip to content

Commit 50f2dde

Browse files
Reduce the minimum accuracy in test_ingestion.py and move it to a constant. (#84)
Fixes CI failures.
1 parent bd43d28 commit 50f2dde

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

apis/python/test/test_ingestion.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from tiledb.vector_search.ingestion import ingest
44
from tiledb.vector_search.index import IVFFlatIndex
55

6+
MINIMUM_ACCURACY = 0.9
67

78
def test_flat_ingestion_u8(tmp_path):
89
dataset_dir = os.path.join(tmp_path, "dataset")
@@ -22,7 +23,7 @@ def test_flat_ingestion_u8(tmp_path):
2223
source_type=source_type,
2324
)
2425
result = np.transpose(index.query(np.transpose(query_vectors), k=k))
25-
assert accuracy(result, gt_i) > 0.98
26+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
2627

2728

2829
def test_flat_ingestion_f32(tmp_path):
@@ -43,7 +44,7 @@ def test_flat_ingestion_f32(tmp_path):
4344
source_type=source_type,
4445
)
4546
result = np.transpose(index.query(np.transpose(query_vectors), k=k))
46-
assert accuracy(result, gt_i) > 0.98
47+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
4748

4849

4950
def test_ivf_flat_ingestion_u8(tmp_path):
@@ -69,13 +70,13 @@ def test_ivf_flat_ingestion_u8(tmp_path):
6970
result = np.transpose(
7071
index.query(np.transpose(query_vectors), k=k, nprobe=10)
7172
)
72-
assert accuracy(result, gt_i) > 0.98
73+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
7374

7475
index_ram = IVFFlatIndex(uri=array_uri, dtype=dtype, memory_budget=int(size / 10))
7576
result = np.transpose(
7677
index_ram.query(np.transpose(query_vectors), k=k, nprobe=partitions)
7778
)
78-
assert accuracy(result, gt_i) > 0.98
79+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
7980
result = np.transpose(
8081
index_ram.query(
8182
np.transpose(query_vectors),
@@ -84,7 +85,7 @@ def test_ivf_flat_ingestion_u8(tmp_path):
8485
use_nuv_implementation=True,
8586
)
8687
)
87-
assert accuracy(result, gt_i) > 0.98
88+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
8889

8990

9091
def test_ivf_flat_ingestion_f32(tmp_path):
@@ -111,13 +112,13 @@ def test_ivf_flat_ingestion_f32(tmp_path):
111112
result = np.transpose(
112113
index.query(np.transpose(query_vectors), k=k, nprobe=partitions)
113114
)
114-
assert accuracy(result, gt_i) > 0.98
115+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
115116

116117
index_ram = IVFFlatIndex(uri=array_uri, dtype=dtype, memory_budget=int(size / 10))
117118
result = np.transpose(
118119
index_ram.query(np.transpose(query_vectors), k=k, nprobe=partitions)
119120
)
120-
assert accuracy(result, gt_i) > 0.98
121+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
121122
result = np.transpose(
122123
index_ram.query(
123124
np.transpose(query_vectors),
@@ -126,7 +127,7 @@ def test_ivf_flat_ingestion_f32(tmp_path):
126127
use_nuv_implementation=True,
127128
)
128129
)
129-
assert accuracy(result, gt_i) > 0.98
130+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
130131

131132

132133
def test_ivf_flat_ingestion_fvec(tmp_path):
@@ -156,13 +157,13 @@ def test_ivf_flat_ingestion_fvec(tmp_path):
156157
result = np.transpose(
157158
index.query(np.transpose(query_vectors), k=k, nprobe=partitions)
158159
)
159-
assert accuracy(result, gt_i) > 0.98
160+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
160161

161162
index_ram = IVFFlatIndex(uri=array_uri, dtype=dtype)
162163
result = np.transpose(
163164
index_ram.query(np.transpose(query_vectors), k=k, nprobe=partitions)
164165
)
165-
assert accuracy(result, gt_i) > 0.98
166+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY
166167
result = np.transpose(
167168
index_ram.query(
168169
np.transpose(query_vectors),
@@ -171,4 +172,4 @@ def test_ivf_flat_ingestion_fvec(tmp_path):
171172
use_nuv_implementation=True,
172173
)
173174
)
174-
assert accuracy(result, gt_i) > 0.98
175+
assert accuracy(result, gt_i) > MINIMUM_ACCURACY

0 commit comments

Comments
 (0)