BeMap is a fair message passing method for solving the unfairness problem on graph machine learning. It is a model-agnostic easy-to-implement solution that is able to effectively mitigate structural bias for most typical GNNs, such as GCN and GAT.
If you find this repository helpful in your work or research, we would greatly appreciate citations to the following paper:
@inproceedings{lin2023bemap,
title={BeMap: Balanced Message Passing for Fair Graph Neural Network},
author={Lin, Xiao and Kang, Jian and Cong, Weilin and Tong, Hanghang},
booktitle={The Second Learning on Graphs Conference},
year={2023}
}
We introduce a novel fair message passing method named BeMap. It creates a fair graph structure for each epoch by leveraging a balance-aware sampling strategy to balance the number of the 1-hop neighbors of each node among different demographic groups. The intuition of mitigating structural bias is to push the bias residual for all the nodes to converge at the same fair centroid. The figure below gives an overview of BeMap.
Main dependencies:
- Python (= 3.9)
- Pytorch (= 2.1.0)
- dgl (= 2.1.0)
- Pandas (= 2.2.1)
- Numpy (= 1.26.4)
- scikit-learn (= 1.4.1)
To install requirements, run:
pip install -r requirements.txt
- Pokec_z is stored in dataset/pokec as region_job.xxx, introduced by Enyan Dai et al.
- NBA is stored in dataset/NBA as nba.xxx, introduced by Enyan Dai et al..
- Recidivism is stored in dataset/bail, introduced by Chirag Agarwa et al..
- Credit is stored in dataset/credit_compressed, introduced by Chirag Agarwa et al..
- We can extract credit.zip using the following command:
unzip -d ./dataset ./dataset/credit_compressed/credit.zip
- We can extract credit.zip using the following command:
We can run BeMap by the following command:
python train_bemap.py --dataset dataset_name --model model_name
For example, if we want to run BeMap on NBA dataset with GCN, we can excute the following command:
python train_bemap.py --dataset nba --model gcn
If you have any questions or want to use the code, feel free to contact:
- Xiao Lin (xiaol13@illinois.edu)