Generic explainability architecture for text machine learning models
Project description
A generic explainability architecture for explaining text machine learning models.
Marcel Robeer, 2021
Installation
See installation.md for an extended installation guide.
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] | |
LocalRules |
Fit a local sparse set of label-specific rules using SkopeRules . |
github/skope-rules | |
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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2b632bd0a129a7eff10c79719c1711bf893017b12a46fe4efbb13bcc1833879 |
|
MD5 | 6aa5a87998639383f61473ba8860e023 |
|
BLAKE2b-256 | 9bb739f1b2e6b3ae59c68cbfa576aa660803526ff7261f8dd208312d30db7839 |
Hashes for text_explainability-0.4.3-py3.9.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba95acca3a92156e40a651fb0a81a96c4ee8e9c0fdd0b75765610ed6b9bc5915 |
|
MD5 | 501dc685d94c52ee120e8c271e28fb43 |
|
BLAKE2b-256 | 150239748590e52b8f0d248d23ca4b60acd0d6e3a7c6c5a1be10de59d3e44732 |
Hashes for text_explainability-0.4.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 338097ff7ad2db199ffdf102694ffbc1c7f2e78e74306706b68768034c5f4081 |
|
MD5 | 915a065d829b164a70a139cbcb60116d |
|
BLAKE2b-256 | ddce2b9407a7f6c567c72cbd982193c1838d2fc01b72347e45ff4c866bcb9061 |