PyExplainer

PyExplainer is a local rule-based model-agnostic technique for generating explanations (i.e., why a commit is predicted as defective) of Just-In-Time (JIT) defect prediction defect models.

Through a case study of two open-source software projects, we find that our PyExplainer produces (1) synthetic neighbous that are 41%-45% more similar to an instance to be explained; (2) 18%-38% more accurate local models; and (3) explanations that are 69%-98% more unique and 17%-54% more consistent with the actual characteristics of defect-introducing commits in the future than LIME (a state-of-the-art model-agnostic technique).

This work is published at the International Conference on Automated Software Engineering 2021 (ASE2021): "PyExplainer: Explaining the Predictions ofJust-In-Time Defect Models". Preprint

@inproceedings{PyExplainer,
 author = {Pornprasit, Chanathip and Tantithamthavorn, Chakkrit and Jiarpakdee, Jirayus and Fu, Micheal and Thongtanunam, Patanamon}, 
 title = {PyExplainer: Explaining the Predictions ofJust-In-Time Defect Models},
 booktitle = {Proceedings of th International Conference on Automated Software Engineering (ASE)},
 year = {2021},
 numpages = {12},
}

pyexplainer_snap_demo

Quick Start

You can try our PyExplainer directly without installation at this online JupyterNotebook (just open and run TUTORIAL.ipynb). The tutorial video below demonstrates how to use our PyExplainer in this JupyterNotebook.

In the JupyterNotebook:

  • Run cells from step 1 to step 3 to create an interactive visualization in jupyter notebook cell (like the example above). You can change the input feature values of ML model at slide bar.
  • Run the cells in appendix section if you would like to get more detail about variable used to build PyExplainer

Tutorial

See the instructions below how to install our PyExplainer Python Package.

Installation

Dependencies

- python = "3.8"
- scikit-learn = "0.24.1"
- numpy = "1.20.1"
- scipy = "1.6.1"
- ipywidgets = "7.6.3"
- ipython = "7.21.0"
- pandas = "1.2.5"
- statsmodels = "0.12.2"

Install PyExplainer Python Package

Installing pyexplainer is easily done using pip, simply run the following command. This will also install the necessary dependencies.

pip install pyexplainer

See this PyExplainer python package documentation for how to install our PyExplainer from source and its dependencies.



If you are with conda, run the command below in your conda environment

conda install -c conda-forge pyexplainer

Contributions

We welcome and recognize all contributions. You can see a list of current contributors in the contributors tab.

Please click here for more information about making a contribution to this project.

Documentation

The official documentation is hosted on Read the Docs

GitHub

https://github.com/awsm-research/PyExplainer