This repository contains the implementation source code of the following paper:
CARE: Coherent Actionable Recourse based on Sound Counterfactual Explanations
BibTeX:
@article{rasouli2022care,
title={CARE: Coherent Actionable Recourse based on Sound Counterfactual Explanations},
author={Rasouli, Peyman and Chieh Yu, Ingrid},
journal={International Journal of Data Science and Analytics},
pages={1--26},
year={2022},
publisher={Springer}
}
1- Clone the repository using HTTP/SSH:
git clone https://github.com/peymanrasouli/CARE
2- Install the following package containing GCC/g++ compilers and libraries:
sudo apt-get install build-essential
3- Create a conda virtual environment:
conda create -n CARE python=3.7
4- Activate the conda environment:
conda activate CARE
5- Standing in CARE directory, install the requirements:
pip install -r requirements.txt
1- To explain a particular instance using CARE, run:
python main.py
2- To explain a particular instance using CARE, CFPrototype, DiCE, and CERTIFAI simultaneously, run:
python care_cfprototype_dice_certifai.py
An actionable recourse generated by CARE for an instance from Adult data set:
Features | Original Instance | Actionable Recourse |
---|---|---|
age | 25 | 30 |
capital-gain | 0 | _ |
capital-loss | 0 | _ |
hours-per-week | 40 | 45 |
work-class | Private | _ |
education | Bachelors | Masters |
marital-status | Not-in-family | _ |
occupation | Sales | Prof-specialty |
relationship | Never-married | _ |
race | White | _ |
sex | Female | _ |
native-country | United-States | _ |
Class | <=50K | >50K |
IF 'age was 30' AND 'hours-per-week was 45' AND 'education was Masters' AND 'occupation was Prof-specialty',
THE PERSON WOULD BE CLASSIFIED AS '>50K income' RATHER THAN '<=50K income'.
1- To reproduce the results of performance validation of CARE's modules, run:
python care_module_performance.py
2- To reproduce the results of soundness validation, run:
python care_soundness.py
3- To reproduce the results of coherency validation, run:
python care_coherency.py
4- To reproduce the validation results of temporal action sequence, run:
python care_temporal_action_sequence.py
1- To reproduce the results of CARE{VALIDITY} config vs. baselines, run:
python benchmark_validity.py
2- To reproduce the results of CARE{VALIDITY, SOUNDNESS} config vs. baselines, run:
python benchmark_validity_soundness.py
3- To reproduce the results of CARE{VALIDITY, SOUNDNESS, COHERENCY} config vs. baselines, run:
python benchmark_validity_soundness_coherency.py
4- To reproduce the results of CARE{VALIDITY, SOUNDNESS, COHERENCY, ACTIONABILITY} config vs. baselines, run:
python benchmark_validity_soundness_coherency_actionability.py