A class that implements the exponential mechanism of differential privacy,
for privatizing releases from sets (not necessarily numeric as
required by DPMechLaplace
). Currently limited to responses
from a finite sets - the most widely used case - as these induce easily
computed sampling distributions from a uniform base measure.
# S4 method for DPMechExponential show(object) # S4 method for DPMechExponential,DPParamsEps releaseResponse(mechanism, privacyParams, X) # S4 method for DPMechExponential sensitivityNorm(mechanism, X1, X2)
object | an instance of class |
---|---|
mechanism | an object of class |
privacyParams | an object of class |
X | a privacy-sensitive dataset, if using sensitivity sampler a: list, matrix, data frame, numeric/character vector. |
X1 | a privacy-sensitive dataset. |
X2 | a privacy-sensitive dataset. |
list with slots per argument, actual privacy parameter and response:
mechanism response with length of target release:
privacyParams, sensitivity, responseSet, target, response
.
scalar numeric norm of non-private target
on datasets.
show
: automatically prints the object.
releaseResponse
: releases exponential mechanism responses.
sensitivityNorm
: measures target
quality score sensitivity.
sensitivity
non-negative scalar numeric quality function sensitivity.
Defaults to Inf
for use with sensitivitySampler()
.
target
the quality score function mapping dataset to a function on
responses (elements of responseSet
).
gammaSensitivity
NA_real_
if inactive, or scalar in [0,1)
indicating that responses must be RDP with specific confidence.
responseSet
a list of possible responses of the mechanism.
Frank McSherry and Kunal Talwar. "Mechanism design via differential privacy." In the 48th Annual IEEE Symposium on Foundations of Computer Science (FOCS'07), pp. 94-103. IEEE, 2007.
## Sensitive data are strings of length at most 5. ## Task is to release most frequent character present, hence quality function ## is a closure that counts character frequencies for given candidate char. ## Global sensitivity is max string length. qualF <- function(X) { function(r) sum(r == unlist(strsplit(X, ""))) } rs <- as.list(letters) m <- DPMechExponential(sensitivity = 5, target = qualF, responseSet = rs) X <- strsplit("the quick brown fox jumps over the lazy dog"," ")[[1]] p <- DPParamsEps(epsilon = 1) releaseResponse(m, p, X)#> $privacyParams #> Differential privacy level e=1 #> $sensitivity #> [1] 5 #> #> $responseSet #> $responseSet[[1]] #> [1] "a" #> #> $responseSet[[2]] #> [1] "b" #> #> $responseSet[[3]] #> [1] "c" #> #> $responseSet[[4]] #> [1] "d" #> #> $responseSet[[5]] #> [1] "e" #> #> $responseSet[[6]] #> [1] "f" #> #> $responseSet[[7]] #> [1] "g" #> #> $responseSet[[8]] #> [1] "h" #> #> $responseSet[[9]] #> [1] "i" #> #> $responseSet[[10]] #> [1] "j" #> #> $responseSet[[11]] #> [1] "k" #> #> $responseSet[[12]] #> [1] "l" #> #> $responseSet[[13]] #> [1] "m" #> #> $responseSet[[14]] #> [1] "n" #> #> $responseSet[[15]] #> [1] "o" #> #> $responseSet[[16]] #> [1] "p" #> #> $responseSet[[17]] #> [1] "q" #> #> $responseSet[[18]] #> [1] "r" #> #> $responseSet[[19]] #> [1] "s" #> #> $responseSet[[20]] #> [1] "t" #> #> $responseSet[[21]] #> [1] "u" #> #> $responseSet[[22]] #> [1] "v" #> #> $responseSet[[23]] #> [1] "w" #> #> $responseSet[[24]] #> [1] "x" #> #> $responseSet[[25]] #> [1] "y" #> #> $responseSet[[26]] #> [1] "z" #> #> #> $target #> function (X) #> { #> function(r) sum(r == unlist(strsplit(X, ""))) #> } #> <environment: 0x000000001a9ee370> #> #> $response #> [1] "o" #>