shapiq.approximator.KernelSHAPIQ¶

class shapiq.approximator.KernelSHAPIQ(n, max_order=2, index='k-SII', *, pairing_trick=False, sampling_weights=None, random_state=None)[source]¶

Bases: Regression[Literal[‘k-SII’, ‘SII’, ‘SV’]]

The KernelSHAP-IQ regression approximator.

The KernelSHAP-IQ regression approximator for estimating the Shapley interaction index (SII) and the k-Shapley interaction index (k-SII).

The KernelSHAP-IQ approximator is described in Fumagalli et al. (2024) Fumagalli et al. [2024]. The method estimates the Shapley interaction index (SII) and the k-Shapley interaction index (k-SII) by solving a weighted regression problem, where the Shapley interaction indices are the coefficients of the regression problem. The estimation happens in subsequent steps, where first the first-order SII values are estimated. Then, the second-order SII values are estimated using the first-order estimations and their residuals. This process is repeated up to the desired interaction order. Another variant of KernelSHAP-IQ is the Inconsistent KernelSHAP-IQ Fumagalli et al. [2024], which works in a similar way but does not converge to the true SII values, but often provides better estimates for lower computational budgets.

See also

  • InconsistentKernelSHAPIQ: The

    Inconsistent KernelSHAP-IQ approximator for estimating the Shapley interaction index (SII) and the k-Shapley interaction index (k-SII).

  • KernelSHAP: The KernelSHAP

    approximator for estimating the Shapley values.

  • RegressionFSII: The Faithful KernelSHAP

    approximator for estimating the Faithful Shapley interaction index (FSII).

Initialize the KernelSHAP-IQ approximator.

Parameters:
  • n (int) – The number of players.

  • max_order (int) – The interaction order of the approximation. Defaults to 2.

  • index (Literal['k-SII', 'SII', 'SV']) – The interaction index to be used. Choose from ['k-SII', 'SII']. Defaults to 'k-SII'.

  • pairing_trick (bool) – If True, the pairing trick is applied to the sampling procedure. Defaults to False.

  • sampling_weights (ndarray | None) – An optional array of weights for the sampling procedure. The weights must be of shape (n + 1,) and are used to determine the probability of sampling a coalition of a certain size. Defaults to None.

  • random_state (int | None) – The random state of the estimator. Defaults to None.

valid_indices: tuple[Literal['k-SII', 'SII', 'SV'], ...] = ('k-SII', 'SII', 'SV')¶

The valid indices for the KernelSHAPIQ approximator.