VCNet Documentation

VCNet, is a collection of counterfactual generators 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. This version requires to have a classifier that is a Torch module.

  • Post-hoc architecture: This version includes only the counterfactual generator, which can be fitted on any prediction model. The prediction model can be a Deep Learning model or a swallow learning (including non-differentiable classifiers such as random forests).

Once the VCNet model is fitted, it can be used to generate efficiently valid counterfactuals of examples. To ease the use of VCNet on tabular datasets, we provide facilities to interact with pandas dataframes.

VCNet implementation is based on Lightning. It defines:

  • A dataset class named DataCatalog which handes the setting of the dataset, including some information about the characteristics of the features (immutable, categorial).

  • VCNet and PHVCNet modules which implement respectively the trainable joint VCNet and post-hoc VCNet models. In the first case, training the model means to train jointly a classifier and a counterfactual generator. In the second case, it trains only the generator (from a trained classifier).

The instance of DataCatalog and class models are parameterized by a dictionnary which contains all the hyperparameters. This implementation is compatible with the hyper-parameters optimizers such as Hydronaut.

We invite the reader to see the examples to see how using these models on your own data.

Citation

If you use this software, please cite our work:

@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}
}

Indices and tables