shapiq.approximator.SPEX¶

class shapiq.approximator.SPEX(*, n, max_order=2, index='k-SII', top_order=False, random_state=None, decoder_type='soft', degree_parameter=5)[source]¶

Bases: Sparse

SPEX (SParse EXplainer) via Fourier transform sampling.

An approximator for cardinal interaction indices using Fourier transform sampling to efficiently compute sparse higher-order interactions. SPEX is presented in Kang et al. [2025].

Initialize the SPEX approximator.

Parameters:
  • n (int) – Number of players (features).

  • max_order (int) – Maximum interaction order to consider.

  • index (Literal['k-SII', 'STII', 'FSII', 'FBII', 'SII', 'SV', 'BV']) – The Interaction index to use. All indices supported by shapiq’s MoebiusConverter are supported.

  • top_order (bool) – If True, only reports interactions of exactly order max_order. Otherwise, reports all interactions up to order max_order. Defaults to False.

  • random_state (int | None) – Seed for random number generator. Defaults to None.

  • decoder_type (Literal['soft', 'hard']) – Type of decoder to use, either “soft” or “hard”. Defaults to “soft”.

  • degree_parameter (int) – A parameter that controls the maximum degree of the interactions to extract during execution of the algorithm. Note that this is a soft limit, and in practice, the algorithm may extract interactions of any degree. We typically find that there is little value going beyond 5. Defaults to 5. Note that increasing this parameter will need more budget in the approximate() method.