FairRankTune a python pacakage for fairness-aware data generation, metrics, and algorithms.
Project description
FairRankTune
Updated 8/2023 with additional metrics (score-based group and individual fairness).
- Basic installation instructions
- Quick start & notebook playground
- FairRankTune source
- Reproducing experiments
- Plotting experimental results
Basic Installation Instructions
- Install via pip (note this is not available due to anonymized review. Once we can we will make fairranktune a pypi package).
pip install FairRankTune
Or install directly from source (right now please download from the anonymous.4open.science repository).
git clone <repo>
- To use the generator you need to import the function from the package:
import FairRankTune as rt
Quick Start Playground
To use FairRankTune in your run:
import FairRankTune as frt
import numpy as np #helpful to use
To generate a ranking with only the group distribution, number of items, and phi
num_items = 1000
phi = 1 # maximally unfair
group_proportions = np.array([0.2, .3, .5]) # groups of size 200, 300, and 500
ranking, group_ids_in_ranking = frt.GenFromGroups(group_proportions, num_items, phi, 1)
To help get a feel for using FairRankTune we have created a self-contained notebook that includes the FairRankTune source code and metrics. To interact with FairRankTune please see FairRankTunePlayground.ipynb.
FairRankTune Source
All source code for FairRankTune can be found in the FAIRRANKTUNE directory. Each of the three components of the toolkit have their own sub-package/directory described below.
RankTune
The RankTune source code is the RankTune directory and correpsonding src.py script.
Metrics
All metrics are in the Metrics directory. Each metric has a corresponding python script.
Functions to combine per-group metrics into a single metric are in the ComboUtil.py script.
Rankers
All fair ranking methods are in the Rankers directory. Each method has a corresponding python script.
- DetConSort [5]
- Epsilon-Greedy [6]
Functions to combine per-group metrics into a single metric are in the ComboUtil.py script.
Reproducing Demonstration, Case Study, and Comparisons
The scripts to reproduce empirical analysis in the paper can be found in the Analysis directory along with the raw csv files containing the results.
Law Demonstration: the law directory contains the law student data, scripts to run the experiment, result csv, and R script to generate the plots from the paper.
Comparison of RankTune to available methods: the comparison directory contains scripts for the compared methods (including the binary ranked data generation method URG [7], and the result csvs of running the data generation methods.
Case Study: the case_study directory contains scripts and results from generating data and analyzing metrics on the nine distributions from the paper
Timing: the timing directory contains the scripts and results from analyszing the runtime of RankTune.
Generating plots from the paper
The scripts to generate the plots from the case study and comparison with URG are included in the plotting.R file. This script saves off figures to the 'plots' folder in the main directory.
References
[1] Cachel, K., Rundensteiner, E., & Harrison, L. (2022, May). Mani-rank: Multiple attribute and intersectional group fairness for consensus ranking. In 2022 IEEE 38th International Conference on Data Engineering (ICDE) (pp. 1124-1137). IEEE.
@article{Cachel2022MANIRankMA,
title={MANI-Rank: Multiple Attribute and Intersectional Group Fairness for Consensus Ranking},
author={Kathleen Cachel and Elke A. Rundensteiner and Lane Harrison},
journal={2022 IEEE 38th International Conference on Data Engineering (ICDE)},
year={2022},
pages={1124-1137}
}
[2] Sapiezynski, P., Zeng, W., E Robertson, R., Mislove, A., & Wilson, C. (2019, May). Quantifying the impact of user attentionon fair group representation in ranked lists. In Companion proceedings of the 2019 world wide web conference (pp. 553-562).
@article{Sapiezynski2019QuantifyingTI,
title={Quantifying the Impact of User Attentionon Fair Group Representation in Ranked Lists},
author={Piotr Sapiezynski and Wesley Zeng and Ronald E. Robertson and Alan Mislove and Christo Wilson},
journal={Companion Proceedings of The 2019 World Wide Web Conference},
year={2019}
}
[3] Diaz, F., Mitra, B., Ekstrand, M. D., Biega, A. J., & Carterette, B. (2020, October). Evaluating stochastic rankings with expected exposure. In Proceedings of the 29th ACM international conference on information & knowledge management (pp. 275-284).
@article{Diaz2020EvaluatingSR,
title={Evaluating Stochastic Rankings with Expected Exposure},
author={Fernando Diaz and Bhaskar Mitra and Michael D. Ekstrand and Asia J. Biega and Ben Carterette},
journal={Proceedings of the 29th ACM International Conference on Information \& Knowledge Management},
year={2020}
}
[4] Singh, A., & Joachims, T. (2018, July). Fairness of exposure in rankings. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (pp. 2219-2228).
@article{Singh2018FairnessOE,
title={Fairness of Exposure in Rankings},
author={Ashudeep Singh and Thorsten Joachims},
journal={Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery \& Data Mining},
year={2018}
}
[5] Geyik, S. C., Ambler, S., & Kenthapadi, K. (2019, July). Fairness-aware ranking in search & recommendation systems with application to linkedin talent search. In Proceedings of the 25th acm sigkdd international conference on knowledge discovery & data mining (pp. 2221-2231).
@article{Geyik2019FairnessAwareRI,
title={Fairness-Aware Ranking in Search \& Recommendation Systems with Application to LinkedIn Talent Search},
author={Sahin Cem Geyik and Stuart Ambler and Krishnaram Kenthapadi},
journal={Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery \& Data Mining},
year={2019}
}
[6] Feng, Y., & Shah, C. (2022). Has CEO Gender Bias Really Been Fixed? Adversarial Attacking and Improving Gender Fairness in Image Search. AAAI Conference on Artificial Intelligence.
@inproceedings{Feng2022HasCG,
title={Has CEO Gender Bias Really Been Fixed? Adversarial Attacking and Improving Gender Fairness in Image Search},
author={Yunhe Feng and C. Shah},
booktitle={AAAI Conference on Artificial Intelligence},
year={2022}
}
[7] Yang, K., & Stoyanovich, J. (2017, June). Measuring fairness in ranked outputs. In Proceedings of the 29th international conference on scientific and statistical database management (pp. 1-6).
@article{Yang2016MeasuringFI,
title={Measuring Fairness in Ranked Outputs},
author={Ke Yang and Julia Stoyanovich},
journal={Proceedings of the 29th International Conference on Scientific and Statistical Database Management},
year={2016}
}
[8] Kirnap, Ö., Diaz, F., Biega, A.J., Ekstrand, M.D., Carterette, B., & Yilmaz, E. (2021). Estimation of Fair Ranking Metrics with Incomplete Judgments. Proceedings of the Web Conference 2021.
@article{Kirnap2021EstimationOF,
title={Estimation of Fair Ranking Metrics with Incomplete Judgments},
author={{\"O}mer Kirnap and Fernando Diaz and Asia J. Biega and Michael D. Ekstrand and Ben Carterette and Emine Yilmaz},
journal={Proceedings of the Web Conference 2021},
year={2021}
}
[9] Biega, A.J., Gummadi, K.P., & Weikum, G. (2018). Equity of Attention: Amortizing Individual Fairness in Rankings. The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval.
@article{Biega2018EquityOA,
title={Equity of Attention: Amortizing Individual Fairness in Rankings},
author={Asia J. Biega and Krishna P. Gummadi and Gerhard Weikum},
journal={The 41st International ACM SIGIR Conference on Research \& Development in Information Retrieval},
year={2018}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fairranktune-0.0.1.tar.gz.
File metadata
- Download URL: fairranktune-0.0.1.tar.gz
- Upload date:
- Size: 178.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
538a58733e1a88ee0646a5c698815bdbaff7f658bd5abcca4ea6718eab7cde90
|
|
| MD5 |
0db01bf04e59e66ed3ff724ec0708e6c
|
|
| BLAKE2b-256 |
69764ff5e237906441759e86daaf2aa82b31fafe87f674e77ef77ca18f17877f
|
File details
Details for the file fairranktune-0.0.1-py3-none-any.whl.
File metadata
- Download URL: fairranktune-0.0.1-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89259fdd9c617a076037129a477fd3df3b58ff0c703414012f1a5b0ebcc5adcf
|
|
| MD5 |
db54c0537bddfc823c2cd1756f9fe7e3
|
|
| BLAKE2b-256 |
4fd46fbe72923445bdced8ceacd6aec9920db12188ef02b4515d36275cebb5e0
|