Skip to contents

Samples a candidate with probability proportional to \(\exp(\epsilon u / 2\Delta u)\).

Usage

morie_dp_exponential_mechanism(
  candidates,
  utility,
  epsilon = 1,
  sensitivity = 1,
  seed = NULL
)

Arguments

candidates

vector or list of candidates.

utility

utility of each candidate, finite.

epsilon

privacy budget.

sensitivity

sensitivity of the utility function.

seed

optional integer seed.

Value

list with selected, index (0-based, matching the Python module), probabilities.

Details

This is the mechanism for choices rather than numbers – where adding noise to the answer makes no sense because the answer is not a number. The 2 in the denominator is load-bearing: it is what covers the change in the normalising constant as well as in the utility, and dropping it halves the claimed epsilon.

References

McSherry, F. and Talwar, K. (2007). Mechanism design via differential privacy. FOCS, 94-103.

Examples

r <- morie_dp_exponential_mechanism(c("a", "b", "c"), c(0, 5, 1),
  epsilon = 2, seed = 1
)
round(r$probabilities, 3)
#> [1] 0.007 0.976 0.018