test.kernel.grad: Test an Analytic Gradient Against a Numeric Gradient

Description Usage Arguments Value

View source: R/kernels.R

Description

Creates a numerical approximation to the gradient function of a kernel (using create.numeric.grad) and compares it to an analytic gradient function. If the maximum relative difference exceeds 0.01, returns the failing inputs, otherwise returns TRUE.

Usage

1
2
test.kernel.grad(k, k.grad, hyper.param.names, additional.params,
  repetitions = 1000, dimensions = NULL)

Arguments

k

a kernel function

k.grad

the analytic gradient to test

hyper.param.names

names of the kernel's hyperparameters

additional.params

any additional parameters of the kernel

repetitions

number of repetitions to attempt

Value

If the gradients match, returns TRUE. If a mismatch is found, returns a list with named entries:


mattdneal/gaussianProcess documentation built on May 21, 2019, 12:58 p.m.