Skip to content

pydvl.valuation.utility.base

UtilityBase

Bases: Generic[SampleT], ABC

__call__ abstractmethod

__call__(sample: SampleT | None) -> float

Note

Calls with empty samples or None must always return the same valid value, e.g. 0, or whatever makes sense for the utility. Some samplers (e.g. permutations) depend on this.

PARAMETER DESCRIPTION
sample

TYPE: SampleT | None

RETURNS DESCRIPTION
float

The evaluation of the utility for the sample

Source code in src/pydvl/valuation/utility/base.py
@abstractmethod
def __call__(self, sample: SampleT | None) -> float:
    """
    !!! Note
        Calls with empty samples or None must always return the same valid value,
        e.g. 0, or whatever makes sense for the utility. Some samplers (e.g.
        permutations) depend on this.

    Args:
        sample:

    Returns:
        The evaluation of the utility for the sample
    """
    ...