shapiq.approximator.PermutationSamplingSTIIΒΆ
- class shapiq.approximator.PermutationSamplingSTII(n, max_order, random_state=None, **kwargs)[source]ΒΆ
Bases:
Approximator[Literal[βSTIIβ]]Permutation Sampling approximator for the Shapley Taylor Index (STII).
See also
PermutationSamplingSII: The PermutationSampling approximator for the SII index
PermutationSamplingSV: The PermutationSampling approximator for the SV index
Example
>>> from shapiq_games.synthetic import DummyGame >>> from shapiq.approximator import PermutationSamplingSTII >>> game = DummyGame(n=5, interaction=(1, 2)) >>> approximator = PermutationSamplingSTII(n=5, max_order=2) >>> approximator.approximate(budget=200, game=game) InteractionValues( index=STII, order=2, estimated=True, estimation_budget=165, values={ (0,): 0.2, (1,): 0.2, (2,): 0.2, (3,): 0.2, (4,): 0.2, (0, 1): 0, (0, 2): 0, (0, 3): 0, (0, 4): 0, (1, 2): 1.0, (1, 3): 0, (1, 4): 0, (2, 3): 0, (2, 4): 0, (3, 4): 0 } )
Initialize the Permutation Sampling approximator for STII.
- Parameters:
- approximate(budget, game, batch_size=1, **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) β The size of the batch. IfNone, the batch size is set to1. Defaults to1.*args β Additional positional arguments (not used in this method).
**kwargs (
Any) β Additional keyword arguments (not used in this method).
- Returns:
The estimated interaction values.
- Return type: