Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between SVC and SVM in scikit-learn?

From the documentation scikit-learn implements SVC, NuSVC and LinearSVC which are classes capable of performing multi-class classification on a dataset. By the other hand I also read about that scikit learn also uses libsvm for support vector machine algorithm. I'm a bit confused about what's the difference between SVC and libsvm versions, by now I guess the difference is that SVC is the support vector machine algorithm fot the multiclass problem and libsvm is for the binary class problem. Could anybody help me to understad the difference between this?.

like image 707
tumbleweed Avatar asked Jan 12 '15 23:01

tumbleweed


People also ask

What is the difference between SVM and SVC?

The limitation of SVC is compensated by SVM non-linearly. And that's the difference between SVM and SVC. If the hyperplane classifies the dataset linearly then the algorithm we call it as SVC and the algorithm that separates the dataset by non-linear approach then we call it as SVM.

What is SVC and SVM Sklearn?

It is C-support vector classification whose implementation is based on libsvm. The module used by scikit-learn is sklearn. svm. SVC. This class handles the multiclass support according to one-vs-one scheme.

Is SVM and linear SVC same?

LinearSVC. Linear Support Vector Classification. Similar to SVC with parameter kernel='linear', but implemented in terms of liblinear rather than libsvm, so it has more flexibility in the choice of penalties and loss functions and should scale better to large numbers of samples.

What does SVC stand for SVM?

What is SVM? Support vector machines so called as SVM is a supervised learning algorithm which can be used for classification and regression problems as support vector classification (SVC) and support vector regression (SVR).


2 Answers

They are just different implementations of the same algorithm. The SVM module (SVC, NuSVC, etc) is a wrapper around the libsvm library and supports different kernels while LinearSVC is based on liblinear and only supports a linear kernel. So:

SVC(kernel = 'linear') 

is in theory "equivalent" to:

LinearSVC() 

Because the implementations are different in practice you will get different results, the most important ones being that LinearSVC only supports a linear kernel, is faster and can scale a lot better.

like image 193
elyase Avatar answered Oct 03 '22 22:10

elyase


This is a snapshot from the book - Hands-on Machine Learning

This is a snapshot from the book - Hands-on Machine Learning

I hope you may find it useful.

like image 36
nickz Avatar answered Oct 03 '22 21:10

nickz