:returns: {str: [float] -> float} A dictionary where keys are the names of submetrics and values are functions that aggregate a list of metrics
(self)
| 169 | } |
| 170 | |
| 171 | def aggregation(self): |
| 172 | """ |
| 173 | :returns: {str: [float] -> float} |
| 174 | A dictionary where keys are the names of submetrics and values are |
| 175 | functions that aggregate a list of metrics |
| 176 | """ |
| 177 | return { |
| 178 | "exact": partial( |
| 179 | _squad_agg, "exact" |
| 180 | ), # Exact match (the normalized answer exactly match the gold answer) |
| 181 | "f1": partial( |
| 182 | _squad_agg, "f1" |
| 183 | ), # The F-score of predicted tokens versus the gold answer |
| 184 | "HasAns_exact": partial( |
| 185 | _squad_agg, "HasAns_exact" |
| 186 | ), # Exact match (the normalized answer exactly match the gold answer) |
| 187 | "HasAns_f1": partial( |
| 188 | _squad_agg, "HasAns_f1" |
| 189 | ), # The F-score of predicted tokens versus the gold answer |
| 190 | "NoAns_exact": partial( |
| 191 | _squad_agg, "NoAns_exact" |
| 192 | ), # Exact match (the normalized answer exactly match the gold answer) |
| 193 | "NoAns_f1": partial( |
| 194 | _squad_agg, "NoAns_f1" |
| 195 | ), # The F-score of predicted tokens versus the gold answer |
| 196 | "best_exact": partial( |
| 197 | _squad_agg, "best_exact" |
| 198 | ), # Best exact match (with varying threshold) |
| 199 | "best_f1": partial( |
| 200 | _squad_agg, "best_f1" |
| 201 | ), # Best F1 (with varying threshold) |
| 202 | } |
| 203 | |
| 204 | def higher_is_better(self): |
| 205 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected