def test_empty_batch(): aggregator = StatsAggregator(["a", "b"]) assert aggregator.accuracy() == 0 assert aggregator.precision("a") == 0 assert aggregator.precision("b") == 0 assert aggregator.recall("a") == 0 assert aggregator.recall("b") == 0 assert aggregator.f1_score("a") == 0 assert aggregator.f1_score("b") == 0
def test_recall(aggregator: StatsAggregator): assert np.isclose(aggregator.recall("a"), 4 / 6) assert np.isclose(aggregator.recall("b"), 1 / 2)