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 authored and steenrotsman committed May 13, 2024
1 parent d91e52b commit 6cb14f9
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 @@ -84,7 +84,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 6cb14f9

Please sign in to comment.