Skip to content

Commit

Permalink
Add support for micro and macro f1 metrics for multilabel classificat…
Browse files Browse the repository at this point in the history
…ion.

Adds supports for micro and macro f1 metrics computations for multilabel classification. Also replaces `assertContainsSubset` in tests with a functional version that checks equality of asserted values.

PiperOrigin-RevId: 571374029
  • Loading branch information
T5 Team authored and t5-copybara committed Oct 6, 2023
1 parent dd1cede commit 9c12f78
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions t5/evaluation/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ def assertDictClose(self, a, b, delta=None, places=None):
self.assertAlmostEqual(a[k], b[k], delta=delta, places=places)
except AssertionError as e:
raise AssertionError(str(e) + " for key '%s'" % k)

def assertDictContainsSubset(self, expected_subset, actual_set):
self.assertContainsSubset(expected_subset.keys(), actual_set.keys())
for k in expected_subset:
try:
self.assertEqual(expected_subset[k], actual_set[k])
except AssertionError as e:
raise AssertionError(str(e) + " for key '%s'" % k) from None

0 comments on commit 9c12f78

Please sign in to comment.