This repository contains the code, data, and supplementary material for the experiments included in the paper:
Lemberger, P., & Saillenfest, A. (2024). Explaining Text Classifiers with Counterfactual Representations. In Proceedings of ECAI 2024 - 27th European Conference on Artificial Intelligence, pp. 890-897.
Create and start a new virtual environment:
conda create -n CFR python=3.10.9 anaconda
conda activate CFR
Download and pre-process the data before running the experiments.
- EEEC+: data and pre-processing in "./datasets/EEEC/EEEC_3race"
- BiasInBios: data and pre-processing in "./datasets/biasbios"
- CEBaB:
- data: https://cebabing.github.io/CEBaB/
- pre-processing in "./datasets/CEBaB-v1.1"
- GloVe :
- data:
- https://nlp.biu.ac.il/~ravfogs/rlace/glove/glove-gender-data.pickle (GloVe embeddings with gender-bias labels)
- https://nlp.biu.ac.il/~ravfogs/rlace/glove/glove-top-50k.pickle (150k GloVe embeddings)
- data:
Run the notebooks:
CFRs_EEECp_gender_balanced.ipynb
CFRs_EEECp_gender_aggressive.ipynb
CFRs_EEECp_race_balanced.ipynb
CFRs_EEECp_race_aggressive.ipynb
Run the notebook:
CFRs_biasbios.ipynb
Run:
CFRs_CEBaB_compare_methods.ipynb
Run the notebook:
CFRs_GloVe.ipynb