shapiq.approximator.PermutationSamplingSIIΒΆ

class shapiq.approximator.PermutationSamplingSII(n, max_order=2, index='k-SII', *, top_order=False, random_state=None)[source]ΒΆ

Bases: Approximator[Literal[β€˜SII’, β€˜k-SII’]]

Permutation Sampling approximator for the SII (and k-SII) index.

See also

Initialize the Permutation Sampling approximator for SII (and k-SII).

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

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

  • index (Literal['SII', 'k-SII']) – The interaction index to compute. Must be either 'SII' or 'k-SII'.

  • top_order (bool) – Whether to approximate only the top order interactions (True) or all orders up to the specified order (False, default).

  • random_state (int | None) – The random state to use for the permutation sampling. Defaults to None.

approximate(budget, game, batch_size=5, **kwargs)[source]ΒΆ

Approximates the interaction values.

Parameters:
  • budget (int) – The budget for the approximation.

  • game (Game | Callable[[ndarray], ndarray]) – The game function as a callable that takes a set of players and returns the value.

  • batch_size (int | None) – The size of the batch. If None, the batch size is set to 1. Defaults to 5.

  • **kwargs (Any) – Additional keyword arguments (unused).

Returns:

The estimated interaction values.

Return type:

InteractionValues

valid_indices: tuple[Literal['SII', 'k-SII'], ...] = ('SII', 'k-SII')ΒΆ

The valid indices for this permutation sampling approximator.