Skip to content

Commit

Permalink
fix: breaking change in top-k accuracy metric as kindly pointed out i…
Browse files Browse the repository at this point in the history
…n issue #45
  • Loading branch information
thakur-nandan committed Oct 22, 2021
1 parent f76c997 commit 8a83624
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion beir/retrieval/custom_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def top_k_accuracy(
logging.info("\n")

for query_id, doc_scores in results.items():
top_hits[query_id] = sorted(doc_scores.keys(), key=lambda item: item[1], reverse=True)[0:k_max]
top_hits[query_id] = [item[0] for item in sorted(doc_scores.items(), key=lambda item: item[1], reverse=True)[0:k_max]]

for query_id in qrels:
query_relevant_docs = set([doc_id for doc_id in qrels[query_id] if qrels[query_id][doc_id] > 0])
Expand Down

0 comments on commit 8a83624

Please sign in to comment.