A virtual class that implements common features of Laplace, Gaussian mechanisms from differential privacy, for privatizing numeric vector releases.
# S4 method for DPMechNumeric show(object) # S4 method for DPMechNumeric sensitivityNorm(mechanism, X1, X2) # S4 method for DPMechNumeric,DPParamsEps releaseResponse(mechanism, privacyParams, X)
object | an instance of class |
---|---|
mechanism | an object of class |
X1 | a privacy-sensitive dataset. |
X2 | a privacy-sensitive dataset. |
privacyParams | an object of class |
X | a privacy-sensitive dataset, if using sensitivity sampler a: list, matrix, data frame, numeric/character vector. |
scalar numeric norm of non-private target
on datasets.
list with slots per argument, actual privacy parameter;
mechanism response with length of target release:
privacyParams, sensitivity, dims, target, response
.
show
: automatically prints the object.
sensitivityNorm
: measures sensitivity of non-private target
.
releaseResponse
: releases mechanism responses.
sensitivity
non-negative scalar numeric target sensitivity.
Defaults to Inf
for use with sensitivitySampler()
.
target
the target non-private function to be privatized, takes lists.
Defaults to a constant function. Laplace mechanism assumes functions that
release numeric vectors of fixed dimension dims
.
gammaSensitivity
NA_real_
if deactive, or scalar in [0,1)
indicating that responses must be RDP with specific confidence.
dims
positive scalar numeric dimension of responses. Defaults to
NA_integer_
for use with sensitivitySampler()
which can
probe target
to determine dimension.
f <- function(xs) mean(xs) n <- 100 m <- DPMechLaplace(sensitivity = 1/n, target = f, dims = 1) X1 <- runif(n) X2 <- runif(n) sensitivityNorm(m, X1, X2)#> [1] 0.07806849f <- function(xs) mean(xs) n <- 100 m <- DPMechLaplace(sensitivity = 1/n, target = f, dims = 1) X <- runif(n) p <- DPParamsEps(epsilon = 1) releaseResponse(m, p, X)#> $privacyParams #> Differential privacy level e=1 #> $sensitivity #> [1] 0.01 #> #> $dims #> [1] 1 #> #> $target #> function (xs) #> mean(xs) #> <environment: 0x000000002360d758> #> #> $response #> [1] 0.5412737 #>