This repository consists of code and datasets for our paper. We extend the code of FA*IR and implement the DP algorithm in Celis et al. - Ranking with Fairness Constraints, to compare our work with these algorithms as baselines.
python
, numpy
, matplotlib
The root directory contains the following bash-script for re-ranking with ALG and also the baselines FA*IR (FAIR) and Celis et al (CELIS).
postprocess.sh
python3 main.py --postprocess <dataset> <method> --k <top k ranks> --rev_flag <True/False> --multi_group <True/False>
re-ranks the true ranking based on the method (ALG/FAIR/CELIS) and writes the re-ranked data in the folder data/<dataset>/..._<experiment>.txt
. If rev_flag
is set the true ranking is reversed first and then postprocessing is applied. The flag multi_group
is set for the experiments on the German Credit dataset with more than 2 groups.
Uncomment the experiment required and use ./postprocess.sh
The following bash-script evaluates results on all the datasets.
evaluateResults.sh
- Top k evaluation,
python3 main.py --evaluate <dataset_protectedgroup> --topk <top k ranks> --rev_flag <True/False>
evaluates the algorithms for the top k ranks, where k is given as input argumenttopk
. The usage ofref_flag
is same as above. - Evaluation for k consecutive ranks
python3 main.py --evaluate german_age25 --consecutive 40 --start 21 --rev_flag <True/False>
evaluates the algorithms for consecutive ranks (use the argumentconsecutive
to choose how many consecutive ranks to evaluate for), starting from rank given asstart
. The usage ofref_flag
is same as above.