|
1 | 1 | r""" |
2 | | -!!! Fixme "Move this to the docs" |
3 | | -
|
| 2 | +FIXME: Move this to the docs |
4 | 3 |
|
5 | 4 | Owen sampling schemes are a family of sampling schemes that are used to estimate |
6 | 5 | Shapley values. They are based on a multilinear extension technique from game theory, |
|
10 | 9 | In order to compute values it is enough to use any of the Owen samplers together with a |
11 | 10 | [ShapleyValuation][pydvl.valuation.methods.ShapleyValuation] object. |
12 | 11 |
|
13 | | -!!! Example "Finite Owen Sampler" |
14 | | - [OwenSampler][pydvl.valuation.samplers.owen.OwenSampler] with a |
15 | | - [FiniteSequentialIndexIteration][pydvl.valuation.iteration.FiniteSequentialIndexIteration] |
16 | | - for the outer loop and a |
17 | | - [GridOwenStrategy][pydvl.valuation.samplers.owen.GridOwenStrategy] for the sampling |
18 | | - probabilities is the most basic Owen sampler. It uses a deterministic grid of |
19 | | - probability values between 0 and 1 for the inner sampling. It follows the idea of |
20 | | - the original paper and should be instantiated with |
21 | | - [NoStopping][pydvl.valuation.stopping.NoStopping] as stopping criterion. Note that |
22 | | - because the criterion never checks for convergence, the status of the valuation will |
23 | | - always be `Status.Pending`. |
| 12 | +## Finite Owen Sampler |
| 13 | +[OwenSampler][pydvl.valuation.samplers.owen.OwenSampler] with a |
| 14 | +[FiniteSequentialIndexIteration][pydvl.valuation.samplers.powerset.FiniteSequentialIndexIteration] |
| 15 | +for the outer loop and a |
| 16 | +[GridOwenStrategy][pydvl.valuation.samplers.owen.GridOwenStrategy] for the sampling |
| 17 | +probabilities is the most basic Owen sampler. It uses a deterministic grid of |
| 18 | +probability values between 0 and 1 for the inner sampling. It follows the idea of |
| 19 | +the original paper and should be instantiated with |
| 20 | +[NoStopping][pydvl.valuation.stopping.NoStopping] as stopping criterion. Note that |
| 21 | +because the criterion never checks for convergence, the status of the valuation will |
| 22 | +always be `Status.Pending`. |
24 | 23 |
|
| 24 | +??? Example |
25 | 25 | ```python |
26 | 26 | from pydvl.valuation import OwenSampler, ShapleyValuation, NoStopping |
27 | 27 | ... |
|
36 | 36 | shapley_values = valuation.values() |
37 | 37 | ``` |
38 | 38 |
|
39 | | -!!! Example "Owen Sampler" |
40 | | - [OwenSampler][pydvl.valuation.samplers.owen.OwenSampler] follows the same principle |
41 | | - as [OwenSampler][pydvl.valuation.samplers.owen.OwenSampler], but samples |
42 | | - probability values between 0 and 1 at random indefinitely. It requires a stopping |
43 | | - criterion to be used with the valuation method, and thus follows more closely the |
44 | | - general pattern of the valuation methods. This makes it more adequate for actual use |
45 | | - since it is no longer required to estimate a number of outer samples required. |
| 39 | +## Owen Sampler |
| 40 | +[OwenSampler][pydvl.valuation.samplers.owen.OwenSampler] follows the same principle |
| 41 | +as [OwenSampler][pydvl.valuation.samplers.owen.OwenSampler], but samples |
| 42 | +probability values between 0 and 1 at random indefinitely. It requires a stopping |
| 43 | +criterion to be used with the valuation method, and thus follows more closely the |
| 44 | +general pattern of the valuation methods. This makes it more adequate for actual use |
| 45 | +since it is no longer required to estimate a number of outer samples required. |
46 | 46 |
|
| 47 | +!!! Example |
47 | 48 | ```python |
48 | 49 | from pydvl.valuation import OwenSampler, ShapleyValuation, RankCorrelation |
49 | 50 | ... |
|
53 | 54 | valuation.fit(dataset) |
54 | 55 | ``` |
55 | 56 |
|
56 | | -!!! Example "Antithetic Owen Sampler" |
57 | | - [AntitheticOwenSampler][pydvl.valuation.samplers.owen.AntitheticOwenSampler] is a |
58 | | - variant of the [OwenSampler][pydvl.valuation.samplers.owen.OwenSampler] that draws |
59 | | - probability values $q$ between 0 and 0.5 at random and then generates two samples |
60 | | - for each index, one using the probability $q$ for index draws, and another with |
61 | | - probability $1-q$. |
| 57 | +## Antithetic Owen Sampler |
| 58 | +[AntitheticOwenSampler][pydvl.valuation.samplers.owen.AntitheticOwenSampler] is a |
| 59 | +variant of the [OwenSampler][pydvl.valuation.samplers.owen.OwenSampler] that draws |
| 60 | +probability values $q$ between 0 and 0.5 at random and then generates two samples |
| 61 | +for each index, one using the probability $q$ for index draws, and another with |
| 62 | +probability $1-q$. |
62 | 63 |
|
| 64 | +!!! Example |
63 | 65 | ```python |
64 | 66 | from pydvl.valuation import AntitheticOwenSampler, ShapleyValuation, RankCorrelation |
65 | 67 | ... |
|
0 commit comments