Example #1
0
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
Example #2
0
def test_precision(aggregator: StatsAggregator):
    assert np.isclose(aggregator.precision("a"), 4 / 5)
    assert np.isclose(aggregator.precision("b"), 1 / 3)