omidf commited on
Commit
a86f57e
·
1 Parent(s): e6391c4

Update compute_score.py

Browse files
Files changed (1) hide show
  1. compute_score.py +5 -3
compute_score.py CHANGED
@@ -84,9 +84,11 @@ def compute_score(dataset, predictions):
84
  ground_truths = list(map(lambda x: x["text"], qa["answers"]))
85
  prediction = predictions[qa["id"]]
86
  exact_match += metric_max_over_ground_truths(exact_match_score, prediction, ground_truths)
87
- precision += metric_max_over_ground_truths(precision_score, prediction, ground_truths)
88
- recall += metric_max_over_ground_truths(recall_score, prediction, ground_truths)
89
- f1 += (2 * precision * recall) / (precision + recall)
 
 
90
  exact_match = 100.0 * exact_match / total
91
  f1 = 100.0 * f1 / total
92
  recall = 100.0 * recall / total
 
84
  ground_truths = list(map(lambda x: x["text"], qa["answers"]))
85
  prediction = predictions[qa["id"]]
86
  exact_match += metric_max_over_ground_truths(exact_match_score, prediction, ground_truths)
87
+ precision_qa = metric_max_over_ground_truths(precision_score, prediction, ground_truths)
88
+ recall_qa = metric_max_over_ground_truths(recall_score, prediction, ground_truths)
89
+ f1 += (2 * precision_qa * recall_qa) / (precision_qa + recall_qa)
90
+ recall += recall_qa
91
+ precision += precision_qa
92
  exact_match = 100.0 * exact_match / total
93
  f1 = 100.0 * f1 / total
94
  recall = 100.0 * recall / total