[R] Data format for KSVM

Noah Silverman noah at smartmediacorp.com
Fri Oct 23 20:54:04 CEST 2009


I have a process using svm from the e1071 library.  it works.

I want to try using the KSVM library instead.  The same data used wiht 
e1071 gives me an error with KSVM.

My data is a data.frame.

sample code:

svm_formula <- formula(y ~ a + B + C)

svm_model <- ksvm(formula, data=train_data, type="C-svc", 
kernel="rbfdot", C=1)

I get the following error:

"object is not a matrix"

So I tried this:

svm_model <- ksvm(formula, data=as.matrix(train_data), type="C-svc", 
kernel="rbfdot", C=1, scaled=FALSE)

Now I get this error:
"Error in model.fram.definition(data = list(v1 = c(1.1234, -2.3232:
Object is not a matrix

My data was previously scaled with the scale() function so that the mean 
is centered at 0. and the range is {-1,1}

Can anyone provide some suggestions as to why I'm getting an error?



More information about the R-help mailing list