[R] Only one class shown in SVM plot?

Meffy matthias.eder at dlr.de
Thu Jul 26 15:00:27 CEST 2012

Ok, here a simple example. The file 
http://r.789695.n4.nabble.com/file/n4637924/test.csv test.csv  has 400 lines
containing 20 columns (1. column is class label, the other 19 are the
So what I'm doing is
data <- read.csv(file="test.csv", head=F, sep=",")

names(data) <- c("Class","V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8",
"V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18", "V19")

model <- svm(as.factor(Class)~., data=data, kernel="linear")

This gives me the result

   SVM-Type:  C-classification 
 SVM-Kernel:  linear 
       cost:  1 
      gamma:  0.05263158 

Number of Support Vectors:  5
When plotting this with

plot(model, data, V2~V1)

I'm getting
Where am I wrong here??

View this message in context: http://r.789695.n4.nabble.com/Only-one-class-shown-in-SVM-plot-tp4637782p4637924.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list