Skip to content

Commit

Permalink
add avg
Browse files Browse the repository at this point in the history
  • Loading branch information
markus583 committed May 14, 2024
1 parent bc514cf commit 1d5d66a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion wtpsplit/evaluation/evaluate_sepp_nlg_2021_subtask1.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

def evaluate_subtask1(splits, langs, prediction_dir: str, supervisions, include_n_documents) -> None:
results = {}
avg_holder = {}
for supervision in supervisions:
avg_holder[supervision] = 0
for lang_code in langs:
results[lang_code] = {}
for split in splits:
Expand Down Expand Up @@ -53,8 +56,15 @@ def evaluate_subtask1(splits, langs, prediction_dir: str, supervisions, include_
all_predicted_labels.extend(pred_labels)

eval_result = classification_report(all_gt_labels, all_predicted_labels, output_dict=True)
pprint(eval_result, indent=4)
# pprint(eval_result, indent=4)
print(eval_result["1"]["f1-score"])
avg_holder[supervision] += eval_result["1"]["f1-score"]
results[lang_code][split][supervision] = eval_result
results["avg"] = {}
for supervision in supervisions:
avg_holder[supervision] /= len(langs)
results["avg"][supervision] = avg_holder[supervision]
print(avg_holder)
json.dump(
results,
open(
Expand Down

0 comments on commit 1d5d66a

Please sign in to comment.