Lately I've worked with kernlab
library in R-statistical software. In specific, I use the ksvm
function to identify patterns. I'm trying to implement a new kernel in SVM, my code is:
<gnndot<-function (sigma = 1, degree=2)
{
rval <- function(x, y = NULL) {
return(exp(-sigma * ( sqrt(-(round(2 * crossprod(x, y) - crossprod(x) - crossprod(y), 9)))^degree ) ))
}
}
library(mvtnorm)
library(kernlab)
x <- rmvnorm(n=500, mean=c(1,1.5,2,2.5,3), sigma=diag(5))
class<-rep(c("ONE","TWO","THREE","FOUR","FIVE"),each=100)
ksvm(x,class,type="C-svc",kernel ="gnndot",kpar=list(sigma=0.05,degree=1.5),C=600,cross=5)>
The result that I got is: Error in match.arg(kernel, c("rbfdot", "polydot", "tanhdot", "vanilladot", : 'arg' should be one of “rbfdot”, “polydot”, “tanhdot”, “vanilladot”, “laplacedot”, “besseldot”, “anovadot”, “splinedot”, “matrix”
This is, I must define this "user-defined" kernel as one of the already designed kernels. Is it possible to use the kernel here defined (gnndot
) as one usable by the function ksvm
?