pydvl.valuation.methods.loo
¶
This module implements Leave-One-Out (LOO) valuation.
This is the simplest example of marginal-contribution-based valuation method. It is defined as:
where \(U\) is the utility function, \(N\) is the set of all indices, and \(i\) is the index of interest.
Strictly speaking, LOO can be seen as a semivalue where the coefficients are zero except for \(k=|D|-1.\)
Changing LOO¶
LOOValuation is preconfigured to stop once all indices have been visited once. In particular, it uses a default LOOSampler with a FiniteSequentialIndexIteration. If you want to change this behaviour, the easiest way is to subclass and replace the constructor.
LOOValuation
¶
LOOValuation(utility: UtilityBase, progress: bool = False)
Bases: SemivalueValuation
Computes LOO values for a dataset.
Source code in src/pydvl/valuation/methods/loo.py
values
¶
values(sort: bool = False) -> ValuationResult
Returns a copy of the valuation result.
The valuation must have been run with fit()
before calling this method.
PARAMETER | DESCRIPTION |
---|---|
sort
|
Whether to sort the valuation result by value before returning it.
TYPE:
|
Returns: The result of the valuation.
Source code in src/pydvl/valuation/base.py
log_coefficient
¶
The LOOSampler returns only complements of {idx}, so the weight is either 1/n (the probability of a set of size n-1) or 0 if k != n-1. We cancel this out here so that the final coefficient is either 1 if k == n-1 or 0 otherwise.