Learn R Programming

diffpriv (version 0.4.2)

DPMechNumeric-class: A virtual S4 class for differentially-private numeric mechanisms.

Description

A virtual class that implements common features of Laplace, Gaussian mechanisms from differential privacy, for privatizing numeric vector releases.

Usage

# S4 method for DPMechNumeric
show(object)

# S4 method for DPMechNumeric sensitivityNorm(mechanism, X1, X2)

# S4 method for DPMechNumeric,DPParamsEps releaseResponse(mechanism, privacyParams, X)

Arguments

object

an instance of class DPMech.

mechanism

an object of class DPMechNumeric-class.

X1

a privacy-sensitive dataset.

X2

a privacy-sensitive dataset.

privacyParams

an object of class DPParamsEps.

X

a privacy-sensitive dataset, if using sensitivity sampler a: list, matrix, data frame, numeric/character vector.

Value

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.

Methods (by generic)

  • show: automatically prints the object.

  • sensitivityNorm: measures sensitivity of non-private target.

  • releaseResponse: releases mechanism responses.

Slots

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.

Examples

Run this code
# NOT RUN {
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)
f <- 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)
# }

Run the code above in your browser using DataLab