Does the one class SVM ignore training labels automatically?

asked 2015-08-03 02:04:52 -0500

jackbrucesimspon gravatar image

If I'm using CVSVM::ONE_CLASS, will the program just ignore the Mat containing my training labels? I have different classes in my data but there's also outliers which I cannot classify and I'd like my first SVM just try to determine if I can classify they data or if it's an outlier. Does this sound like the kind of thing a one class SVM is good for? I was also wondering will the SVM will return 1 (is a class it recognises) or 0 (is an outlier) or will it return other values?

CvSVMParams params;
params.term_crit=cvTermCriteria(CV_TERMCRIT_ITER, 100000, 1e-6);

SVM.train(data, trainLabels, cv::Mat(), cv::Mat(), params);
edit retag flag offensive close merge delete


A one class SVM is mainly if you have only inliers and you want to know if test data is similar to that given training data set. More info here. You would need a 2 class binary SVM and add labeled versus non-labelled as two classes 1 and 0. That will make an SVM that is able to seperate inliers from outliers in your case.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-03 10:50:52 -0500 )edit

I was reading some articles where they were saying that a one class SVM was useful if you weren't just trying to separate out two things but had the things you wanted to identify plus everything else. If I use a one class SVM and then feed it new data what will be the result if I give it an inlier vs an outlier?

jackbrucesimspon gravatar imagejackbrucesimspon ( 2015-08-03 18:49:19 -0500 )edit

Could you reference those articles?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-04 07:17:06 -0500 )edit

Sure, something like this.

jackbrucesimspon gravatar imagejackbrucesimspon ( 2015-08-04 08:12:31 -0500 )edit

That link says exactly what I told you. It uses the samples of a single class to make a 2 class binary svm look a like as good as possible by trying to wrap the samples into an area covered by the hyperplane. But you have labels, unlabeled and different classes... so you can do it much better by using actual binary SVMs

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-04 08:56:44 -0500 )edit