[R] Svm formula

pedrosmarques at portugalmail.pt pedrosmarques at portugalmail.pt
Thu Jan 3 12:44:26 CET 2008



Hi all,

I don't know how to choose the formula to use when plotting an svm model, I think I'm using the wrong one and so that is why I'm having trouble. I should be very grateful if someone could help me on this.. 

> dados<-read.table("b.txt",sep="",nrows=30000)

> model<-svm(x=dados[,-1],y=dados[,1],scale=TRUE,type="C-classification",kernel="radial",cost=1,degree=3,gamma=0.083,coef0=0,nu=0.5,epsilon=0.1)
Warning message:
In svm.default(x = dados[, -1], y = dados[, 1], scale = TRUE, type = "C-classification",  :
  Variable(s) ‘V12’ and ‘V13’ constant. Cannot scale data.

> summary(model)

Call:
svm.default(x = dados[, -1], y = dados[, 1], scale = TRUE, type = "C-classification", 
    kernel = "radial", degree = 3, gamma = 0.083, coef0 = 0, cost = 1, 
    nu = 0.5, epsilon = 0.1)


Parameters:
   SVM-Type:  C-classification 
 SVM-Kernel:  radial 
       cost:  1 
      gamma:  0.083 

Number of Support Vectors:  19665

 ( 8284 7579 1327 943 510 875 147 )


Number of Classes:  7 

Levels: (as integer) 
 2 1 3 7 5 6 4

> class<-factor(dados[,1])

> plot(model, data= dados[,-1], formula= class~.,svSymbol = 1, dataSymbol = 2, symbolPalette = rainbow(4),color.palette = terrain.colors)
Error in Summary.factor(c(2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 1L,  : 
  min not meaningful for factors



Best regards,

Pedro Marques




More information about the R-help mailing list