pydvl.valuation.methods.classwise_shapley
¶
Class-wise Shapley (Schoch et al., 2022)1 is a semi-value tailored for classification problems.
The core intuition behind the method is that a sample might enhance the overall performance of the model, while being detrimental for the performance when the model is restricted to items of the same class, and vice versa.
Analysis of Class-wise Shapley
For a detailed explanation and analysis of the method, with comparison to other valuation techniques, please refer to the main documentation and to Semmler and de Benito Delgado (2024).2
References¶
-
Schoch, Stephanie, Haifeng Xu, and Yangfeng Ji. CS-Shapley: Class-wise Shapley Values for Data Valuation in Classification. In Proc. of the Thirty-Sixth Conference on Neural Information Processing Systems (NeurIPS). New Orleans, Louisiana, USA, 2022. ↩
-
Semmler, Markus, and Miguel de Benito Delgado. [Re] Classwise-Shapley Values for Data Valuation. Transactions on Machine Learning Research, July 2024. ↩
ClasswiseShapleyValuation
¶
ClasswiseShapleyValuation(
utility: ClasswiseModelUtility,
sampler: ClasswiseSampler,
is_done: StoppingCriterion,
progress: dict[str, Any] | bool = False,
*,
normalize_values: bool = True,
)
Bases: Valuation
Class to compute Class-wise Shapley values.
PARAMETER | DESCRIPTION |
---|---|
utility
|
Class-wise utility object with model and class-wise scoring function.
TYPE:
|
sampler
|
Class-wise sampling scheme to use.
TYPE:
|
is_done
|
Stopping criterion to use.
TYPE:
|
progress
|
Whether to show a progress bar. |
normalize_values
|
Whether to normalize values after valuation.
TYPE:
|
Source code in src/pydvl/valuation/methods/classwise_shapley.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.