Skip to content

Add ProductKernelExplainer #425

@mmschlk

Description

@mmschlk

Describe the workflow you want to enable

Similar to TreeSHAP/TreeSHAP-IQ for Shapley values and interactions, I want to create 'SV' explanations for machine learning models based on product kernels such as Support Vector Machines (SVMs) and Gaussian Processes (GPs). This would enable many different opportunities to compute Shapley values in different application domains like HPO (heavy use of GPs) or uncertainty quantification (again GPs are King).

Describe your proposed solution

Create a ProductKernelExplainer class, which is a subclass of Explainer working akin to shapiq.TreeExplainer. The ProductKernelExplainer will expose an explain function which is basically a wrapper to an internal ProductKernelComputer's compute function. There is a very nice paper with an research code implementation already out for this.

To do so we would need to implement the following logic:

Implementations

  • ProductKernelExplainer following the implementation of our other explainers.
  • ProductKernelComputer the main computation class to do the computation defined (basically what's implemented here)
  • conversion / validation logic similar to TreeModels but for product kernel methods
    • sklearn's SVR (SV Regressor)
    • sklearn's SVC (SV Classifier)
    • sklearn's GaussianProcessRegressor
    • sklearn's GaussianProcessClassifier (research implementation does not support this yet)
    • Ridge Regression (research implementation does not support this yet)
    • Binary Classification for Label 0 and 1
    • Multi-Class Classification for any class (research implementation does not support this yet)
  • create ProductKernelGame (inside shapiq_games) similar to the TreeGame which can be queried with any coalition S for a local explanation instance and model. This is useful for testing the implementation of ProductKernelExplainer/ProductKernelComputer against the shapiq.ExactComputer

To test the implementation we would need to

Tests

  • Test ProductKernelExplainer output for the cross-product of models and class-labels vs the implementation here similar to how we test against shap's implementation
  • test ProductKernelExplainer against the output of shapiq.ExactComputer using the ProductKernelGame for some unit tests
  • add an integration test for all ValidProductKernelExplainerIndices (only 'SV' for the time being) similar to the other integration tests

Additionally it would be nice to also have these implementations ready:

Additional Info

  • optionally passing the product kernel function to the explainer/computer
  • have ProductKernelExplainer also be returned from calling the bare Explainer object (similar how TabPFNExplainer get's returned for TabPFN models or TreeExplainer for tree-based models called here).

Describe alternatives you've considered, if relevant

No response

Additional context

The method is proposed in a very nice paper linked below.

References:

Impact

High (Major improvement)

Metadata

Metadata

Assignees

Labels

explainer 🔍All issues that are linked to explainersfeature 💡New feature or enhancement request

Projects

Status

✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions