Improve train CLI sentrec scoring (#4892)

* reorder to metrics to prioritize F over P/R
* add sentrec to model metrics
This commit is contained in:
adrianeboyd 2020-01-08 16:52:14 +01:00 committed by Ines Montani
parent e55fa1899a
commit d2f3a44b42
1 changed files with 3 additions and 1 deletions

View File

@ -476,6 +476,8 @@ def _score_for_model(meta):
mean_acc.append((acc["ents_p"] + acc["ents_r"] + acc["ents_f"]) / 3) mean_acc.append((acc["ents_p"] + acc["ents_r"] + acc["ents_f"]) / 3)
if "textcat" in pipes: if "textcat" in pipes:
mean_acc.append(acc["textcat_score"]) 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) return sum(mean_acc) / len(mean_acc)
@ -554,7 +556,7 @@ def _get_metrics(component):
elif component == "ner": elif component == "ner":
return ("ents_f", "ents_p", "ents_r") return ("ents_f", "ents_p", "ents_r")
elif component == "sentrec": elif component == "sentrec":
return ("sent_p", "sent_r", "sent_f",) return ("sent_f", "sent_p", "sent_r")
return ("token_acc",) return ("token_acc",)