kernel-class.RdThe built-in kernel classes in kernlab
Objects can be created by calls of the form new("rbfkernel"),
new{"polykernel"}, new{"tanhkernel"},
new{"vanillakernel"}, new{"anovakernel"},
new{"besselkernel"}, new{"laplacekernel"},
new{"splinekernel"}, new{"stringkernel"}
or by calling the rbfdot, polydot, tanhdot,
vanilladot, anovadot, besseldot, laplacedot,
splinedot, stringdot functions etc..
.Data:Object of class "function" containing
the kernel function
kpar:Object of class "list" containing the
kernel parameters
Class "kernel", directly.
Class "function", by class "kernel".
signature(kernel = "rbfkernel", x =
"matrix"): computes the kernel matrix
signature(kernel = "rbfkernel", x =
"matrix"): computes the quadratic kernel expression
signature(kernel = "rbfkernel", x =
"matrix"): computes the kernel expansion
signature(kernel = "rbfkernel", x =
"matrix"),,a: computes parts or the full kernel matrix, mainly
used in kernel algorithms where columns of the kernel matrix are
computed per invocation
rbfkernel <- rbfdot(sigma = 0.1)
rbfkernel
#> new("rbfkernel", .Data = function (x, y = NULL)
#> {
#> if (!is(x, "vector"))
#> stop("x must be a vector")
#> if (!is(y, "vector") && !is.null(y))
#> stop("y must a vector")
#> if (is(x, "vector") && is.null(y)) {
#> return(1)
#> }
#> if (is(x, "vector") && is(y, "vector")) {
#> if (!length(x) == length(y))
#> stop("number of dimension must be the same on both data points")
#> return(exp(sigma * (2 * crossprod(x, y) - crossprod(x) -
#> crossprod(y))))
#> }
#> }, kpar = list(sigma = 0.1))
#> <bytecode: 0x564204d155f8>
#> <environment: 0x56420837f330>
#> attr(,"kpar")
#> attr(,"kpar")$sigma
#> [1] 0.1
#>
#> attr(,"class")
#> [1] "rbfkernel"
#> attr(,"class")attr(,"package")
#> [1] "kernlab"
is(rbfkernel)
#> [1] "rbfkernel" "kernel" "function" "OptionalFunction"
#> [5] "PossibleMethod" "kfunction"
kpar(rbfkernel)
#> $sigma
#> [1] 0.1
#>