[R] one-class SVM in kernlab
Roberto Perdisci
roberto.perdisci at gmail.com
Wed Sep 12 18:50:07 CEST 2007
Hello,
I'm trying to using ksvm() in the kernlab package to fit a one-class
SVC, but I get a strage result on the cross-validation error estimate.
For example, consider this code:
data(spam)
classifier <- ksvm(type~.,data=spam[which(spam[,'type']=='spam'),],
type="one-svc",kernel="rbfdot",kpar=list(sigma=0.1),nu=0.05,cross=10)
what I get is:
> classifier
Support Vector Machine object of class "ksvm"
SV type: one-svc (novelty detection)
parameter : nu = 0.05
Gaussian Radial Basis kernel function.
Hyperparameter : sigma = 0.1
Number of Support Vectors : 660
Objective Function Value : 10.5781
Training error : 0.212907
Cross validation error : 0
---
What surprises me is that the Training error (which I suppose is the
resubstitution error) is higher than the cross-validation error. Also,
even changing the value of sigma, the cross-validation error does not
change.
I get similar results with other datasets, too. For example
classifier <- ksvm(Species~.,data=iris[which(iris[,'Species']=='setosa'),],
type="one-svc",kernel="rbfdot",kpar=list(sigma=0.5),nu=0.05,cross=10)
Am I using ksvm() correctly?
I also tried to use the formula ~. exluding the attribute 'type' from
the dataset, and the results are exactly the same.
Unfortunately reading ?ksvm didn't help me much.
thank you,
regards,
Roberto
More information about the R-help
mailing list