HI

I am new to R.

I have one problem in the predict function of the kernlab.
I want to use ksvm and predict with  kernelmatrix (S4 method for signature 
'kernelMatrix')

#executing the following sentences 

library(kernlab)
# identity kernel

k <- function(x,y) {
 n<-length(x)
 cont<-0
  for(i in 1:n){
   
    if(x[i]==y[i]){
      cont<-cont+1
    }
  }
cont
}
class(k) <- "kernel"

data(promotergene) 
ind <- sample(1:dim(promotergene)[1],20) 
genetrain <- promotergene[-ind, -1]
genetest <- promotergene[ind,-1 ]

kx <- kernelMatrix(k, as.matrix(genetrain))
y<-as.vector(promotergene[-ind,1 ])
#y<-as.factor(promotergene[-ind,1 ])
y
gene1 <- ksvm(kx, y, type="C-svc")
gene1
genetype <- predict(gene1,genetest)
Error en as.matrix(Z) : objeto "Z" no encontrado

#genetest1<-as.matrix(genetest)
#genetype <- predict(gene1,genetest1)
genetype

thank you,
nelsonhernandez
[EMAIL PROTECTED]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to