mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
[test]Update HNSW index param (#22687)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
parent
29a952ec5e
commit
29f0760e12
@ -17,7 +17,7 @@ pymilvus_version = pymilvus.__version__
|
|||||||
|
|
||||||
|
|
||||||
all_index_types = ["IVF_FLAT", "IVF_SQ8", "HNSW"]
|
all_index_types = ["IVF_FLAT", "IVF_SQ8", "HNSW"]
|
||||||
default_index_params = [{"nlist": 128}, {"nlist": 128}, {"M": 48, "efConstruction": 100}]
|
default_index_params = [{"nlist": 128}, {"nlist": 128}, {"M": 48, "efConstruction": 200}]
|
||||||
index_params_map = dict(zip(all_index_types, default_index_params))
|
index_params_map = dict(zip(all_index_types, default_index_params))
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ def gen_search_param(index_type, metric_type="L2"):
|
|||||||
bin_search_params = {"metric_type": "HAMMING", "params": {"nprobe": nprobe}}
|
bin_search_params = {"metric_type": "HAMMING", "params": {"nprobe": nprobe}}
|
||||||
search_params.append(bin_search_params)
|
search_params.append(bin_search_params)
|
||||||
elif index_type in ["HNSW"]:
|
elif index_type in ["HNSW"]:
|
||||||
for ef in [50]:
|
for ef in [150]:
|
||||||
hnsw_search_param = {"metric_type": metric_type, "params": {"ef": ef}}
|
hnsw_search_param = {"metric_type": metric_type, "params": {"ef": ef}}
|
||||||
search_params.append(hnsw_search_param)
|
search_params.append(hnsw_search_param)
|
||||||
elif index_type == "ANNOY":
|
elif index_type == "ANNOY":
|
||||||
@ -173,7 +173,7 @@ def milvus_recall_test(host='127.0.0.1', index_type="HNSW"):
|
|||||||
assert len(item) == len(true_ids[index])
|
assert len(item) == len(true_ids[index])
|
||||||
tmp = set(true_ids[index]).intersection(set(item))
|
tmp = set(true_ids[index]).intersection(set(item))
|
||||||
sum_radio = sum_radio + len(tmp) / len(item)
|
sum_radio = sum_radio + len(tmp) / len(item)
|
||||||
recall = round(sum_radio / len(result_ids), 3)
|
recall = round(sum_radio / len(result_ids), 6)
|
||||||
logger.info(f"recall={recall}")
|
logger.info(f"recall={recall}")
|
||||||
if index_type in ["IVF_PQ", "ANNOY"]:
|
if index_type in ["IVF_PQ", "ANNOY"]:
|
||||||
assert recall >= 0.6, f"recall={recall} < 0.6"
|
assert recall >= 0.6, f"recall={recall} < 0.6"
|
||||||
|
|||||||
@ -32,7 +32,7 @@ def gen_search_param(index_type, metric_type="L2"):
|
|||||||
bin_search_params = {"metric_type": "HAMMING", "params": {"nprobe": nprobe}}
|
bin_search_params = {"metric_type": "HAMMING", "params": {"nprobe": nprobe}}
|
||||||
search_params.append(bin_search_params)
|
search_params.append(bin_search_params)
|
||||||
elif index_type in ["HNSW"]:
|
elif index_type in ["HNSW"]:
|
||||||
for ef in [50]:
|
for ef in [150]:
|
||||||
hnsw_search_param = {"metric_type": metric_type, "params": {"ef": ef}}
|
hnsw_search_param = {"metric_type": metric_type, "params": {"ef": ef}}
|
||||||
search_params.append(hnsw_search_param)
|
search_params.append(hnsw_search_param)
|
||||||
elif index_type == "ANNOY":
|
elif index_type == "ANNOY":
|
||||||
@ -82,7 +82,7 @@ def search_test(host="127.0.0.1", index_type="HNSW"):
|
|||||||
assert len(item) == len(true_ids[index]), f"get {len(item)} but expect {len(true_ids[index])}"
|
assert len(item) == len(true_ids[index]), f"get {len(item)} but expect {len(true_ids[index])}"
|
||||||
tmp = set(true_ids[index]).intersection(set(item))
|
tmp = set(true_ids[index]).intersection(set(item))
|
||||||
sum_radio = sum_radio + len(tmp) / len(item)
|
sum_radio = sum_radio + len(tmp) / len(item)
|
||||||
recall = round(sum_radio / len(result_ids), 3)
|
recall = round(sum_radio / len(result_ids), 6)
|
||||||
logger.info(f"recall={recall}")
|
logger.info(f"recall={recall}")
|
||||||
if index_type in ["IVF_PQ", "ANNOY"]:
|
if index_type in ["IVF_PQ", "ANNOY"]:
|
||||||
assert recall >= 0.6, f"recall={recall} < 0.6"
|
assert recall >= 0.6, f"recall={recall} < 0.6"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user