8
$\begingroup$

What are the differences between SVC, NuSVC, and LinearSVC?

Please shed some light.

$\endgroup$

1 Answer 1

7
$\begingroup$

In scikit SVC and nuSVC are mathematically equivalent with both methods based on the library libsvm. The main difference is that SVC uses the parameter C while nuSVC uses the parameter nu.

LinearSVC is based on the library liblinear. As the documentation says, LinearSVC is similar to SVC with parameter kernel='linear', but liblinear offers more penalties and loss functions in order to scale better with large numbers of samples. Please check out this question and this question for more details.

$\endgroup$
3
  • 1
    $\begingroup$ But why does it give different results for NuSVC and ```SVC`` on same data`? $\endgroup$
    – Deshwal
    Dec 18, 2019 at 12:07
  • $\begingroup$ @Deshwal It's difficult to say without seeing the code. My guess would be that the parameters used in each case are not equivalent. Apparently the reparametrization is "not that easy to calculate" according to this answer that references this paper. $\endgroup$ Dec 18, 2019 at 18:02
  • $\begingroup$ It is explained in the user guide. NuSVC's v parameter serves as both "to upper bound the fraction of margin errors and a lower bound of the fraction of support vectors." I interpret it as e.g. at most 2% margin error allowed, and at least 2% examples to use as support vectors. $\endgroup$
    – Shern
    May 28, 2020 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.