[R] About stringdot (ksvm)
Masanori Higashihara
m-higa at jaist.ac.jp
Tue May 23 14:20:06 CEST 2006
Hello R Helpers
I want to use string kernel by ksvm.
Is there an error in my operation?
1)dataset
test data
aaa 1
abb -1
bbb 1
2)operation
> library(kernlab)
> x<-c("aaa","abb","bbb")
> x
[1] "aaa" "abb" "bbb"
> class(x)
[1] "character"
> xl<-list(x)
> y<-c(1,-1,1)
> y
[1] 1 -1 1
> z<-list(x,y)
> z
[[1]]
[1] "aaa" "bab" "bbb"
[[2]]
[1] 1 -1 1
> s.svm<-ksvm(xl,kernel="stringdot",kpar=list(lambda=0.5))
Error in as.double.default(t(x)) : (list) object cannot be coerced to
'double'
> s.svm<-ksvm(z,kernel="stringdot",kpar=list(lambda=0.5))
Error in as.double.default(t(x)) : (list) object cannot be coerced to
'double'
-----------------------------------
Masanori Higashihara,
JAIST: Japan Advanced Institute of Science and Technology.
JAPAN.
More information about the R-help
mailing list