[R] kernlab/ ksvm: class.weights & prob.model in binary classification

Dominik Gallus gallus at fzi.de
Tue Oct 30 17:15:18 CET 2007


Hello list,

I am faced with a two-class classification problem with highly asymetric
class sizes (class one: 99%, class two: 1%). 
I'd like to obtain a class probability model, also introducing available
information on the class prior.

Calling kernlab/ksvm with the line 

>
ksvm_model1<-ksvm(as.matrix(slides), as.factor(Class), class.weights= c("0"
=99, "1" =1), prob.model=T)
>
or 
>
ksvm_model1<-ksvm(as.matrix(slides), as.factor(Class), class.weights=wts,
prob.model=T)
>
with the named vector wts
 0  1 
99  1 

I get the following output:

>
Using automatic sigma estimation (sigest) for RBF or laplace kernel 
Error in inherits(x, "factor") : only 0's may be mixed with negative
subscripts
In addition: Warning message:
Variable(s) `' constant. Cannot scale data. in: .local(x, ...) 
>

My data is a balanced set of 2500 examples, most of the 65 features are
binary with some real numbers in between.

I am using kernlab in version 0.9-5. 

Best regards, 
Dominik Gallus

--



More information about the R-help mailing list