# L-GMVAE and LAPACE

This is the accompanying code for the paper: Synthesising Counterfactual Explanations via Label-Conditional Gaussian Mixture Variational Autoencoders.

This code should work on any modern Python versions (3.7 onwards). The packages are also quite standard: sklearn, numpy, scipy, pandas, torch, etc. Some specific sources needed:
- DRL for parsing constraints: https://github.com/mihaela-stoian/DRL_DGM/tree/main/DRL
- CARLA for baseline implementations: https://github.com/carla-recourse/CARLA
- DiCE for baseline implementations: https://github.com/interpretml/DiCE/tree/main

Tensorflow is not needed for this code, so if there are errors saying that they are required by CARLA or DiCE, the relevant codes can be commented out.

The datasets are in /data.

run.py runs the CE generation pipelines, it assumes the L-GMVAEs have been trained. A training script is included. After training, L-GMVAE configs can be saved to the .json file.

After run.py, execute visualisation.ipynb to visualise results.