MCPcopy Create free account
hub / github.com/scikit-learn/scikit-learn / LinearSVC

Class LinearSVC

sklearn/svm/_classes.py:44–364  ·  view source on GitHub ↗

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. The main

Source from the content-addressed store, hash-verified

42
43
44class LinearSVC(LinearClassifierMixin, SparseCoefMixin, BaseEstimator):
45 """Linear Support Vector Classification.
46
47 Similar to SVC with parameter kernel='linear', but implemented in terms of
48 liblinear rather than libsvm, so it has more flexibility in the choice of
49 penalties and loss functions and should scale better to large numbers of
50 samples.
51
52 The main differences between :class:`~sklearn.svm.LinearSVC` and
53 :class:`~sklearn.svm.SVC` lie in the loss function used by default, and in
54 the handling of intercept regularization between those two implementations.
55
56 This class supports both dense and sparse input and the multiclass support
57 is handled according to a one-vs-the-rest scheme.
58
59 Read more in the :ref:`User Guide <svm_classification>`.
60
61 Parameters
62 ----------
63 penalty : {'l1', 'l2'}, default='l2'
64 Specifies the norm used in the penalization. The 'l2'
65 penalty is the standard used in SVC. The 'l1' leads to ``coef_``
66 vectors that are sparse.
67
68 loss : {'hinge', 'squared_hinge'}, default='squared_hinge'
69 Specifies the loss function. 'hinge' is the standard SVM loss
70 (used e.g. by the SVC class) while 'squared_hinge' is the
71 square of the hinge loss. The combination of ``penalty='l1'``
72 and ``loss='hinge'`` is not supported.
73
74 dual : "auto" or bool, default="auto"
75 Select the algorithm to either solve the dual or primal
76 optimization problem. Prefer dual=False when n_samples > n_features.
77 `dual="auto"` will choose the value of the parameter automatically,
78 based on the values of `n_samples`, `n_features`, `loss`, `multi_class`
79 and `penalty`. If `n_samples` < `n_features` and optimizer supports
80 chosen `loss`, `multi_class` and `penalty`, then dual will be set to True,
81 otherwise it will be set to False.
82
83 .. versionchanged:: 1.3
84 The `"auto"` option is added in version 1.3 and will be the default
85 in version 1.5.
86
87 tol : float, default=1e-4
88 Tolerance for stopping criteria.
89
90 C : float, default=1.0
91 Regularization parameter. The strength of the regularization is
92 inversely proportional to C. Must be strictly positive.
93 For an intuitive visualization of the effects of scaling
94 the regularization parameter C, see
95 :ref:`sphx_glr_auto_examples_svm_plot_svm_scale_c.py`.
96
97 multi_class : {'ovr', 'crammer_singer'}, default='ovr'
98 Determines the multi-class strategy if `y` contains more than
99 two classes.
100 ``"ovr"`` trains n_classes one-vs-rest classifiers, while
101 ``"crammer_singer"`` optimizes a joint objective over all classes.

Callers 15

_get_estimatorMethod · 0.90
test_groups_supportFunction · 0.90
test_grid_search_groupsFunction · 0.90
test_classes__propertyFunction · 0.90
test_grid_search_errorFunction · 0.90
test_grid_search_sparseFunction · 0.90
refit_callableFunction · 0.90
test_refit_callableFunction · 0.90

Calls 2

StrOptionsClass · 0.90
IntervalClass · 0.90

Used in the wild real call sites across dependent graphs

searching dependent graphs…