Skip to content

Add shap Plots to shapiq #34

Closed
Closed
@mmschlk

Description

@mmschlk

Description

The InteractionValues dataclass is the core data object containing the results and of approximators and explainers. For representing Shapley values (SVs) visually, the shap package already contains a plethora of very helpful illustration techniques. To ease new users into the package and increase the functionality of shapiq, we should also offer the most important plots for the SV or, if possible, even for Shapley interactions (SIs).

In shap, there are two kinds of plots which should be integrated somewhat like the following:

  • One Explanation: Some plots illustrate one shap.Explanation at a time. This should be possible to recreate in our codebase with one InteractionValues object.
  • Multiple Explanations: Other plots capture multiple shap.Explanations at a time. This should be possible with a list of InteractionValues objects.

Plot Descriptons

You can see the plots in the readme of the main shap repo.

Force Plot

The force plot shows how each feature attribution or interaction pulls and pushes the prediction from the empty prediction / baseline $\nu(\emptyset)$ towards the prediction with all features / grand coalition $\nu(N)$. This plot works only for a single explanation:

image

Waterfall Plot

The waterfall plot disentangles the attributions presented in the force plot but shows basically the same information. Notably, it prints only the top-X attributions. This plot works only for a single explanation:

image

Bar Plot

The bar plot shows the mean absolute value of the attribution/interactions wich can be used as a proxy for feature importance. This plot works only for multiple explanations:

image

How To:

For this we need to port the shap plots to shapiq and potentially extend the dataclass.

  • We will need to add the feature values of x_explain to each InteractionValues object as some plots require information about the feature names and the feature values.
  • We will not port 100% functionality from the shap plots to shapiq but the main ones.

Tasks:

Metadata

Metadata

Labels

feature 💡New feature or enhancement requestplot 📊Issues related to visualization utilities

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions