-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Clarify the differences between LinearSVC and SVC #26812
Description
Describe the issue linked to the documentation
Currently the documentation for LinearSVC says that is "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".
This is confusing, because by default they are not equivalent. LinearSVC has a different default loss function and regularizes the intercept, as mentioned in these StackOverflow posts:
- https://stackoverflow.com/questions/45384185/what-is-the-difference-between-linearsvc-and-svckernel-linear
- https://stackoverflow.com/questions/35076586/when-should-one-use-linearsvc-or-svc
- https://stackoverflow.com/questions/33843981/under-what-parameters-are-svc-and-linearsvc-in-scikit-learn-equivalent
As a result, the current documentation can mislead and give result to research that does the wrong thing, as it almost happened to me.
Suggest a potential alternative/fix
A big red box with a warning should be at the beginning of the documentation for LinearSVC, describing the ways in which differs from SVC and that it is not a "true" linear SVM (because of the intercept regularization).
In the future, it would be desirable in my opinion to change the default values/implementation of LinearSVC so that both LinearSVC and SVC with parameter kernel="linear" solve the same optimization problem by default. Otherwise the risk of it leading to wrong research results is very big.