mmschlk/shapiq

Shapley Interactions and Shapley Values for Machine Learning

What it solves

shapiq is designed to provide a more comprehensive view of machine learning model predictions by quantifying the synergy between different input features. While traditional Shapley values (like those in the shap package) focus on individual feature attributions, shapiq extends this by calculating any-order Shapley interactions, allowing users to see how features work together to influence a prediction.

How it works

The library implements game-theoretic algorithms to approximate any-order Shapley interactions. It provides a TabularExplainer for standard models and a specialized TabPFNExplainer for TabPFN models using a "remove-and-recontextualize" paradigm. For large-scale datasets with many features, it includes the ProxySPEX (Proxy SParse EXplainer) approximator to maintain efficiency.

Who it’s for

It is built for both machine learning researchers working on game theory and end-users who need to explain the internal logic of their models' predictions.

Highlights

  • Any-Order Interactions: Computes interaction values beyond simple first-order attributions.
  • Integration with SHAP: Can compute standard Shapley values (SV) and then transition to interaction values (k-SII).
  • Specialized Explainers: Includes dedicated support for TabPFN.
  • Visualization Tools: Provides network plots to visualize the strength of feature interactions and force plots for attribution.
  • Benchmarking: Includes tools for benchmarking game-theoretical algorithms in ML.

Related

  • Project
  • Project
  • Dispatch
  • Project
  • Project