Skip to main content

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.

Metadata

Release files for shapinteractions 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shapinteractions 0.1
File Size Uploaded Provenance Actions
shapinteractions-0.1.tar.gz 20.1 kB Without provenance Details for shapinteractions-0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shapinteractions 0.1
File Interpreter ABI Platform Actions
shapinteractions-0.1-py3-none-any.whl Python 3 none any Details for shapinteractions-0.1-py3-none-any.whl

Total release size: 39.9 kB

Release files / shapinteractions-0.1.tar.gz

Download URL shapinteractions-0.1.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7ea081e2f545aa549e4f9afcf2b91a6cb7074219773d70705cad38500eacc73c
BLAKE2b-256 checksum
How to use checksums
e7053d60f91bb4349d5c88a55a042d652c192fccdaaf21436cb0b579c579b4d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / shapinteractions-0.1-py3-none-any.whl

Download URL shapinteractions-0.1-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28eb5a4d6668910b77e32f2a82222f9515284517ce152eb283838dd32e237b6c
BLAKE2b-256 checksum
How to use checksums
c88cb8a28175e2076c4f45c88f9e52196f753aefb6f8ba38c04e24ba05216d28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Security for shapinteractions 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page