pydvl.value.shapley.owen
¶
References¶
-
Okhrati, R., Lipani, A., 2021. A Multilinear Sampling Algorithm to Estimate Shapley Values. In: 2020 25th International Conference on Pattern Recognition (ICPR), pp. 7992–7999. IEEE. ↩
OwenAlgorithm
¶
Bases: Enum
Choices for the Owen sampling method.
ATTRIBUTE | DESCRIPTION |
---|---|
Standard |
Use q ∈ [0, 1]
|
Antithetic |
Use q ∈ [0, 0.5] and correlated samples
|
owen_sampling_shapley
¶
owen_sampling_shapley(
u: Utility,
n_samples: int,
max_q: int,
*,
method: OwenAlgorithm = OwenAlgorithm.Standard,
n_jobs: int = 1,
parallel_backend: Optional[ParallelBackend] = None,
config: Optional[ParallelConfig] = None,
progress: bool = False,
seed: Optional[Seed] = None
) -> ValuationResult
Owen sampling of Shapley values as described in (Okhrati and Lipani, 2021)1.
This function computes a Monte Carlo approximation to
using one of two methods. The first one, selected with the argument mode =
OwenAlgorithm.Standard
, approximates the integral with:
where
The second method, selected with the argument mode =
OwenAlgorithm.Antithetic
, uses correlated samples in the inner sum to
reduce the variance:
where now
Note
The outer integration could be done instead with a quadrature rule.
PARAMETER | DESCRIPTION |
---|---|
u |
Utility object holding data, model and scoring function.
TYPE:
|
n_samples |
Numer of sets to sample for each value of q
TYPE:
|
max_q |
Number of subdivisions for q ∈ [0,1] (the element sampling probability) used to approximate the outer integral.
TYPE:
|
method |
Selects the algorithm to use, see the description. Either
OwenAlgorithm.Full for
TYPE:
|
n_jobs |
Number of parallel jobs to use. Each worker receives a chunk
of the total of
TYPE:
|
parallel_backend |
Parallel backend instance to use
for parallelizing computations. If
TYPE:
|
config |
(DEPRECATED) Object configuring parallel computation, with cluster address, number of cpus, etc.
TYPE:
|
progress |
Whether to display progress bars for each job.
TYPE:
|
seed |
Either an instance of a numpy random number generator or a seed for it.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ValuationResult
|
Object with the data values. |
New in version 0.3.0
Changed in version 0.5.0
Support for parallel computation and enable antithetic sampling.
Changed in version 0.9.0
Deprecated config
argument and added a parallel_backend
argument to allow users to pass the Parallel Backend instance
directly.
Source code in src/pydvl/value/shapley/owen.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|