predict.bernstein {diffpriv} | R Documentation |
Evaluates a given S3 object of type bernstein
on given
data D
.
## S3 method for class 'bernstein'
predict(object, D, ...)
object |
an S3 object of type |
D |
either a numeric vector or matrix, all values in |
... |
additional arguments. |
a numeric vector of scalar real evaluations.
Francesco Aldà 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.
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)