Giter Site home page Giter Site logo

networks-learning / counterfactual-explanations-mdp Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 3.0 123 KB

Code for "Counterfactual Explanations in Sequential Decision Making Under Uncertainty", NeurIPS 2021

Jupyter Notebook 73.65% Shell 1.72% Python 24.64%
machine-learning counterfactual-explanations counterfactuals mdp markov-deci cognitive-therapy sequential-decision-making-problems explainable-ai explainable-ml

counterfactual-explanations-mdp's Introduction

Counterfactual Explanations in Sequential Decision Making Under Uncertainty

This repository contains the code used in the paper Counterfactual Explanations in Sequential Decision Making Under Uncertainty, published at NeurIPS 2021.

Dependencies

All the experiments were performed using Python 3.9. In order to create a virtual environment and install the project dependencies you can run the following commands:

python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

Code organization

The directory src contains the source code for the various experiments. The following table contains a short description for each python file:

src/ Description
synth_mdp.py Defines a Synth_MDP object which handles the generation of synthetic decision making realizations and their counterfactual explanations.
synth_compute_cf_mdps.py Generates synthetic decision making realizations, pre-computes the counterfactual transition probabilties for each one of them and saves them as .pkl files.
synth_experiment.py Generates optimal counterfactual explanations for each synthetic decision making realization, for various values of the parameter k.
therapy_mdp.py Defines a Therapy_MDP object which handles the input of the cognitive behavioral therapy data and the generation of counterfactual explanations for each patient.
therapy_compute_cf_mdps.py Pre-computes the counterfactual transition probabilties for all patients' realizations and saves them as .pkl files.
therapy_experiment.py Generates optimal counterfactual explanations for each patient's realization, for various values of the parameter k.
therapy_evaluation.py Generates counterfactual explanations for each patient's realization, using our method and various baselines.

The directory scripts contains bash scripts that use the aforementioned code and pass parameter values required for the various experiments.

The directory notebooks contains jupyter notebooks producing the figures appearing in the paper. Each notebook has script execution prerequisites specified therein.

The directory figures is used for saving the figures produced by the notebooks.

The directory outputs is used for saving the json outputs produced by the scripts. The sub-directory cf_mdps is used for saving intermediate .pkl files containing the counterfactual transition probabilities for each single realization.

Citation

If you use parts of the code in this repository for your own research, please consider citing:

@inproceedings{tsirtsis2021counterfactual,
    title={Counterfactual Explanations in Sequential Decision Making Under Uncertainty},
    author={Tsirtsis, Stratis and De, Abir and Gomez-Rodriguez, Manuel},
    booktitle={Advances in Neural Information Processing Systems},
    year={2021}
}

counterfactual-explanations-mdp's People

Contributors

dependabot[bot] avatar manuelgr avatar stsirtsis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.