covarFun: Construtor method of CovarFun class

Description Usage Arguments Details Examples

View source: R/CovarianceFunction.R

Description

Creates a new CovarFun object intended to be used inside a GPC Gaussian Process Classifier.

Usage

1
covarFun(k, dk, hp)

Arguments

k

A kernel function (object, x, y) -> numeric() which, given data x and y returns an inner product. Kernel hyperparameters may be accessed with object@hp.

dk

A function (object, x, y) -> list() which returns the gradient of k with respect to the hyprparameters in the form of a lsit of the same shape as the kyperparameters

hp

A list of kernel hyperparameters.

Details

A CovarFun object extends the kernel object which supplies a kernel function along with a list of hyperparameters. CovarFun also supplies a function returning the gradient of the kernel with respect to the hyperparameters, such that the hyperparameters may be tuned by the GPC class.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Isotropic squared exponential covariance function with log length scale
# (ll) hyperparameter
library("gpclassifier")
k  = function(.Object, x, y) {
  exp(-0.5 * sum(exp(-2*.Object@hp$ll) * (x-y)^2))
}
hp = list(ll=0)
dk = function(.Object, x, y) {
  list(ll=.Object@k(.Object, x, y) * exp(-2*.Object@hp$ll)*crossprod(x-y))
}
C  = covarFun(k, dk, hp)

JimSkinner/gpclassifier documentation built on May 7, 2019, 10:52 a.m.