probly.utils.sets

Utility functions regarding sets.

Functions

capacity(q, a)

Compute the capacity of set q given set a.

moebius(q, a)

Compute the Moebius function of a set q given a set a.

powerset(iterable)

Generate the power set of a given iterable.

probly.utils.sets.capacity(q, a)[source]

Compute the capacity of set q given set a.

Parameters:
  • q (np.ndarray) – numpy.ndarray, shape (n_instances, n_samples, n_classes)

  • a (Iterable[int]) – Iterable, shape (n_classes,), indices indicating subset of classes

Returns:

numpy.ndarray, shape (n_instances,), capacity of q given a

Return type:

min_capacity

probly.utils.sets.moebius(q, a)[source]

Compute the Moebius function of a set q given a set a.

Parameters:
  • q (np.ndarray) – numpy.ndarray of shape (num_samples, num_members, num_classes)

  • a (Iterable[int]) – numpy.ndarray, shape (n_classes,), indices indicating subset of classes

Returns:

numpy.ndarray, shape (n_instances,), moebius value of q given a

Return type:

m_a

probly.utils.sets.powerset(iterable)[source]

Generate the power set of a given iterable.

Parameters:

iterable (Iterable[int]) – Iterable

Returns:

List[tuple], power set of the given iterable

Return type:

list[tuple[()]]