shapiq.utils.transform_coalitions_to_arrayΒΆ
- shapiq.utils.transform_coalitions_to_array(coalitions, n_players=None)[source]ΒΆ
Transforms a collection of coalitions to a binary array (one-hot encodings).
- Parameters:
- Return type:
- Returns:
Binary array of coalitions.
Example
>>> coalitions = [(0, 1), (1, 2), (0, 2)] >>> transform_coalitions_to_array(coalitions) array([[ True, True, False], [False, True, True], [ True, False, True]])
>>> transform_coalitions_to_array(coalitions, n_players=4) array([[ True, True, False, False], [False, True, True, False], [ True, False, True, False]])