Description Usage Arguments Details Examples
View source: R/CovarianceFunction.R
Creates a new CovarFun object intended to be used inside a GPC
Gaussian Process Classifier.
1 | covarFun(k, dk, hp)
|
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. |
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.