shapiq.approximator.PermutationSamplingSV¶
- class shapiq.approximator.PermutationSamplingSV(n, random_state=None, **kwargs)[source]¶
Bases:
Approximator[Literal[‘SV’]]The Permutation Sampling algorithm for estimating the Shapley values.
Permutation Sampling Castro et al. [2009] (also known as ApproShapley) estimates the Shapley values by drawing random permutations of the player set and extracting all marginal contributions from each permutation. For details, see Castro et al. (2009) Castro et al. [2009].
- Parameters:
See also
PermutationSamplingSII: The PermutationSampling approximator for the SII index
PermutationSamplingSTII: The PermutationSampling approximator for the STII index
Initialize the Permutation Sampling approximator for Shapley values.
- Parameters:
- approximate(budget, game, batch_size=5, **kwargs)[source]¶
Approximates the Shapley values using ApproShapley.
- Parameters:
budget (
int) – The number of game evaluations for approximationgame (
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. IfNone, the batch size is set to1. Defaults to5.*args – Additional positional arguments (not used, only for compatibility).
**kwargs (
Any) – Additional keyword arguments (not used, only for compatibility).
- Return type:
- Returns:
The estimated interaction values.