From d2f3a44b42bfff9773fdf3abaccdcc0e78d295f7 Mon Sep 17 00:00:00 2001 From: adrianeboyd Date: Wed, 8 Jan 2020 16:52:14 +0100 Subject: [PATCH] Improve train CLI sentrec scoring (#4892) * reorder to metrics to prioritize F over P/R * add sentrec to model metrics --- spacy/cli/train.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/cli/train.py b/spacy/cli/train.py index 454403529..6ebf5d37d 100644 --- a/spacy/cli/train.py +++ b/spacy/cli/train.py @@ -476,6 +476,8 @@ def _score_for_model(meta): mean_acc.append((acc["ents_p"] + acc["ents_r"] + acc["ents_f"]) / 3) if "textcat" in pipes: mean_acc.append(acc["textcat_score"]) + if "sentrec" in pipes: + mean_acc.append((acc["sent_p"] + acc["sent_r"] + acc["sent_f"]) / 3) return sum(mean_acc) / len(mean_acc) @@ -554,7 +556,7 @@ def _get_metrics(component): elif component == "ner": return ("ents_f", "ents_p", "ents_r") elif component == "sentrec": - return ("sent_p", "sent_r", "sent_f",) + return ("sent_f", "sent_p", "sent_r") return ("token_acc",)