-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add methods for dealing with fairness in rankings #461
Conversation
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
…ive and relaxed Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: andrewklayk <andrew.klyachkin@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
…site Signed-off-by: Illia Kryvoviaz <illiakryvoviaz@gmail.com> Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
a449dcd
to
c1aebb5
Compare
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
eed62cd
to
96b1825
Compare
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
6fef28d
to
c860145
Compare
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @andrewklayk, this looks great! Other than the small comments, I think we can merge this.
I would love to include this in the aif360.sklearn
subpackage as well. There is a slightly different API for those algorithms/metrics but it should actually be easier to use since you rely on DataFrames anyway. That can be a separate PR if you prefer or you can add it to this one.
"import tempfile\n", | ||
"import requests\n", | ||
"import zipfile\n", | ||
"import os\n", | ||
"import pandas as pd \n", | ||
"\n", | ||
"with tempfile.TemporaryDirectory() as temp_dir:\n", | ||
" response = requests.get(\"http://www.seaphe.org/databases/LSAC/LSAC_SAS.zip\")\n", | ||
" temp_file_name = os.path.join(temp_dir, \"LSAC_SAS.zip\")\n", | ||
" with open(temp_file_name, \"wb\") as temp_file:\n", | ||
" temp_file.write(response.content)\n", | ||
" with zipfile.ZipFile(temp_file_name, 'r') as zip_ref:\n", | ||
" zip_ref.extractall(temp_dir)\n", | ||
" data = pd.read_sas(os.path.join(temp_dir, \"lsac.sas7bdat\"))\n", | ||
" data = data.assign(gender=(data[\"gender\"] == b\"male\") * 1)\n", | ||
" data['race'] = data['race1']\n", | ||
" data = data[['race', 'gender', 'lsat', 'ugpa', 'zfygpa']]\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not use the built-in LawSchoolGPADataset
class here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the initial idea, but I couldn't get the tempeh
import to work, despite having installed the .[LawSchoolGPA]
option of the package. I've tried installing tempeh
separately, reinstalling AIF360 manually and so on, but to no end. Without the import, neither the LawSchoolGPADataset
nor the fetch_lawschool_gpa
work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An update on this: it seems like the SEAPHE website is no more (domain expired), which means that neither this code nor the AIF360 functions work. Could you suggest some other dataset in the library that would work as an example here? Or, alternatively, the LawSchoolGPA dataset is still available from the Internet Archive backup of the SEAPHE website.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is unfortunate... I've reached out to SEAPHE and they're investigating. Let's give it a week and see if they can get the website back up.
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Hello @hoffmansc, |
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Signed-off-by: Andrii Kliachkin <andrew.klyachkin@gmail.com>
Hi @hoffmansc - seems like the Law School dependency has been removed from the demo notebook. Is this good to merge? |
We've implemented a set of post-processing algorithms for dealing with fairness in rankings, as described in https://arxiv.org/abs/1905.01989 (KDD 2019), complete with a demo notebook and tests.
Along with the algorithms, we've added two useful metrics for evaluating rankings that were introduced or referenced in the paper (Infeasibility Index and Discounted Cumulative Gain). Further details are available in the demo notebook.
closes #455