C-Support Vector Classification. The implementation is based on libsvm. The fit time scales at least quadratically with the number of samples and may be impractical beyond tens of thousands of samples. For large datasets consider using :class:`~sklearn.svm.LinearSVC` or :class:`
| 621 | |
| 622 | |
| 623 | class SVC(BaseSVC): |
| 624 | """C-Support Vector Classification. |
| 625 | |
| 626 | The implementation is based on libsvm. The fit time scales at least |
| 627 | quadratically with the number of samples and may be impractical |
| 628 | beyond tens of thousands of samples. For large datasets |
| 629 | consider using :class:`~sklearn.svm.LinearSVC` or |
| 630 | :class:`~sklearn.linear_model.SGDClassifier` instead, possibly after a |
| 631 | :class:`~sklearn.kernel_approximation.Nystroem` transformer or |
| 632 | other :ref:`kernel_approximation`. |
| 633 | |
| 634 | The multiclass support is handled according to a one-vs-one scheme. |
| 635 | |
| 636 | For details on the precise mathematical formulation of the provided |
| 637 | kernel functions and how `gamma`, `coef0` and `degree` affect each |
| 638 | other, see the corresponding section in the narrative documentation: |
| 639 | :ref:`svm_kernels`. |
| 640 | |
| 641 | To learn how to tune SVC's hyperparameters, see the following example: |
| 642 | :ref:`sphx_glr_auto_examples_model_selection_plot_nested_cross_validation_iris.py` |
| 643 | |
| 644 | Read more in the :ref:`User Guide <svm_classification>`. |
| 645 | |
| 646 | Parameters |
| 647 | ---------- |
| 648 | C : float, default=1.0 |
| 649 | Regularization parameter. The strength of the regularization is |
| 650 | inversely proportional to C. Must be strictly positive. The penalty |
| 651 | is a squared l2 penalty. For an intuitive visualization of the effects |
| 652 | of scaling the regularization parameter C, see |
| 653 | :ref:`sphx_glr_auto_examples_svm_plot_svm_scale_c.py`. |
| 654 | |
| 655 | kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ |
| 656 | default='rbf' |
| 657 | Specifies the kernel type to be used in the algorithm. If |
| 658 | none is given, 'rbf' will be used. If a callable is given it is used to |
| 659 | pre-compute the kernel matrix from data matrices; that matrix should be |
| 660 | an array of shape ``(n_samples, n_samples)``. For an intuitive |
| 661 | visualization of different kernel types see |
| 662 | :ref:`sphx_glr_auto_examples_svm_plot_svm_kernels.py`. |
| 663 | |
| 664 | degree : int, default=3 |
| 665 | Degree of the polynomial kernel function ('poly'). |
| 666 | Must be non-negative. Ignored by all other kernels. |
| 667 | |
| 668 | gamma : {'scale', 'auto'} or float, default='scale' |
| 669 | Kernel coefficient for 'rbf', 'poly' and 'sigmoid'. |
| 670 | |
| 671 | - if ``gamma='scale'`` (default) is passed then it uses |
| 672 | 1 / (n_features * X.var()) as value of gamma, |
| 673 | - if 'auto', uses 1 / n_features |
| 674 | - if float, must be non-negative. |
| 675 | |
| 676 | .. versionchanged:: 0.22 |
| 677 | The default value of ``gamma`` changed from 'auto' to 'scale'. |
| 678 | |
| 679 | coef0 : float, default=0.0 |
| 680 | Independent term in kernel function. |
no outgoing calls