From 54ead73c0bd1fa16cb68946eb288a63ee76a5ae9 Mon Sep 17 00:00:00 2001 From: Naga Karthik Date: Tue, 18 Jun 2024 21:23:04 -0400 Subject: [PATCH] remove cases where emptyPred and emptyRef are both true as they skew the dice --- compute_metrics_reloaded.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compute_metrics_reloaded.py b/compute_metrics_reloaded.py index 05494ae..f2c51a6 100644 --- a/compute_metrics_reloaded.py +++ b/compute_metrics_reloaded.py @@ -255,6 +255,12 @@ def main(): # Convert JSON data to pandas DataFrame df = build_output_dataframe(output_list) + # create a separate dataframe for columns where EmptyRef and EmptyPred is True + df_empty_masks = df[(df['EmptyRef'] == True) & (df['EmptyPred'] == True)] + + # keep only the rows where either pred or ref is non-empty or both are non-empty + df = df[(df['EmptyRef'] == False) | (df['EmptyPred'] == False)] + # Compute mean and standard deviation of metrics across all subjects df_mean = (df.drop(columns=['reference', 'prediction', 'EmptyRef', 'EmptyPred']).groupby('label'). agg(['mean', 'std']).reset_index())