pydvl.valuation.methods.twodshapley
¶
This module implements 2D-Shapley, as introduced in (Liu et al., 2023)1.
References¶
-
Liu, Zhihong, Hoang Anh Just, Xiangyu Chang, Xi Chen, and Ruoxi Jia. 2D-Shapley: A Framework for Fragmented Data Valuation. In Proceedings of the 40th International Conference on Machine Learning, 21730–55. PMLR, 2023. ↩
TwoDSample
dataclass
¶
Bases: Sample
A sample for 2D-Shapley, consisting of a set of indices and a set of features.
with_idx_in_subset
¶
Return a copy of sample with idx added to the subset.
Returns the original sample if idx was already part of the subset.
RETURNS | DESCRIPTION |
---|---|
Sample
|
A copy of the sample with idx added to the subset.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If idx is None. |
Source code in src/pydvl/valuation/types.py
with_idx
¶
with_idx(idx: int) -> Self
Return a copy of sample with idx changed.
Returns the original sample if idx is the same.
PARAMETER | DESCRIPTION |
---|---|
idx |
New value for idx.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Sample
|
A copy of the sample with idx changed.
TYPE:
|
Source code in src/pydvl/valuation/types.py
with_subset
¶
with_subset(subset: NDArray[IndexT]) -> Self
Return a copy of sample with subset changed.
Returns the original sample if subset is the same.
PARAMETER | DESCRIPTION |
---|---|
subset |
New value for subset.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Sample
|
A copy of the sample with subset changed.
TYPE:
|