(items)
| 46 | |
| 47 | |
| 48 | def acc_all(items): |
| 49 | # Only count as correct if all answers are labeled correctly for each question |
| 50 | question_scoring_dict = {} |
| 51 | preds = list(zip(*items))[0] |
| 52 | docs = list(zip(*items))[1] |
| 53 | |
| 54 | for doc, pred in zip(docs, preds): |
| 55 | paragraph_id = doc["idx"]["paragraph"] |
| 56 | question_id = doc["idx"]["question"] |
| 57 | if (paragraph_id, question_id) not in question_scoring_dict: |
| 58 | question_scoring_dict[(paragraph_id, question_id)] = [] |
| 59 | |
| 60 | gold_label = doc["label"] == 1 |
| 61 | |
| 62 | question_scoring_dict[(paragraph_id, question_id)].append(gold_label == pred) |
| 63 | acc = np.mean([int(all(x)) for x in question_scoring_dict.values()]) |
| 64 | return acc |
| 65 | |
| 66 | |
| 67 | def acc_all_stderr(items): |
nothing calls this directly
no outgoing calls
no test coverage detected