bernstein: Fit a Bernstein polynomial approximation.

View source: R/bernstein_polynomials.R

bernsteinR Documentation

Fit a Bernstein polynomial approximation.

Description

Fits the basis of Bernstein polynomial functions to given real-valued function f of [0,1]^d where d=dims, against a regular lattice of k+1 points in each dimension for given k. Note the approximation is not the iterated variant.

Usage

bernstein(f, dims, k = 10)

Arguments

f

a function to be approximated.

dims

the function f's domain dimension.

k

the lattice resolution of approximation.

Value

an S3 object of class bernstein.

References

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.

See Also

predict.bernstein for subsequent evaluation.

Examples

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)


brubinstein/diffpriv documentation built on July 7, 2022, 4:23 a.m.