zhuoyafan / Algorithmic-Fairness-Improvement-of-Bias-Contrastive-Learning

Algorithmic Fairness Improvement of Bias-Contrastive Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Algorithmic Fairness Improvement of Bias-Contrastive Learning

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.

Setup

Set up conda environment

conda create -n xx python=3.8
conda activate xx

Install packages

  • pytorch=1.10.1
  • scipy
  • tqdm
  • scikit-learn

Prepare dataset.

  • CelebA
    Download CelebA dataset under data/celeba

  • UTKFace
    Download UTKFace dataset under data/utk_face

  • CIFAR10
    Download CIFAR10 dataset under data/cifar10

Train.

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.

Reference

[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]

About

Algorithmic Fairness Improvement of Bias-Contrastive Learning


Languages

Language:Python 99.3%Language:Roff 0.7%