Skip to content

Commit

Permalink
Merge branch 'robinholzi/hotfix/accuracy-bug' into robin/thesis/exper…
Browse files Browse the repository at this point in the history
…iment-configs
  • Loading branch information
robinholzi committed Sep 22, 2024
2 parents c1457bd + 279038a commit a468578
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 0 additions & 3 deletions modyn/evaluator/internal/metrics/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
1 change: 1 addition & 0 deletions modyn/tests/evaluator/internal/metrics/test_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a468578

Please sign in to comment.