Spaces:
Running
Running
Zekun Wu
commited on
Commit
•
36ca842
1
Parent(s):
d85997b
add
Browse files- util/evaluation.py +5 -5
- util/injection.py +1 -1
util/evaluation.py
CHANGED
@@ -81,11 +81,11 @@ def calculate_four_fifths_rule(impact_ratios):
|
|
81 |
|
82 |
def statistical_tests(data):
|
83 |
# Add ranks for each score within each row
|
84 |
-
ranks = data[['Privilege_Avg_Score', 'Protect_Avg_Score', 'Neutral_Avg_Score']].rank(axis=1, ascending=True)
|
85 |
-
|
86 |
-
data['Privilege_Rank'] = ranks['Privilege_Avg_Score']
|
87 |
-
data['Protect_Rank'] = ranks['Protect_Avg_Score']
|
88 |
-
data['Neutral_Rank'] = ranks['Neutral_Avg_Score']
|
89 |
|
90 |
"""Perform various statistical tests to evaluate potential biases."""
|
91 |
variables = ['Privilege', 'Protect', 'Neutral']
|
|
|
81 |
|
82 |
def statistical_tests(data):
|
83 |
# Add ranks for each score within each row
|
84 |
+
# ranks = data[['Privilege_Avg_Score', 'Protect_Avg_Score', 'Neutral_Avg_Score']].rank(axis=1, ascending=True)
|
85 |
+
#
|
86 |
+
# data['Privilege_Rank'] = ranks['Privilege_Avg_Score']
|
87 |
+
# data['Protect_Rank'] = ranks['Protect_Avg_Score']
|
88 |
+
# data['Neutral_Rank'] = ranks['Neutral_Avg_Score']
|
89 |
|
90 |
"""Perform various statistical tests to evaluate potential biases."""
|
91 |
variables = ['Privilege', 'Protect', 'Neutral']
|
util/injection.py
CHANGED
@@ -100,7 +100,7 @@ def process_scores_multiple(df, num_run, parameters, privilege_label, protect_la
|
|
100 |
df[f'{category}_Avg_Score'] = df[f'{category}_Scores'].apply(calculate_avg_score)
|
101 |
|
102 |
# Add ranks for each score within each row
|
103 |
-
ranks = df[['Privilege_Avg_Score', 'Protect_Avg_Score', 'Neutral_Avg_Score']].rank(axis=1, ascending=
|
104 |
|
105 |
df['Privilege_Rank'] = ranks['Privilege_Avg_Score']
|
106 |
df['Protect_Rank'] = ranks['Protect_Avg_Score']
|
|
|
100 |
df[f'{category}_Avg_Score'] = df[f'{category}_Scores'].apply(calculate_avg_score)
|
101 |
|
102 |
# Add ranks for each score within each row
|
103 |
+
ranks = df[['Privilege_Avg_Score', 'Protect_Avg_Score', 'Neutral_Avg_Score']].rank(axis=1, ascending=False)
|
104 |
|
105 |
df['Privilege_Rank'] = ranks['Privilege_Avg_Score']
|
106 |
df['Protect_Rank'] = ranks['Protect_Avg_Score']
|