The code mainly builds on the official pytorch implementation of Bias Mimicking: A simple sampling approach for Bias Mitigation with some small changes. Our changes include two aspects. First, we add anchor sampling module in the bias-contrastive learning framework. Second, we test the algorithmic fairness influence of different data augmentation methods in the bias-contrastive learning framework.
conda create -n xx python=3.8
conda activate xx
- pytorch=1.10.1
- scipy
- tqdm
- scikit-learn
-
CelebA
Download CelebA dataset underdata/celeba
-
UTKFace
Download UTKFace dataset underdata/utk_face
-
CIFAR10
Download CIFAR10 dataset underdata/cifar10
From the main directory, run:
python train_[DATASET]/train_[DATASET]_[METHOD].py --exp_name [EXP_NAME] --task [TASK] --seed [SEED]
where mode refers to whether the distribution is left as is/undersampled/upweighted/oversampled when training the predictive linear layer.
[1] Qraitem M, Saenko K, Plummer B A. Bias Mimicking: A Simple Sampling Approach for Bias Mitigation[J]. arXiv preprint arXiv:2209.15605, 2022.[paper][code]
[2] Hong Y, Yang E. Unbiased classification through bias-contrastive and bias-balanced learning[J]. Advances in Neural Information Processing Systems, 2021, 34: 26449-26461.[paper][code]