Commit 5e4f1799 authored by lintangsutawika's avatar lintangsutawika
Browse files

brier score for loglikelihood task

parent 6998762a
...@@ -960,9 +960,16 @@ class ConfigurableTask(Task): ...@@ -960,9 +960,16 @@ class ConfigurableTask(Task):
if self.OUTPUT_TYPE == "loglikelihood": if self.OUTPUT_TYPE == "loglikelihood":
results = results[0] results = results[0]
ll, is_greedy = results ll, is_greedy = results
prob_norm = np.exp(ll)
return { return {
**({"perplexity": ll} if "perplexity" in use_metric else {}), **({"perplexity": ll} if "perplexity" in use_metric else {}),
**({"acc": int(is_greedy)} if "acc" in use_metric else {}), **({"acc": int(is_greedy)} if "acc" in use_metric else {}),
**(
{"brier_score": (0, [prob_norm])} # Gold is Index 0
if "brier_score" in use_metric
else {}
),
} }
elif self.OUTPUT_TYPE == "loglikelihood_rolling": elif self.OUTPUT_TYPE == "loglikelihood_rolling":
(loglikelihood,) = results (loglikelihood,) = results
......
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