[R] different leave-one-out cross-validation results from tune.svm(...) and svm(...)

Wolfgang Meyer wolfgang.meyer at gmail.com
Tue Aug 16 14:23:48 CEST 2005


Hi, 

I am currently using the svm functions from R package e1071 (1.5-9). 
I use function tune.svm(...) to tune the parameters for SVM with RBF kernel.
To obtain reproducible tuning results, I chose leave-one-out cross-validation 
(LOOCV) as my perfomance measurement. 


>  tune.rlt <- tune.svm(classes~.,   data = data.frame(features, classes),
                                 gamma = 2^(-12:0),
                                 cost = 2^(0:12),
                                 tunecontrol = tune.control(cross =
length(cls)))

With this LOOCV scheme I obtained certain best performance with 
tuned parameters (gamma1, cost1). Let's assume the best error estimation 
in tune.rlt is E.

Then I trained a SVM with these parameters (gamma1 & cost1). 
I also ask it to return LOOCV results:

> svm.rlt <- svm(classes~.,   data = data.frame(features, classes),
                        gamma=gamma1, cost=cost1, 
                        cross=length(classes))

And I obtain LOOCV accuracy from svm.rlt, let's assume it is A. 

Unfortunately, it is usually the case that 

E+A < 100%
(it is not numerical error)

Since I used LOOCV as the perfomance measurement, I suppose 

E+A =100%

Why is this the case?

-- 
Wolfgang Meyer




More information about the R-help mailing list