Skip to content

Commit

Permalink
linter7
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriJasnovidov committed Jan 9, 2024
1 parent b43f559 commit 8d13a9f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
25 changes: 22 additions & 3 deletions tests/test_general/bar_pass_data_preparing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,28 @@ def grouper_gpa(x):
def prepare_data(name="bar_pass_prediction"):
if name == "bar_pass_prediction":
d = pd.read_csv("bar_pass_prediction.csv")
for x in ["ID", "race1", "race2", "sex", "bar", "dnn_bar_pass_prediction", "pass_bar", "indxgrp2",
"gender", "grad", "Dropout", "fulltime", "lsat", "zfygpa", "ugpa", "zgpa", "other", "asian",
"black", "hisp"]:
for x in [
"ID",
"race1",
"race2",
"sex",
"bar",
"dnn_bar_pass_prediction",
"pass_bar",
"indxgrp2",
"gender",
"grad",
"Dropout",
"fulltime",
"lsat",
"zfygpa",
"ugpa",
"zgpa",
"other",
"asian",
"black",
"hisp"
]:
del d[x]

d["gpa"] = d["gpa"].apply(grouper_gpa)
Expand Down
4 changes: 1 addition & 3 deletions tests/test_general/test_fairness.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def test_fairness():
dataset = prepare_data()
cl = LGBMClassifier(verbose=-1)
fairness = Fair(dataset, estimator=cl)
res = fairness.run(number_iterations=20,
interior_classifier='knn',
multiplier=50)
res = fairness.run(number_iterations=20, interior_classifier="knn", multiplier=50)

assert res["accuracy_of_initial_classifier"] - res["accuracy_of_fair_classifier"] <= 0.5
assert res["fairness_of_fair_classifier_diff"] <= res["fairness_of_initial_classifier_diff"]

0 comments on commit 8d13a9f

Please sign in to comment.