Skip to content
Snippets Groups Projects
Commit 452a6529 authored by mmzk1526's avatar mmzk1526
Browse files

F1 by keyword

parent 21039d03
No related branches found
No related tags found
No related merge requests found
......@@ -115,10 +115,24 @@ def f1_by_input_length(split: int = 5) -> dict[tuple[int, int], float]:
return results
def f1_by_keyword() -> dict[str, float]:
keywords = combined["keyword"].unique()
result_dict = {}
f1 = load("f1")
for keyword in keywords:
cur = combined[combined["keyword"] == keyword]
print(f'{keyword} has {len(cur)} entries')
result_dict[keyword] = f1.compute(predictions=cur["pcl"].to_list(), references=cur["is_patronising"].to_list())
return result_dict
if __name__ == '__main__':
print("F1:", f1_score())
print("Recall:", recall())
print("Precision:", precision())
print("F1 by input length (fixed):", f1_by_input_length_fixed())
print("F1 by keyword:", f1_by_keyword())
for i in range(2, 17):
print(f1_by_input_length(i))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment