[R] stringdot

Nair, Murlidharan T mnair at iusb.edu
Wed Jun 25 15:44:28 CEST 2008


I am trying to figure out how to use  the string kernel  "stringdot" in kernlab.

k <- function(x,y) {
  (sum(x*y) +1)*exp(-0.001*sum((x-y)^2))
class(k) <- "kernel"


## train svm using custom kernel

gene.k <- ksvm(Class~.,data=promotergene,kernel=k,C=10,cross=5) # works fine in this case

gene.rbf <- ksvm(Class~.,data=promotergene,kernel="rbfdot",C=10,cross=5)# works fine with the rbf kernel

gene.string <- ksvm(Class~.,data=promotergene,kernel="stringdot",C=10,cross=5) # this give the following error

#Error in match.arg(kernel, c("rbfdot", "polydot", "tanhdot", "vanilladot",  :
# 'arg' should be one of “rbfdot”, “polydot”, “tanhdot”, “vanilladot”, “laplacedot”, “besseldot”, “anovadot”, “splinedot”, “matrix”

What am I doing wrong here?

Thanks ../Murli

More information about the R-help mailing list