Build a comprehensive interaction graph visualization
Project description
README
This package allows you to create a comprehensive visualization graph of feature interactions for machine learning models explained with Local Additive Explanation methods. It should work with any 3-dimensional array of explanation interactions but is particularly well suited for the output of the TreeExplainer SHAP interaction extractor from the shap Python library.
Get started
To get started, simply run:
pip install shapinteractions
You should be ready to go. You can now import ShapInteractions from shapinteractions and use it in your Python environment and scripts:
from shapinteractions import ShapInteractions
How to use the package?
Please head over to our GitHub repository for an example notebook.
How to read the graph?
You can interact with our interaction graph example right here.
Each feature is represented by a node:
- its color informs about whether the feature is positively correlated (red) or negatively correlated (blue) with the model predictions
- its size relates to the average absolute SHAP value of the feature's main effect (the contribution of the feature alone, without accounting for its interactions)
Each interaction is represented by an arrow:
- its color informs about whether the interaction reinforces (red) or attenuates (blue) the main effect of the pointed feature (regardless of that feature's color)
- its width relates to the average absolute SHAP interaction value
- the top slider allows you to hide/reveal interactions based on their strength (average absolute SHAP interaction value)
A node/arrow is rendered black if its Spearman's and Pearson's coefficients are of opposite signs, suggesting that the relationship is more complex than it appears. Similarly, if Spearman's coefficient for a given interaction is smaller than spearmans_threshold (default value of 0.3), the arrow is rendered dashed, suggesting that the correlation is weak.
You can hover over a node/arrow to display the corresponding correlation coefficients and average absolute SHAP value.
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shapinteractions-0.1.tar.gz.
File metadata
- Download URL: shapinteractions-0.1.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ea081e2f545aa549e4f9afcf2b91a6cb7074219773d70705cad38500eacc73c
|
|
| MD5 |
fd96af88f038f04de6765066c64cf5ae
|
|
| BLAKE2b-256 |
e7053d60f91bb4349d5c88a55a042d652c192fccdaaf21436cb0b579c579b4d1
|
File details
Details for the file shapinteractions-0.1-py3-none-any.whl.
File metadata
- Download URL: shapinteractions-0.1-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28eb5a4d6668910b77e32f2a82222f9515284517ce152eb283838dd32e237b6c
|
|
| MD5 |
9811f3e516bae36d137b86ec4bd054ae
|
|
| BLAKE2b-256 |
c88cb8a28175e2076c4f45c88f9e52196f753aefb6f8ba38c04e24ba05216d28
|