A library for counterfactual recourse
Project description
CARLA - Counterfactual And Recourse Library
CARLA is a python library to benchmark counterfactual explanation and recourse models. It comes out-of-the box with commonly used datasets and various machine learning models. Designed with extensibility in mind: Easily include your own counterfactual methods, new machine learning models or other datasets.
Find extensive documentation here! Our arXiv paper can be found here.
Available Datasets
Implemented Counterfactual Methods
- Actionable Recourse (AR): Paper
- CCHVAE: Paper
- Contrastive Explanations Method (CEM): Paper
- Counterfactual Latent Uncertainty Explanations (CLUE): Paper
- CRUDS: Paper
- Diverse Counterfactual Explanations (DiCE): Paper
- Feasible and Actionable Counterfactual Explanations (FACE): Paper
- Growing Sphere (GS): Paper
- Revise: Paper
- Wachter: Paper
Provided Machine Learning Models
- ANN: Artificial Neural Network with 2 hidden layers and ReLU activation function
- LR: Linear Model with no hidden layer and no activation function
Which Recourse Methods work with which ML framework?
The framework a counterfactual method currently works with is dependent on its underlying implementation. It is planned to make all recourse methods available for all ML frameworks . The latest state can be found here:
| Recourse Method | Tensorflow | Pytorch |
|---|---|---|
| Actionable Recourse | X | X |
| CCHVAE | X | |
| CEM | X | |
| CLUE | X | |
| CRUDS | X | |
| DiCE | X | X |
| FACE | X | X |
| Growing Spheres | X | X |
| Revise | X | |
| Wachter | X |
Installation
Requirements
python3.7pip
Install via pip
pip install git+https://github.com/indyfree/carla.git#egg=carla
Contributing
Requirements
python3.7-venv(when not already shipped with python3.7)- Recommended: GNU Make
Installation
Using make:
make requirements
Using python directly or within activated virtual environment:
pip install -U pip setuptools wheel
pip install -e .
Testing
Using make:
make test
Using python directly or within activated virtual environment:
pip install -r requirements-dev.txt
python -m pytest test/*
Linting and Styling
We use pre-commit hooks within our build pipelines to enforce:
Install pre-commit with:
make install-dev
Using python directly or within activated virtual environment:
pip install -r requirements-dev.txt
pre-commit install
Licence
carla is under the MIT Licence. See the LICENCE for more details.
Citation
This project was recently accepted to NeurIPS 2021 (Benchmark & Data Sets Track). If you use this codebase, please cite:
@misc{pawelczyk2021carla,
title={CARLA: A Python Library to Benchmark Algorithmic Recourse and Counterfactual Explanation Algorithms},
author={Martin Pawelczyk and Sascha Bielawski and Johannes van den Heuvel and Tobias Richter and Gjergji Kasneci},
year={2021},
eprint={2108.00783},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file carla-recourse-0.0.4.tar.gz.
File metadata
- Download URL: carla-recourse-0.0.4.tar.gz
- Upload date:
- Size: 70.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
592861ffead96eb41680a54ddcb5e8fd9fb96e809cd1c7d67cf74b4170e4b985
|
|
| MD5 |
67f82f1f879e46602e36332ac22d415e
|
|
| BLAKE2b-256 |
689d4020680831159c3512348ba83695b7012f032bf2dde1eec1cf957bcb261e
|
File details
Details for the file carla_recourse-0.0.4-py3-none-any.whl.
File metadata
- Download URL: carla_recourse-0.0.4-py3-none-any.whl
- Upload date:
- Size: 97.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc74171294de8bf01e903461fc4d2cb681f0b1b805e87e94a48ad0ab62d6968f
|
|
| MD5 |
d5acbed802418e5ba0389f77e53cf284
|
|
| BLAKE2b-256 |
50a77d6caeeb7ebbd9d840569bb2a8437a30344f4f7e6198990f0305e84b123d
|