Unverified Commit 3eaa493e authored by Leo Gao's avatar Leo Gao Committed by GitHub
Browse files

Make acc_norm a separate metric

parent fae5fe66
...@@ -225,22 +225,25 @@ class MultipleChoiceTask(Task): ...@@ -225,22 +225,25 @@ class MultipleChoiceTask(Task):
def process_results(self, doc, results): def process_results(self, doc, results):
gold = doc["gold"] gold = doc["gold"]
acc = 1. if np.argmax(results) == gold else 0.
completion_len = np.array([float(len(i)) for i in doc["choices"]]) completion_len = np.array([float(len(i)) for i in doc["choices"]])
acc_norm = 1. if np.argmax(results / completion_len) == gold else 0.
acc = 1. if np.argmax(results/completion_len) == gold else 0.
return { return {
"acc": acc "acc": acc,
"acc_norm": acc_norm,
} }
def higher_is_better(self): def higher_is_better(self):
return { return {
"acc": True "acc": True,
"acc_norm": True,
} }
def aggregation(self): def aggregation(self):
return { return {
"acc": mean "acc": mean,
"acc_norm": mean,
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment