Learn R Programming

DPpack (version 0.2.2)

ExponentialMechanism: Exponential Mechanism

Description

This function implements the exponential mechanism for differential privacy by selecting the index of a vector of candidates to return according to a user-specified vector of utility function values, epsilon, and global sensitivity. Sensitivity calculated based either on bounded or unbounded differential privacy can be used Kifer2011DPpack. If measure is provided, the probabilities of selecting each value are scaled according to the values in measure. If candidates is provided, the function returns the value of candidates at the selected index, rather than the index itself.

Usage

ExponentialMechanism(
  utility,
  eps,
  sensitivity,
  measure = NULL,
  candidates = NULL
)

Value

Indices (or values if candidates given) selected by the mechanism based on the bounded and/or unbounded definitions of differential privacy.

Arguments

utility

Numeric vector giving the utilities of the possible values.

eps

Positive real number defining the epsilon privacy budget.

sensitivity

Real number corresponding to the l1-global sensitivity of the function generating utility.

measure

Optional numeric vector of scaling measures for the probabilities of selecting each value. Should be same size as utility. Defaults to uniform scaling.

candidates

Optional vector of candidates of same size as utility. If given, the function returns the candidate at the selected index rather than the index itself.

References

Dwork2006aDPpack

Kifer2011DPpack

McSherry2007DPpack

Examples

Run this code
candidates <- c('a','b','c','d','e','f','g')
# Release index
idx <- ExponentialMechanism(c(0,1,2,3,2,1,0), 1, 1)
candidates[idx] # Randomly chosen candidate

# Release candidate
ExponentialMechanism(c(0,1,2,3,2,1,0), 1, .5, measure=c(1,1,2,1,2,1,1),
  candidates=candidates)

Run the code above in your browser using DataLab