[R] svm works but tune.svm give error

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Jul 19 23:03:20 CEST 2009



Noah Silverman wrote:
> Hello,
> 
> I'm using the e1071 library for SVM functions.
> 
> I can quickly train an SVM with:
> svm(formula = label ~ ., data = testdata)
> 
> That works well.
> 
> I want to tune the parameters, so I tried:
> 
> tune.svm(label ~ ., data=testdata[1:2000, ], gamma=10^(-6:3), cost=10^(1:2))
> 
> THIS FAILS WITH AN ERROR:
> 'names' attribute [199] must be the same length as the vector [184]
> 
> I don't understand why this is happening.  


We do not know, since you forgot to specify a reproducible example.
Anyway, is label in your workspace and/or in the "testdata"?

Uwe Ligges


> Presumably, if the data is 
> correct for training an SVM, then it should also be correct for the 
> tune.svm function.
> 
> Can anyone help me solve this one?
> 
> Thanks!
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list