Skip to content

Product kernel explainer#431

Merged
mmschlk merged 33 commits intomainfrom
product-kernel-explainer
Oct 28, 2025
Merged

Product kernel explainer#431
mmschlk merged 33 commits intomainfrom
product-kernel-explainer

Conversation

@Advueu963
Copy link
Copy Markdown
Collaborator

@Advueu963 Advueu963 commented Sep 1, 2025

Motivation and Context

This pull request tackles #425 and introduces a new model-specific explanation method, the ProductKernelExplainer, for product kernel-based machine learning models (such as Gaussian Processes and Support Vector Machines). The implementation includes new classes, conversion utilities, and kernel game logic, enabling exact computation of Shapley values for these models. Several supporting files and types are added, along with minor cleanups elsewhere in the codebase.

The main work was done by @IsaH57.

New Product Kernel Explainer functionality:

  • Added ProductKernelExplainer class for model-specific explanations of product kernel-based models, supporting exact Shapley value computation for regression and classification models. Currently, it is restricted to methods using the RBF kernel.
  • Implemented ProductKernelComputer class, including efficient Shapley value computation algorithms and kernel vector utilities.
  • Added ProductKernelModel dataclass to standardise storage of kernel model parameters.
  • Introduced conversion utilities to transform scikit-learn SVM and Gaussian Process models into the internal product kernel format.
  • Implemented ProductKernelGame for evaluating the kernel-based cooperative game underlying the Shapley value computations.
  • Added validation and type definitions for product kernel explainers and indices.

Public API Changes

  • No Public API changes
  • Yes, Public API changes (Details below)

We introduce a new Explainer, namely the ProductKernelExplainer, giving efficient computation of Shapley Values for kernel-based machine learning models.

How Has This Been Tested?

Unit and Integration Tests have been added to the test suite to ensure the correctness of the method.

Checklist

  • The changes have been tested locally.
  • Documentation has been updated (if the public API or usage changes).
  • An entry has been added to CHANGELOG.md (if relevant for users).
  • The code follows the project's style guidelines.
  • I have considered the impact of these changes on the public API.

@Advueu963 Advueu963 linked an issue Sep 1, 2025 that may be closed by this pull request
16 tasks
@Advueu963 Advueu963 self-assigned this Sep 1, 2025
@Advueu963 Advueu963 requested a review from mmschlk October 15, 2025 20:12
@Advueu963 Advueu963 marked this pull request as ready for review October 15, 2025 20:12
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 24, 2025

Copy link
Copy Markdown
Owner

@mmschlk mmschlk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! Love the tests, love the code, it's simple and understandable! I had three nitpicks only regarding the model typings, since I think this might be easily approved.

Comment thread src/shapiq/explainer/product_kernel/validation.py Outdated
Comment thread src/shapiq/explainer/product_kernel/explainer.py
Comment thread src/shapiq/explainer/product_kernel/explainer.py
@Advueu963 Advueu963 requested a review from mmschlk October 26, 2025 12:43
@mmschlk mmschlk merged commit 7fcb36f into main Oct 28, 2025
10 of 11 checks passed
@mmschlk mmschlk deleted the product-kernel-explainer branch October 28, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ProductKernelExplainer

3 participants