shapiq.utilsΒΆ

Low-level utility functions for working with subsets, coalitions, and modules.

Functions

powerset

Return a powerset of an iterable as tuples with optional size limits.

pair_subset_sizes

Determines what subset sizes are paired together.

split_subsets_budget

Determines which subset sizes can be computed explicitly and which sizes need to be sampled.

get_explicit_subsets

Enumerates all subsets of the given sizes and returns a one-hot matrix.

generate_interaction_lookup

Generates a lookup dictionary for interactions.

generate_interaction_lookup_from_coalitions

Generates a lookup dictionary for interactions based on an array of coalitions.

transform_coalitions_to_array

Transforms a collection of coalitions to a binary array (one-hot encodings).

transform_array_to_coalitions

Transforms a 2d one-hot matrix of coalitions into a list of tuples.

count_interactions

Counts the number of interactions for a given number of players and maximum order.

safe_isinstance

Safely checks if an object is an instance of a class.

check_import_module

Check if the optional dependency is available.

shuffle_data

Shuffle the data.

raise_deprecation_warning

Raise a deprecation warning with the given details.