RKHS-SHAP: Shapley Values for Kernel Methods

Siu Lun Chau, Robert Hu, Javier González, Dino Sejdinovic

Kernel methods, like Support Vector Machines (SVMs) and Kernel Ridge Regression, have long been staples of the machine learning toolkit due to their strong theoretical foundations and ability to handle non-linear data. However, they often suffer from a "transparency" problem. While we can look at global parameters like lengthscales to see which features matter generally, we rarely have a clear, efficient way to explain why a model made a specific individual prediction.

In their NeurIPS 2022 paper, "RKHS-SHAP: Shapley Values for Kernel Methods," Siu Lun Chau and colleagues bridge this gap. They introduce a framework that makes local feature attribution for kernel methods not only possible but mathematically elegant and computationally efficient.

TL;DR

RKHS-SHAP provides a fast, analytical way to compute Shapley values—often considered the "gold standard" of feature attribution—specifically for kernel-based models. By leveraging the mathematics of Reproducing Kernel Hilbert Spaces (RKHS), it bypasses the need for expensive data sampling. This offers a more robust explanation method and introduces a novel regularizer to bake fairness and robustness directly into the training process.

What Problem Does This Paper Address?

Most Explainable AI (XAI) tools are either global (telling you what the model thinks is important across the whole dataset) or model-agnostic (treating the model as a black box and poking it with samples to see what happens).

Local feature attribution for a diabetes prediction

The popular KernelSHAP algorithm falls into the latter category. To explain a single prediction, it has to estimate how the model behaves when certain features are "missing." This usually requires sampling thousands of data points to estimate conditional expectations—a process that is computationally expensive, noisy, and often ignores the specific mathematical structure of the model being explained.

The authors identify a missed opportunity: if we know our model is a kernel machine, we shouldn't have to treat it like a black box. We should be able to use the existing arsenal of kernel methods to calculate these explanations directly.

Methods: From Sampling to Analytical Solutions

The core innovation of the paper is RKHS-SHAP. Instead of using Monte Carlo sampling to estimate how missing features affect a prediction, the authors use Kernel Mean Embeddings (KME) and Conditional Mean Embeddings (CME).

In simple terms, these techniques allow you to represent probability distributions as single points in a high-dimensional feature space (the RKHS). Because the model itself lives in this same space, calculating the "expected value" of the model (the key component of a Shapley value) becomes a series of analytical matrix operations rather than a massive simulation.

The paper introduces two versions of this method:

  1. Interventional RKHS-SHAP (ISV): Assumes features are independent when "missing."
  2. Observational RKHS-SHAP (OSV): Accounts for correlations between features, providing a more "true-to-the-data" explanation.

Additionally, they propose the Shapley Regulariser. This allows researchers to add a penalty term to the model's loss function based on the Shapley values themselves. If you want a model to ignore a sensitive feature (like gender or race) or be less sensitive to a noisy sensor, you can literally penalize the attribution of that feature during training.

Key Insights and Ideas

  • Analytical over Numerical: The "aha moment" is that for kernel methods, the missing feature problem is just a conditional expectation problem that kernel theory has already solved. This makes the process deterministic and much faster.
  • Provable Robustness: The authors prove theoretically that RKHS-SHAP is robust to small perturbations in the input data. This addresses a common criticism of XAI: that two nearly identical inputs can sometimes yield wildly different explanations.
  • Learning with Explanations: Most XAI is "post-hoc" (done after the model is trained). The Shapley regularizer turns XAI into a "pre-hoc" tool, allowing the developer to shape the model's reasoning process during the learning phase.

Key Results

Experimental results showing accuracy, runtime, and robustness

The authors validated their method across several datasets, including synthetic distributions for ground-truth testing and real-world data like the Diabetes dataset. Their findings highlight three major advantages:

  • Accuracy: On synthetic datasets, RKHS-SHAP achieved near-perfect $R^2$ scores compared to the ground truth Shapley values, consistently outperforming Gaussian-based approximations (GSHAP).
  • Efficiency: RKHS-SHAP is significantly faster than sampling-based methods like KernelSHAP. In runtime analyses, it completed tasks in a fraction of the time (often orders of magnitude faster in log scale) while utilizing the full training set.
  • Fairness & Robustness: In experiments with the Shapley regularizer, the authors showed they could effectively "mute" the influence of a sensitive feature. Even if other features were highly correlated with the sensitive one, the Observational version of the regularizer accounted for those correlations to produce a truly fair model.

Limitations and Future Work

The primary limitation is that RKHS-SHAP is inherently model-specific. It only works for models that live in an RKHS (like SVMs, Gaussian Processes, or Kernel Ridge Regression). It cannot be directly applied to standard Deep Neural Networks without first approximating them with a kernel (e.g., using a Neural Tangent Kernel).

The authors suggest that future work could involve extending this paradigm to more general model classes or using these efficient Shapley computations to improve kernel-based hypothesis testing.

Summary updated

BibTeX
@inproceedings{chau2022rkhs,
  author = {Siu Lun Chau and Robert Hu and Javier González and Dino Sejdinovic},
  title = {{RKHS-SHAP: Shapley Values for Kernel Methods}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=HxX76TGICKc},
}
Figure