---------- Forwarded message ----------
From: Vivek Dikshit <vivek.sspl@gmail.com>
Date: Tue, Apr 28, 2009 at 1:20 PM
Subject: kernlab - custom kernel
To: r-help@r-project.org
hi,
I am using R's "kernlab" package, exactly i am doing
classification using
ksvm(.) and predict.ksvm(.).I want use of custom kernel. I am getting some
error.
# Following R code works (with promotergene dataset):
library("kernlab")
s <- function(x, y) {
sum((x*y)^1.25)
}
class(s) <- "kernel"
data("promotergene")
gene <- ksvm(Class ~ ., data = promotergene,
kernel = s, C = 10, cross = 5)
gene
pred<-predict(gene, promotergene[c(6), -1])
# but the same code fails to work with iris dataset
library("kernlab")
s <- function(x, y) {
sum((x*y)^1.25)
}
class(s) <- "kernel"
gene <- ksvm(Species ~ ., data = iris,kernel = s, C = 10, cross = 5)
# above code gives the following error:
Error in votematrix[i, ret < 0] <- votematrix[i, ret < 0] + 1 :
NAs are not allowed in subscripted assignments
Thank you very much for your time and attention.
Sincerely,
Vivek
Banaras Hindu University,
India.
[[alternative HTML version deleted]]