mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-28 01:20:38 +03:00
Include per-type/feat scores in evaluate output
This commit is contained in:
parent
75a202ce65
commit
4300858ecb
|
@ -105,15 +105,22 @@ def evaluate(
|
||||||
|
|
||||||
msg.table(results, title="Results")
|
msg.table(results, title="Results")
|
||||||
|
|
||||||
|
if "morph_per_feat" in scores:
|
||||||
|
if scores["morph_per_feat"]:
|
||||||
|
print_morph_per_feat(msg, scores["morph_per_feat"])
|
||||||
|
data["morph_per_feat"] = scores["morph_per_feat"]
|
||||||
if "ents_per_type" in scores:
|
if "ents_per_type" in scores:
|
||||||
if scores["ents_per_type"]:
|
if scores["ents_per_type"]:
|
||||||
print_ents_per_type(msg, scores["ents_per_type"])
|
print_ents_per_type(msg, scores["ents_per_type"])
|
||||||
|
data["ents_per_type"] = scores["ents_per_type"]
|
||||||
if "cats_f_per_type" in scores:
|
if "cats_f_per_type" in scores:
|
||||||
if scores["cats_f_per_type"]:
|
if scores["cats_f_per_type"]:
|
||||||
print_textcats_f_per_cat(msg, scores["cats_f_per_type"])
|
print_textcats_f_per_cat(msg, scores["cats_f_per_type"])
|
||||||
|
data["cats_f_per_type"] = scores["cats_f_per_type"]
|
||||||
if "cats_auc_per_type" in scores:
|
if "cats_auc_per_type" in scores:
|
||||||
if scores["cats_auc_per_type"]:
|
if scores["cats_auc_per_type"]:
|
||||||
print_textcats_auc_per_cat(msg, scores["cats_auc_per_type"])
|
print_textcats_auc_per_cat(msg, scores["cats_auc_per_type"])
|
||||||
|
data["cats_auc_per_type"] = scores["cats_auc_per_type"]
|
||||||
|
|
||||||
if displacy_path:
|
if displacy_path:
|
||||||
factory_names = [nlp.get_pipe_meta(pipe).factory for pipe in nlp.pipe_names]
|
factory_names = [nlp.get_pipe_meta(pipe).factory for pipe in nlp.pipe_names]
|
||||||
|
@ -157,6 +164,19 @@ def render_parses(
|
||||||
file_.write(html)
|
file_.write(html)
|
||||||
|
|
||||||
|
|
||||||
|
def print_morph_per_feat(msg: Printer, scores: Dict[str, Dict[str, float]]) -> None:
|
||||||
|
data = [
|
||||||
|
(k, f"{v['p']*100:.2f}", f"{v['r']*100:.2f}", f"{v['f']*100:.2f}")
|
||||||
|
for k, v in scores.items()
|
||||||
|
]
|
||||||
|
msg.table(
|
||||||
|
data,
|
||||||
|
header=("", "P", "R", "F"),
|
||||||
|
aligns=("l", "r", "r", "r"),
|
||||||
|
title="MORPH (per feat)",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def print_ents_per_type(msg: Printer, scores: Dict[str, Dict[str, float]]) -> None:
|
def print_ents_per_type(msg: Printer, scores: Dict[str, Dict[str, float]]) -> None:
|
||||||
data = [
|
data = [
|
||||||
(k, f"{v['p']*100:.2f}", f"{v['r']*100:.2f}", f"{v['f']*100:.2f}")
|
(k, f"{v['p']*100:.2f}", f"{v['r']*100:.2f}", f"{v['f']*100:.2f}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user