[skip ci] Add a comment about the calculation method of accuracy results (#8080)

Signed-off-by: wangting0128 <ting.wang@zilliz.com>
pull/8088/head
wt 2021-09-16 17:29:49 +08:00 committed by GitHub
parent a7a4a12220
commit e0ff07967c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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)