Zekun Wu commited on
Commit
8f2e74d
1 Parent(s): c2ac8ae
Files changed (1) hide show
  1. util/injection.py +2 -1
util/injection.py CHANGED
@@ -124,6 +124,7 @@ def process_scores_multiple(df, num_run, parameters, privilege_label, protect_la
124
 
125
  print(f"Scores: {scores}")
126
 
 
127
  for category in ['Privilege_characteristics', 'Privilege_normal', 'Protect_characteristics', 'Protect_normal',
128
  'Neutral_characteristics', 'Neutral_normal']:
129
  # Debug: Print the scores for the current category
@@ -131,7 +132,7 @@ def process_scores_multiple(df, num_run, parameters, privilege_label, protect_la
131
  print(f"Scores: {scores[category]}")
132
 
133
  # Ensure the scores are lists
134
- df[f'{category}_Scores'] = pd.Series([lst if isinstance(lst, list) else [] for lst in scores[category]])
135
 
136
  # Debug: Check the Series after assignment
137
  print(f"Series for {category}_Scores:\n{df[f'{category}_Scores']}")
 
124
 
125
  print(f"Scores: {scores}")
126
 
127
+ # Ensure all scores are lists and calculate average scores
128
  for category in ['Privilege_characteristics', 'Privilege_normal', 'Protect_characteristics', 'Protect_normal',
129
  'Neutral_characteristics', 'Neutral_normal']:
130
  # Debug: Print the scores for the current category
 
132
  print(f"Scores: {scores[category]}")
133
 
134
  # Ensure the scores are lists
135
+ df[f'{category}_Scores'] = pd.Series(scores[category])
136
 
137
  # Debug: Check the Series after assignment
138
  print(f"Series for {category}_Scores:\n{df[f'{category}_Scores']}")