Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

updated weighted_f1 to not assume binary classification #3728

Merged
merged 1 commit into from
Jun 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions parlai/core/torch_classifier_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,8 @@ def value(self) -> float:
values = list(self._values.values())
if len(values) == 0:
return weighted_f1
total_examples = (
values[0]._true_positives
+ values[0]._true_negatives
+ values[0]._false_positives
+ values[0]._false_negatives
total_examples = sum(
[each._true_positives + each._false_negatives for each in values]
)
for each in values:
actual_positive = each._true_positives + each._false_negatives
Expand Down