Skip to content

Commit bebfd9c

Browse files
committed
[skip ci] More fixes
1 parent 5ee24bd commit bebfd9c

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

docs/value/classwise-shapley.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ the dataset.
4242
Like all other game-theoretic valuation methods, CWS requires a
4343
[Utility][pydvl.utils.utility.Utility] object constructed with model and
4444
dataset, with the peculiarity of requiring a specific
45-
[ClasswiseScorer][pydvl.value.shapley.classwise.ClasswiseScorer]:
45+
[ClasswiseScorer][pydvl.value.shapley.classwise.ClasswiseScorer]. The entry
46+
point is the function
47+
[compute_classwise_shapley_values][pydvl.value.shapley.classwise.compute_classwise_shapley_values]:
4648

4749
```python
4850
from pydvl.value import *

src/pydvl/value/shapley/classwise.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@
1313
$$
1414
1515
where $S_{y_i} \subseteq D_{y_i} \setminus \{i\}$ and $S_{-y_i} \subseteq
16-
D_{-y_i}$. In practice, this quantity is estimated using Monte Carlo sampling of
17-
the powerset and the set of index permutations. Applying these techniques
18-
results in the estimator
16+
D_{-y_i}$.
17+
18+
!!! tip "Analysis of Class-wise Shapley"
19+
For a detailed analysis of the method, with comparison to other valuation
20+
techniques, please refer to the [main
21+
documentation](../../../../../value/classwise-shapley).
22+
23+
In practice, the quantity above is estimated using Monte Carlo sampling of
24+
the powerset and the set of index permutations. This results in the estimator
1925
2026
$$
2127
v_u(i) = \frac{1}{K} \sum_k \frac{1}{L} \sum_l
@@ -110,27 +116,28 @@ class ClasswiseScorer(Scorer):
110116
!!! warning Multi-class support
111117
Metrics must support multiple class labels if you intend to apply them
112118
to a multi-class problem. For instance, the metric 'accuracy' supports
113-
multiple classes, but the metric 'f1' does not. For a two-class
114-
classification problem, using 'f1_weighted' is essentially equivalent to
115-
using 'accuracy'.
119+
multiple classes, but the metric `f1` does not. For a two-class
120+
classification problem, using `f1_weighted` is essentially equivalent to
121+
using `accuracy`.
116122
117123
Args:
118124
scoring: Name of the scoring function or a callable that can be passed
119125
to [Scorer][pydvl.utils.score.Scorer].
120126
default: Score to use when a model fails to provide a number, e.g. when
121127
too little was used to train it, or errors arise.
122-
range: Numerical range of the score function. Some Monte Carlo methods can
123-
use this to estimate the number of samples required for a certain quality of
124-
approximation. If not provided, it can be read from the `scoring` object
125-
if it provides it, for instance if it was constructed with
128+
range: Numerical range of the score function. Some Monte Carlo methods
129+
can use this to estimate the number of samples required for a
130+
certain quality of approximation. If not provided, it can be read
131+
from the `scoring` object if it provides it, for instance if it was
132+
constructed with
126133
[compose_score][pydvl.utils.score.compose_score].
127134
in_class_discount_fn: Continuous, monotonic increasing function used to
128135
discount the in-class score.
129-
out_of_class_discount_fn: Continuous, monotonic increasing function used to
130-
discount the out-of-class score.
136+
out_of_class_discount_fn: Continuous, monotonic increasing function used
137+
to discount the out-of-class score.
131138
initial_label: Set initial label (for the first iteration)
132139
name: Name of the scorer. If not provided, the name of the inner scoring
133-
function will be prefixed by 'classwise '.
140+
function will be prefixed by `classwise `.
134141
135142
!!! tip "New in version 0.7.1"
136143
"""

0 commit comments

Comments
 (0)