Exemplo n.º 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
Exemplo n.º 2
0
def test_recall(aggregator: StatsAggregator):
    assert np.isclose(aggregator.recall("a"), 4 / 6)
    assert np.isclose(aggregator.recall("b"), 1 / 2)