kpol | R Documentation |
Functions building the Gram matrix for different kernels (e.g. Scholkopf & Smola 2002).
The user can build any other ad'hoc kernel function.
kpol(X, Y = NULL, degree = 1, scale = 1, offset = 0)
krbf(X, Y = NULL, sigma = 1)
ktanh(X, Y = NULL, scale = 1, offset = 0)
X |
A |
Y |
Optional (default to |
degree |
See the code. |
scale |
See the code. |
offset |
See the code. |
sigma |
See the code. |
If Y = NULL
, the function returns the n x n
Gram matrix k(X, X)
. If not, the function returns the m x n
Gram matrix k(Y, X)
.
A function.
Scholkopf, B., Smola, A.J., 2002. Learning with kernels: support vector machines, regularization, optimization, and beyond, Adaptive computation and machine learning. MIT Press, Cambridge, Mass.
n <- 5
p <- 4
m <- 2
set.seed(1)
X <- matrix(rnorm(n * p, mean = 10), ncol = p)
Xu <- matrix(rnorm(m * p, mean = 10), ncol = p)
set.seed(NULL)
kpol(X, degree = 2)
kpol(Xu, X, degree = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.