(outputs, targets)
| 130 | return F1_sum / count |
| 131 | |
| 132 | def EM(outputs, targets): |
| 133 | em_sum = 0 |
| 134 | count = 0 |
| 135 | for i in range(len(outputs)): |
| 136 | if outputs[i] is None: |
| 137 | continue |
| 138 | count += 1 |
| 139 | predicted_answer = set(outputs[i]['predict']) |
| 140 | gold_answer = targets[i] |
| 141 | if len(gold_answer.intersection(predicted_answer)) == len(gold_answer) and len(gold_answer.intersection(predicted_answer)) == len(predicted_answer): |
| 142 | em_sum += 1 |
| 143 | |
| 144 | if count == 0: |
| 145 | return 0 |
| 146 | else: |
| 147 | return em_sum / count |
| 148 | |
| 149 | |
| 150 | def executability(outputs): |
nothing calls this directly
no outgoing calls
no test coverage detected