Skip to content

Commit

Permalink
Ensure no crash in scoring when 0 n_all_positive_instances
Browse files Browse the repository at this point in the history
  • Loading branch information
vloothuis committed May 9, 2024
1 parent 1488750 commit 1cfade1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion score.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def score(prediction_path, ground_truth_path, output):
except ZeroDivisionError:
precision = 0

recall = true_positives / n_all_positive_instances
try:
recall = true_positives / n_all_positive_instances
except ZeroDivisionError:
recall = 0

try:
f1_score = 2 * (precision * recall) / (precision + recall)
Expand Down

0 comments on commit 1cfade1

Please sign in to comment.