shapiq.approximator.OwenSamplingSVΒΆ

class shapiq.approximator.OwenSamplingSV(n, n_anchor_points=10, random_state=None, **kwargs)[source]ΒΆ

Bases: Approximator[Literal[β€˜SV’]]

Owen Sampling approximator for the Shapley values.

The Owen Sampling algorithm estimates the Shapley values (SV) by sampling random marginal contributions for each player and each coalition size. The marginal contributions are used to update an integral representation of the SV. For more information, see Okhrati and Lipani [2020]. The number of anchor points M at which the integral is to be palpated share the available budget for each player equally. A higher n_anchor_points increases the resolution of the integral reducing bias while reducing the accuracy of the estimation at each point.

Variables:
  • n – The number of players.

  • iteration_cost – The cost of a single iteration of the approximator.

Parameters:
  • n (int)

  • n_anchor_points (int)

  • random_state (int | None)

  • kwargs (Any)

Initialize the Owen Sampling SV approximator.

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

  • n_anchor_points (int) – The number of anchor points at which the integral is to be palpated. Defaults to 10.

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

  • **kwargs (Any) – Additional arguments not used.

static get_anchor_points(n_anchor_points)[source]ΒΆ

Returns the anchor points for the Owen Sampling approximation.

Parameters:

n_anchor_points (int) – The number of anchor points.

Return type:

ndarray

Returns:

An array of anchor points.

Raises:

ValueError – If the number of anchor points is less than or equal to 0.

approximate(budget, game, *args, **kwargs)[source]ΒΆ

Approximates the Shapley values using Owen Sampling.

Parameters:
  • budget (int) – The number of game evaluations for approximation

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

  • *args (Any) – Additional positional arguments not used in this method.

  • **kwargs (Any) – Additional keyword arguments not used in this method.

Return type:

InteractionValues

Returns:

The estimated interaction values.

valid_indices: tuple[Literal['SV'], ...] = ('SV',)ΒΆ

The valid indices for this approximator.