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. ↩
owen_sampling_shapley(u, n_samples, max_q, *, method=OwenAlgorithm.Standard, n_jobs=1, config=ParallelConfig(), progress=False, seed=None)
¶
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 \(q_j = \frac{j}{Q} \in [0,1]\) and the sets \(S^{(q_j)}\) are such that a sample \(x \in S^{(q_j)}\) if a draw from a \(Ber(q_j)\) distribution is 1.
The second method, selected with the argument mode =
OwenAlgorithm.Antithetic
, uses correlated samples in the inner sum to
reduce the variance:
where now \(q_j = \frac{j}{2Q} \in [0,\frac{1}{2}]\), and \(S^c\) is the complement of \(S\).
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][pydvl.value.shapley.owen.OwenAlgorithm] for \(q \in [0,1]\) or [OwenAlgorithm.Halved][pydvl.value.shapley.owen.OwenAlgorithm] for \(q \in [0,0.5]\) and correlated samples
TYPE:
|
n_jobs |
Number of parallel jobs to use. Each worker receives a chunk
of the total of
TYPE:
|
config |
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.
Source code in src/pydvl/value/shapley/owen.py
102 103 104 105 106 107 108 109 110 111 112 113 114 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 |
|
Created: 2023-12-21