From 29f0760e12fbf80eb2f615f7f94bddf40301c8f0 Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Fri, 10 Mar 2023 15:45:56 +0800 Subject: [PATCH] [test]Update HNSW index param (#22687) Signed-off-by: zhuwenxing --- tests/python_client/deploy/scripts/first_recall_test.py | 6 +++--- tests/python_client/deploy/scripts/second_recall_test.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/python_client/deploy/scripts/first_recall_test.py b/tests/python_client/deploy/scripts/first_recall_test.py index f28565de7a..2329f53a61 100644 --- a/tests/python_client/deploy/scripts/first_recall_test.py +++ b/tests/python_client/deploy/scripts/first_recall_test.py @@ -17,7 +17,7 @@ pymilvus_version = pymilvus.__version__ 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)) @@ -42,7 +42,7 @@ def gen_search_param(index_type, metric_type="L2"): bin_search_params = {"metric_type": "HAMMING", "params": {"nprobe": nprobe}} search_params.append(bin_search_params) elif index_type in ["HNSW"]: - for ef in [50]: + for ef in [150]: hnsw_search_param = {"metric_type": metric_type, "params": {"ef": ef}} search_params.append(hnsw_search_param) 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]) tmp = set(true_ids[index]).intersection(set(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}") if index_type in ["IVF_PQ", "ANNOY"]: assert recall >= 0.6, f"recall={recall} < 0.6" diff --git a/tests/python_client/deploy/scripts/second_recall_test.py b/tests/python_client/deploy/scripts/second_recall_test.py index c6a001a1a7..f41bb6362c 100644 --- a/tests/python_client/deploy/scripts/second_recall_test.py +++ b/tests/python_client/deploy/scripts/second_recall_test.py @@ -32,7 +32,7 @@ def gen_search_param(index_type, metric_type="L2"): bin_search_params = {"metric_type": "HAMMING", "params": {"nprobe": nprobe}} search_params.append(bin_search_params) elif index_type in ["HNSW"]: - for ef in [50]: + for ef in [150]: hnsw_search_param = {"metric_type": metric_type, "params": {"ef": ef}} search_params.append(hnsw_search_param) 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])}" tmp = set(true_ids[index]).intersection(set(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}") if index_type in ["IVF_PQ", "ANNOY"]: assert recall >= 0.6, f"recall={recall} < 0.6"