mirror of https://github.com/milvus-io/milvus.git
[skip ci] Add a comment about the calculation method of accuracy results (#8080)
Signed-off-by: wangting0128 <ting.wang@zilliz.com>pull/8088/head
parent
a7a4a12220
commit
e0ff07967c
|
@ -230,13 +230,21 @@ def gen_file_name(idx, dimension, data_type):
|
|||
def get_recall_value(true_ids, result_ids):
|
||||
"""
|
||||
Use the intersection length
|
||||
true_ids: neighbors taken from the dataset
|
||||
result_ids: ids returned by query
|
||||
"""
|
||||
sum_radio = 0.0
|
||||
for index, item in enumerate(result_ids):
|
||||
# tmp = set(item).intersection(set(flat_id_list[index]))
|
||||
|
||||
# Get the value of true_ids and the returned value to do the intersection
|
||||
tmp = set(true_ids[index]).intersection(set(item))
|
||||
|
||||
# Add up each ratio
|
||||
sum_radio = sum_radio + len(tmp) / len(item)
|
||||
# logger.debug(sum_radio)
|
||||
|
||||
# Calculate the average ratio and take three digits after the decimal point
|
||||
return round(sum_radio / len(result_ids), 3)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue