Skip to content

Commit

Permalink
Merge pull request #125 from ugm2/patch-1
Browse files Browse the repository at this point in the history
Use invoked logger and not logging library
  • Loading branch information
thakur-nandan authored Jul 21, 2023
2 parents da30e7d + 3111bef commit 6a7d46c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions beir/retrieval/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def evaluate(qrels: Dict[str, Dict[str, int]],
ignore_identical_ids: bool=True) -> Tuple[Dict[str, float], Dict[str, float], Dict[str, float], Dict[str, float]]:

if ignore_identical_ids:
logging.info('For evaluation, we ignore identical query and document ids (default), please explicitly set ``ignore_identical_ids=False`` to ignore this.')
logger.info('For evaluation, we ignore identical query and document ids (default), please explicitly set ``ignore_identical_ids=False`` to ignore this.')
popped = []
for qid, rels in results.items():
for pid in list(rels):
Expand Down Expand Up @@ -84,9 +84,9 @@ def evaluate(qrels: Dict[str, Dict[str, int]],
precision[f"P@{k}"] = round(precision[f"P@{k}"]/len(scores), 5)

for eval in [ndcg, _map, recall, precision]:
logging.info("\n")
logger.info("\n")
for k in eval.keys():
logging.info("{}: {:.4f}".format(k, eval[k]))
logger.info("{}: {:.4f}".format(k, eval[k]))

return ndcg, _map, recall, precision

Expand All @@ -105,4 +105,4 @@ def evaluate_custom(qrels: Dict[str, Dict[str, int]],
return hole(qrels, results, k_values)

elif metric.lower() in ["acc", "top_k_acc", "accuracy", "accuracy@k", "top_k_accuracy"]:
return top_k_accuracy(qrels, results, k_values)
return top_k_accuracy(qrels, results, k_values)

0 comments on commit 6a7d46c

Please sign in to comment.