Spaces:
Sleeping
Sleeping
Zekun Wu
commited on
Commit
•
e48c7ce
1
Parent(s):
d360cd7
update
Browse files- util/injection.py +2 -2
util/injection.py
CHANGED
@@ -117,10 +117,10 @@ def process_scores_multiple(df, num_run, parameters, privilege_label, protect_la
|
|
117 |
scores[key+"_characteristics"][index].append(result_charateristics)
|
118 |
scores[key+"_normal"][index].append(result_normal)
|
119 |
|
120 |
-
#
|
121 |
for category in ['Privilege', 'Protect', 'Neutral']:
|
122 |
for key in ['characteristics', 'normal']:
|
123 |
-
df[f'{category}_{key}_Scores'] = pd.Series(
|
124 |
df[f'{category}_{key}_Avg_Score'] = df[f'{category}_{key}_Scores'].apply(
|
125 |
lambda score_list: sum(score for score in score_list if score not in [None, -1]) / len(score_list)
|
126 |
if isinstance(score_list, list) and score_list else None
|
|
|
117 |
scores[key+"_characteristics"][index].append(result_charateristics)
|
118 |
scores[key+"_normal"][index].append(result_normal)
|
119 |
|
120 |
+
# Ensure all scores are lists and calculate average scores
|
121 |
for category in ['Privilege', 'Protect', 'Neutral']:
|
122 |
for key in ['characteristics', 'normal']:
|
123 |
+
df[f'{category}_{key}_Scores'] = pd.Series(scores[f'{category}_{key}'])
|
124 |
df[f'{category}_{key}_Avg_Score'] = df[f'{category}_{key}_Scores'].apply(
|
125 |
lambda score_list: sum(score for score in score_list if score not in [None, -1]) / len(score_list)
|
126 |
if isinstance(score_list, list) and score_list else None
|