Generic explainability architecture for text machine learning models
Project description
A generic explainability architecture for explaining text machine learning models.
Marcel Robeer, 2021
Installation
Method | Instructions |
---|---|
pip |
Install from PyPI via pip3 install text_explainability . |
Local | Clone this repository and install via pip3 install -e . or locally run python3 setup.py install . |
Example usage
See example_usage.md to see an example of how the package can be used, or run the lines in example_usage.py
to do explore it interactively.
Explanation methods included
text_explainability
includes methods for model-agnostic local explanation and global explanation. Each of these methods can be fully customized to fit the explainees' needs.
Type | Explanation method | Description | Paper/link |
---|---|---|---|
Local explanation | LIME |
Calculate feature attribution with Local Intepretable Model-Agnostic Explanations (LIME). | [Ribeiro2016], interpretable-ml/lime |
KernelSHAP |
Calculate feature attribution with Shapley Additive Explanations (SHAP). | [Lundberg2017], interpretable-ml/shap | |
LocalTree |
Fit a local decision tree around a single decision. | [Guidotti2018] | |
FoilTree |
Fit a local contrastive/counterfactual decision tree around a single decision. | [Robeer2018] | |
Global explanation | TokenFrequency |
Show the top-k number of tokens for each ground-truth or predicted label. | |
TokenInformation |
Show the top-k token mutual information for a dataset or model. | wikipedia/mutual_information | |
KMedoids |
Embed instances and find top-n prototypes (can also be performed for each label using LabelwiseKMedoids ). |
interpretable-ml/prototypes | |
MMDCritic |
Embed instances and find top-n prototypes and top-n criticisms (can also be performed for each label using LabelwiseMMDCritic ). |
[Kim2016], interpretable-ml/prototypes |
Releases
text_explainability
is officially released through PyPI.
See CHANGELOG.md for a full overview of the changes for each version.
Maintenance
Contributors
- Marcel Robeer (
@m.j.robeer
) - Michiel Bron (
@mpbron-phd
)
Todo
Tasks yet to be done:
- Implement local post-hoc explanations:
- Implement Anchors
- Implement global post-hoc explanations:
- Representative subset
- Add support for regression models
- More complex data augmentation
- Top-k replacement (e.g. according to LM / WordNet)
- Tokens to exclude from being changed
- Bag-of-words style replacements
- Add rule-based return type
- Write more tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for text_explainability-0.4.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 813c73d29f51df4dc781280716a8c8a29e556f1836829c7fadc40d5defa580bf |
|
MD5 | 2b736ccd775cd28f4d559a0969e52e54 |
|
BLAKE2b-256 | 45a80a0460a2cad69c073818db9cc2706733fc9892693b3bc462b9f1efff27ed |
Hashes for text_explainability-0.4.2-py3.9.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04b13b895c04708fc5b1bfc5e7e3e65e64e70e6c8b0d8cfe306d04bae101e97a |
|
MD5 | 6b231b1c05fb9f40a34a7f797e18f696 |
|
BLAKE2b-256 | 856d4b92ff95a4bc4fb0b951dc7b70f4963e56e62f49c19e5dd98d63ebc3ad2b |
Hashes for text_explainability-0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65982fe1e71db263b11ee9920388aa6181eefd3103b27e9780d647310549a49e |
|
MD5 | 881c2f73ccc730a7714a945293897b33 |
|
BLAKE2b-256 | 56c01725171d8949dc3b9f0307f930ae57877aa53d5cfd400e2d6d50854e47a7 |