beir-cellar / beir

A Heterogeneous Benchmark for Information Retrieval. Easy to use, evaluate your models across 15+ diverse IR datasets.
http://beir.ai
Apache License 2.0
1.55k stars 186 forks source link

Error in accuracy function #45

Closed wolhandlerdeb closed 2 years ago

wolhandlerdeb commented 2 years ago

In the custom_metrics.py file, top_accuracy function: you write: top_hits[query_id] = sorted(doc_scores.keys(), key=lambda item: item[1], reverse=True)[0:k_max] but I think that you should instead wrote [elem[0] for elem in sorted(doc_scores.items(), key=lambda item: item[1], reverse=True)[0:k_max]] indeed, in your code, you are sorting by the key and not by the score

thakur-nandan commented 2 years ago

Hi @wolhandlerdeb,

Thank you very much for pointing out this mistake! Wow, I did a mistake there and I am soon going to push a new pypi version with the updated changes.