Skip to content

Commit

Permalink
Removed commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
vloothuis committed May 9, 2024
1 parent b7cd9fa commit 1488750
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions score.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,18 @@ def score(prediction_path, ground_truth_path, output):
false_positives = len(
merged_df[(merged_df["prediction"] == 1) & (merged_df["new_child"] == 0)]
)
#false_negatives = len(
# merged_df[(merged_df["prediction"] == 0) & (merged_df["new_child"] == 1)]
#)

# Calculate the actual number of positive instances (N of people who actually had a new child) for calculating recall
n_all_positive_instances = len(merged_df[merged_df["new_child"] == 1])

# Calculate precision, recall, and F1 score
try:
precision = true_positives / (true_positives + false_positives)
except ZeroDivisionError:
precision = 0
#try:
#recall = true_positives / (true_positives + false_negatives)
#except ZeroDivisionError:
#recall = 0

recall = true_positives / n_all_positive_instances

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

0 comments on commit 1488750

Please sign in to comment.