(self, doc, results)
| 333 | return requests |
| 334 | |
| 335 | def process_results(self, doc, results): |
| 336 | # ReCoRD's evaluation is actually deceptively simple: |
| 337 | # - Pick the maximum likelihood prediction entity |
| 338 | # - Evaluate the accuracy and token F1 PER EXAMPLE |
| 339 | # - Average over all examples |
| 340 | max_idx = np.argmax(np.array([result[0] for result in results])) |
| 341 | |
| 342 | prediction = doc["entities"][max_idx] |
| 343 | gold_label_set = doc["answers"] |
| 344 | f1 = metric_max_over_ground_truths( |
| 345 | squad_metrics.compute_f1, prediction, gold_label_set |
| 346 | ) |
| 347 | em = metric_max_over_ground_truths( |
| 348 | squad_metrics.compute_exact, prediction, gold_label_set |
| 349 | ) |
| 350 | |
| 351 | return { |
| 352 | "f1": f1, |
| 353 | "em": em, |
| 354 | } |
| 355 | |
| 356 | def higher_is_better(self): |
| 357 | return { |
nothing calls this directly
no test coverage detected