Skip to content

Commit 8cedccb

Browse files
committed
ENH add fair versions of moving company datasets pt.2
1 parent f6408ad commit 8cedccb

File tree

5 files changed

+4013
-6
lines changed

5 files changed

+4013
-6
lines changed

xai_ranking/datasets/_download_movers.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pandas as pd
99

1010

11-
def fetch_movers_data(test=False, fair=False):
11+
def fetch_movers_data(test=False, fair="biased"):
1212
"""
1313
Fetches a dataset with fictional info on applications for a moving company
1414
taken from:
@@ -31,17 +31,24 @@ def fetch_movers_data(test=False, fair=False):
3131
If True, fetches the test set. Otherwise, fetches the training set.
3232
Default is False.
3333
34+
fair : str, optional
35+
If "fair", fetches the debiased version of the dataset. If "partial", fetches
36+
the partially debiased version (gender is debiased, race is not). If "biased",
37+
fetches the biased dataset.
38+
3439
Returns
3540
-------
3641
pd.DataFrame
3742
The processed moving company data.
3843
"""
3944
split = "test" if test else "train"
40-
filename = (
41-
f"fair_res__bias_R10_{split}_ranklib.txt"
42-
if fair
43-
else f"R10_{split}_ranklib.txt"
44-
)
45+
if fair == "biased":
46+
f"R10_{split}_ranklib.txt"
47+
elif fair == "partial":
48+
filename = f"fair_res__bias_R10__{split}_ranklib.txt"
49+
elif fair == "fair":
50+
filename = f"fair_res__fair_res_R10__{split}_ranklib.txt"
51+
4552
filepath = join(dirname(abspath(__file__)), "files", filename)
4653
df = pd.read_csv(
4754
filepath,

xai_ranking/datasets/files/fair_res__bias_R10_test_ranklib.txt renamed to xai_ranking/datasets/files/fair_res__bias__R10_test_ranklib.txt

File renamed without changes.

xai_ranking/datasets/files/fair_res__bias_R10_train_ranklib.txt renamed to xai_ranking/datasets/files/fair_res__bias__R10_train_ranklib.txt

File renamed without changes.

0 commit comments

Comments
 (0)