Learn R Programming

diffpriv (version 0.4.2)

predict.bernstein: Evaluate Bernstein approximations on data.

Description

Evaluates a given S3 object of type bernstein on given data D.

Usage

# S3 method for bernstein
predict(object, D, ...)

Arguments

object

an S3 object of type bernstein.

D

either a numeric vector or matrix, all values in [0,1]. If numeric then length should be object$dims unless the latter is 1 in which case the length can be arbitrary. If a matrix then the number of columns should match object$dims.

additional arguments.

Value

a numeric vector of scalar real evaluations.

References

Francesco Ald<U+00E0> and Benjamin I. P. Rubinstein. "The Bernstein Mechanism: Function Release under Differential Privacy", in Proceedings of the 31st AAAI Conference on Artificial Intelligence (AAAI'2017), pp. 1705-1711, Feb 2017.

Examples

Run this code
# NOT RUN {
f <- function(x) x * sin(x*10)
b <- bernstein(f, dims = 1)
xs <- seq(from=0, to=1, length=50)
mean((f(xs) - predict(b,xs))^2)

# }

Run the code above in your browser using DataLab