Take a single document and the LM results and evaluates, returning a dict where keys are the names of submetrics and values are the values of the metric for that one document :param doc: The document as returned from training_docs, validation_docs, or test_docs.
(self, doc, results)
| 145 | return cont_request |
| 146 | |
| 147 | def process_results(self, doc, results): |
| 148 | """Take a single document and the LM results and evaluates, returning a |
| 149 | dict where keys are the names of submetrics and values are the values of |
| 150 | the metric for that one document |
| 151 | |
| 152 | :param doc: |
| 153 | The document as returned from training_docs, validation_docs, or test_docs. |
| 154 | :param results: |
| 155 | The results of the requests created in construct_requests. |
| 156 | """ |
| 157 | turn_id = len(doc["questions"]["input_text"]) |
| 158 | gold_list = self.get_answers(doc, turn_id) |
| 159 | pred = results[0].strip().split("\n")[0] |
| 160 | |
| 161 | scores = self.compute_scores(gold_list, pred) |
| 162 | |
| 163 | return { |
| 164 | "f1": scores["f1"], |
| 165 | "em": scores["em"], |
| 166 | } |
| 167 | |
| 168 | def higher_is_better(self): |
| 169 | return { |
nothing calls this directly
no test coverage detected