shapiq.utils.generate_interaction_lookup_from_coalitions¶
- shapiq.utils.generate_interaction_lookup_from_coalitions(coalitions)[source]¶
Generates a lookup dictionary for interactions based on an array of coalitions.
- Parameters:
coalitions (
ndarray[tuple[Any,...],dtype[bool]]) – An array of player coalitions.- Return type:
- Returns:
A dictionary that maps interactions to their index in the values vector
Example
>>> coalitions = np.array([ ... [1, 0, 1], ... [0, 1, 1], ... [1, 1, 0], ... [0, 0, 1] ... ]) >>> generate_interaction_lookup_from_coalitions(coalitions) {(0, 2): 0, (1, 2): 1, (0, 1): 2, (2,): 3}