(predictions, labels, examples: List[InputExample], metric)
| 61 | |
| 62 | |
| 63 | def qa_evaluate(predictions, labels, examples: List[InputExample], metric): |
| 64 | assert len(examples) == len(predictions) |
| 65 | score = 0.0 |
| 66 | for example, prediction in zip(examples, predictions): |
| 67 | ground_truths = example.meta["answers"] |
| 68 | prediction = example.meta["candidates"][prediction] |
| 69 | if ground_truths: |
| 70 | score += metric_max_over_ground_truths(metric, prediction, ground_truths) |
| 71 | score = 100.0 * score / len(predictions) |
| 72 | return score |
| 73 | |
| 74 | |
| 75 | def squad_evaluate(predictions, labels, examples, metric): |
nothing calls this directly
no test coverage detected