shapiq_benchmark.computers.BruteForceComputer¶
- class shapiq_benchmark.computers.BruteForceComputer(game)[source]¶
-
Brute force: evaluates all
2**ncoalitions withExactComputer.Works for every game, at a cost exponential in the number of players: computing the values of a game of more than
max_playersplayers warns. The game values are evaluated once and reused for every index and order.Bind the computer to a game.
- Parameters:
game (
Game) – The game.
- classmethod supported_indices()[source]¶
The indices of
ExactComputer.
- exact_values(index, order)¶
Compute the exact interaction values of order 1 to
order.- Parameters:
- Return type:
- Returns:
The interactions of order
1toorder, with the game’s empty value as baseline.- Raises:
UnsupportedComputationError – If
(index, order)is not supported.
- max_order()¶
Return the highest supported interaction order (the number of players by default).
- Return type:
- supports(index, order)¶
Return whether the computer can compute
indexup toorderfor its game.- Return type:
- max_players = 25¶
The number of players above which computing warns (
2**25game evaluations). Brute force more than doubles its time and memory with every player: at 22 players, the Shapley values of a cheap game take about 2.5 minutes and 2.6 GB. SetBruteForceComputer.max_playersto change the limit.
- name = 'brute_force'¶
A short, stable name of the computer (part of ground-truth cache keys).