pydvl.valuation.methods.loo
¶
This module implements Leave-One-Out (LOO) valuation.
It is defined as:
where \(u\) is the utility function, \(N\) is the set of all indices, and \(i\) is the index of interest.
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
log_coefficient
property
¶
log_coefficient: SemivalueCoefficient | None
Disable importance sampling for this method since we have a fixed sampler that already provides the correct weights for the Monte Carlo approximation.
fit
¶
fit(data: Dataset, continue_from: ValuationResult | None = None) -> Self
Fits the semi-value valuation to the data.
Access the results through the result
property.
PARAMETER | DESCRIPTION |
---|---|
data
|
Data for which to compute values
TYPE:
|
continue_from
|
A previously computed valuation result to continue from.
TYPE:
|
Source code in src/pydvl/valuation/methods/semivalue.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.