VCNet: Variational Counter Net
This repository is contains an implementation of VCNet, a counterfactual generator for tabular datasets. Counterfactual generation is an explainable artificial intelligence technique that helps users understand the decisions of predictive models.
VCNet handles both categorical and numerical variables and can also manage immutable variables (i.e., variables that cannot be changed while generating counterfactuals). Currently, it is implemented for binary classification only. VCNet is based on conditional variational encoders. Compared to its competitors (see for instance jax-relax), VCNet offers an easy and fast training architecture that generates realistic counterfactuals (i.e., counterfactuals that likely exist in the data distribution).
This library provides two versions of VCNet:
Joint-learning architecture: This version includes both the classification model and the counterfactual generator.
Post-hoc architecture: This version includes only the counterfactual generator, which can be fitted on any prediction model (Torch module).
Once the VCNet model is fitted, it can be used to generate efficiently valid counterfactuals of examples.
How to install
The pyproject.toml
is the project configuration file which enables to create and set up a virtual environment suitable to run VCNet
.
Download the code from gitlab
git clone https://gitlab.inria.fr/tguyet/vcnet.git
cf vcnet
Install the dependencies
pip install -r requirements.txt
or, to install the package:
pip install -e .
Test VCNet on Adult dataset
python tests/test_data.py
For more details, look at the documentation pages.
How to cite
@inproceedings{guyomard2022vcnet,
title={VCNet: A self-explaining model for realistic counterfactual generation},
author={Guyomard, Victor and Fessant, Fran{\c{c}}oise and Guyet, Thomas and Bouadi, Tassadit and Termier, Alexandre},
booktitle={Joint European Conference on Machine Learning and Knowledge Discovery in Databases},
pages={437--453},
year={2022},
organization={Springer}
}