From f232d8db96c331b70c4b50e7173185e749e097f6 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 24 Aug 2020 17:17:23 +0200 Subject: [PATCH] Report p/r/f out of 100 --- spacy/scorer.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spacy/scorer.py b/spacy/scorer.py index dc017f82f..c28903d02 100644 --- a/spacy/scorer.py +++ b/spacy/scorer.py @@ -30,17 +30,17 @@ class PRFScore: @property def precision(self) -> float: - return self.tp / (self.tp + self.fp + 1e-100) + return (self.tp / (self.tp + self.fp + 1e-100)) * 100 @property def recall(self) -> float: - return self.tp / (self.tp + self.fn + 1e-100) + return (self.tp / (self.tp + self.fn + 1e-100)) * 100 @property def fscore(self) -> float: p = self.precision r = self.recall - return 2 * ((p * r) / (p + r + 1e-100)) + return (2 * ((p * r) / (p + r + 1e-100))) * 100 def to_dict(self) -> Dict[str, float]: return {"p": self.precision, "r": self.recall, "f": self.fscore} @@ -145,10 +145,10 @@ class Scorer: acc_score.tp += 1 prf_score.score_set(pred_spans, gold_spans) return { - "token_acc": acc_score.fscore, - "token_p": prf_score.precision, - "token_r": prf_score.recall, - "token_f": prf_score.fscore, + "token_acc": acc_score.fscore * 100, + "token_p": prf_score.precision * 100, + "token_r": prf_score.recall * 100, + "token_f": prf_score.fscore * 100, } @staticmethod