AIX360
Interpretability and explainability of data and machine learning models
Install / Use
/learn @Trusted-AI/AIX360README
AI Explainability 360 (v0.3.0)
The AI Explainability 360 toolkit is an open-source library that supports interpretability and explainability of datasets and machine learning models. The AI Explainability 360 Python package includes a comprehensive set of algorithms that cover different dimensions of explanations along with proxy explainability metrics. The AI Explainability 360 toolkit supports tabular, text, images, and time series data.
The AI Explainability 360 interactive experience provides a gentle introduction to the concepts and capabilities by walking through an example use case for different consumer personas. The tutorials and example notebooks offer a deeper, data scientist-oriented introduction. The complete API is also available.
There is no single approach to explainability that works best. There are many ways to explain: data vs. model, directly interpretable vs. post hoc explanation, local vs. global, etc. It may therefore be confusing to figure out which algorithms are most appropriate for a given use case. To help, we have created some guidance material and a taxonomy tree that can be consulted.
We have developed the package with extensibility in mind. This library is still in development. We encourage you to contribute your explainability algorithms, metrics, and use cases. To get started as a contributor, please join the AI Explainability 360 Community on Slack by requesting an invitation here. Please review the instructions to contribute code and python notebooks here.
Supported explainability algorithms
Data explanations
- ProtoDash (Gurumoorthy et al., 2019)
- Disentangled Inferred Prior VAE (Kumar et al., 2018)
Local post-hoc explanations
- ProtoDash (Gurumoorthy et al., 2019)
- Contrastive Explanations Method (Dhurandhar et al., 2018)
- Contrastive Explanations Method with Monotonic Attribute Functions (Luss et al., 2019)
- Exemplar based Contrastive Explanations Method
- Grouped Conditional Expectation (Adaptation of Individual Conditional Expectation Plots by Goldstein et al. to higher dimension )
- LIME (Ribeiro et al. 2016, Github)
- SHAP (Lundberg, et al. 2017, Github)
Time-Series local post-hoc explanations
- Time Series Saliency Maps using Integrated Gradients (Inspired by Sundararajan et al. )
- Time Series LIME (Time series adaptation of the classic paper by Ribeiro et al. 2016 )
- Time Series Individual Conditional Expectation (Time series adaptation of Individual Conditional Expectation Plots Goldstein et al. )
Local direct explanations
- Teaching AI to Explain its Decisions (Hind et al., 2019)
- Order Constraints in Optimal Transport (Lim et al.,2022, Github)
Certifying local explanations
- Trust Regions for Explanations via Black-Box Probabilistic Certification (Ecertify) (Dhurandhar et al., 2024)
Global direct explanations
- Interpretable Model Differencing (IMD) (Haldar et al., 2023)
- CoFrNets (Continued Fraction Nets) (Puri et al., 2021)
- Boolean Decision Rules via Column Generation (Light Edition) (Dash et al., 2018)
- Generalized Linear Rule Models (Wei et al., 2019)
- Fast Effective Rule Induction (Ripper) (William W Cohen, 1995)
Global post-hoc explanations
- ProfWeight (Dhurandhar et al., 2018)
Supported explainability metrics
- Faithfulness (Alvarez-Melis and Jaakkola, 2018)
- Monotonicity (Luss et al., 2019)
Setup
Supported Configurations:
| Installation keyword | Explainer(s) | OS | Python version | | ---------------|---------------| ------------------------------| -------------- | | cofrnet |cofrnet | macOS, Ubuntu, Windows | 3.10 | | contrastive |cem, cem_maf | macOS, Ubuntu, Windows | 3.6 | | dipvae | dipvae| macOS, Ubuntu, Windows | 3.10 | | gce | gce | macOS, Ubuntu, Windows | 3.10 | | ecertify | ecertify | macOS, Ubuntu, Windows | 3.10 | | imd | imd | macOS, Ubuntu | 3.10 | | lime | lime| macOS, Ubuntu, Windows | 3.10 | | matching | matching| macOS, Ubuntu, Windows | 3.10 | | nncontrastive | nncontrastive | macOS, Ubuntu, Windows | 3.10 | | profwt | profwt | macOS, Ubuntu, Windows | 3.6 | | protodash | protodash | macOS, Ubuntu, Windows | 3.10 | | rbm | brcg, glrm | macOS, Ubuntu, Windows | 3.10 | | rule_induction | ripper | macOS, Ubuntu, Windows | 3.10 | | shap | shap | macOS, Ubuntu, Windows | 3.6 | | ted | ted | macOS, Ubuntu, Windows | 3.10 | | tsice | tsice | macOS, Ubuntu, Windows | 3.10 | | tslime | tslime | macOS, Ubuntu, Windows | 3.10 | | tssaliency | tssaliency | macOS, Ubuntu, Windows | 3.10 |
(Optional) Create a virtual environment
AI Explainability 360 requires specific versions of many Python packages which may conflict with other projects on your system. A virtual environment manager is strongly recommended to ensure dependencies may be installed safely. If you have trouble installing the toolkit, try this first.
Conda
Conda is recommended for all configurations though Virtualenv is generally interchangeable for our purposes. Miniconda is sufficient (see the difference between Anaconda and Miniconda if you are curious) and can be installed from here if you do not already have it.
Then, create a new python environment based on the explainability algorithms you wish to use by referring to the table above. For example, for python 3.10, use the following command:
conda create --name aix360 python=3.10
conda activate aix360
The shell should now look like (aix360) $. To deactivate the environment, run:
(aix360)$ conda deactivate
The prompt will return back to $ or (base)$.
Note: Older versions of conda may use source activate aix360 and source deactivate (activate aix360 and deactivate on Windows).
Installation
Clone the latest version of this repository:
(aix360)$ git clone https://github.com/Trusted-AI/AIX360
If you'd like to run the examples and tutorial notebooks, download the datasets now and place them in their respective folders as described in aix360/data/README.md.
Then, navigate to the root directory of the project which contains setup.py file and run:
(aix360)$ pip install -e .[<algo1>,<algo2>, ...]
The above command installs packages required by specific algorithms. Here <algo> refers to the installation keyword in table above. For instance to install packages needed by BRCG, DIPVAE, and TSICE algorithms, one could use
(aix360)$ pip install -e .[rbm,dipvae,tsice]
The default command pip install . installs default dependencies alone.
Note that you may not be able to install two algorithms that require different versions of python in the same environment (for instance contrastive along with rbm).
If you face any issues, please try upgrading pip and setuptools and uninstall any previous versions of aix360 before attempting the above step again.
(aix360)$ pip install --upgrade pip setuptools
(aix360)$ pip uninstall aix360
PIP Installation of AI Explainability 360
If you would like to quickly start using the AI explainability 360 toolkit without explicitly cloning this repository, you can use one of these options:
- Install v0.3.0 via repository link
(your environment)$ pip install -
