From 53d3b2483e39aea567827f97e29bb5aa95b42a30 Mon Sep 17 00:00:00 2001 From: Robin Holzinger Date: Sun, 22 Sep 2024 04:10:52 +0200 Subject: [PATCH] HotFix accuracy --- modyn/evaluator/internal/metrics/accuracy.py | 3 --- modyn/tests/evaluator/internal/metrics/test_accuracy.py | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modyn/evaluator/internal/metrics/accuracy.py b/modyn/evaluator/internal/metrics/accuracy.py index 540b7e27a..5c881d8df 100644 --- a/modyn/evaluator/internal/metrics/accuracy.py +++ b/modyn/evaluator/internal/metrics/accuracy.py @@ -24,9 +24,6 @@ def _batch_evaluated_callback(self, y_true: torch.Tensor, y_pred: torch.Tensor, self.total_correct += labeled_correctly self.samples_seen += batch_size - self.total_correct += labeled_correctly - self.samples_seen += batch_size - def get_evaluation_result(self) -> float: if self.samples_seen == 0: self.warning("Did not see any samples.") diff --git a/modyn/tests/evaluator/internal/metrics/test_accuracy.py b/modyn/tests/evaluator/internal/metrics/test_accuracy.py index 379611c77..a197cb953 100644 --- a/modyn/tests/evaluator/internal/metrics/test_accuracy.py +++ b/modyn/tests/evaluator/internal/metrics/test_accuracy.py @@ -67,6 +67,7 @@ def test_accuracy() -> None: accuracy.evaluate_batch(y_true, y_pred, 6) assert accuracy.get_evaluation_result() == pytest.approx(1.0 / 3) + assert accuracy.samples_seen - accuracy.total_correct == 0 + 6 + 4 def test_accuracy_invalid() -> None: