Support Vector Classifier

../../../../_images/svm1.svg

Support vector machine (SVM) based classifier

Documentation

Support Vector Machines (SVMs) are powerful supervised learning models used for

classification and regression tasks. They work by finding the optimal hyperplane that separates classes in the feature space with the maximum margin.

The advantages of support vector machines are:
  • Effective in high dimensional spaces.

  • Still effective in cases where number of dimensions is greater than the number of samples.

  • Uses a subset of training points in the decision function (called support vectors), so it is also memory efficient.

  • Versatile: different Kernel functions can be specified for the decision function.

The disadvantages of support vector machines include:
  • If the number of features is much greater than the number of samples, avoid over-fitting in choosing Kernel functions and regularization term is crucial.

  • SVMs do not directly provide probability estimates, these are calculated using an expensive five-fold cross-validation.

Attributes

coef_

Weights assigned to the features (coefficients in the primal problem). This is only available in the case of a linear kernel.

coef_ is a readonly property derived from dual_coef_ and support_vectors_.

dual_coef_

Dual coefficients of the support vector in the decision function (see sgd_mathematical_formulation), multiplied by their targets. For multiclass, coefficient for all 1-vs-1 classifiers. The layout of the coefficients in the multiclass case is somewhat non-trivial. See the multi-class section of the User Guide for details.

intercept_

Constants in decision function.

n_support_

Number of support vectors for each class.

support_

Indices of support vectors.

support_vectors_

Support vectors. An empty array if kernel is precomputed.

Definition

Output ports

model
Type: model
Description: Model

Configuration

Penalty parameter C (C)

Regularization parameter. The strength of the regularization is inversely proportional to C. Must be strictly positive. The penalty is a squared l2 penalty. For an intuitive visualization of the effects of scaling the regularization parameter C, see sphx_glr_auto_examples_svm_plot_svm_scale_c.py.

Class weight (class_weight)

Set the parameter C of class i to class_weight[i]*C for SVC. If not given, all classes are supposed to have weight one. The “balanced” mode uses the values of y to automatically adjust weights inversely proportional to class frequencies in the input data as n_samples / (n_classes * np.bincount(y)).

Independent kernel function term (coef0)

Independent term in kernel function. It is only significant in ‘poly’ and ‘sigmoid’.

Polynomial kernel degree (degree)

Degree of the polynomial kernel function (‘poly’). Must be non-negative. Ignored by all other kernels.

Kernel coefficient (gamma)

Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.

  • if gamma='scale' (default) is passed then it uses 1 / (n_features * X.var()) as value of gamma,

  • if ‘auto’, uses 1 / n_features

  • if float, must be non-negative.

Changed in version 0.22: The default value of gamma changed from ‘auto’ to ‘scale’.

Kernel (kernel)

Specifies the kernel type to be used in the algorithm. If none is given, ‘rbf’ will be used. If a callable is given it is used to pre-compute the kernel matrix from data matrices; that matrix should be an array of shape (n_samples, n_samples). For an intuitive visualization of different kernel types see sphx_glr_auto_examples_svm_plot_svm_kernels.py.

Hard iteration limit (max_iter)

Hard limit on iterations within solver, or -1 for no limit.

Enable probability estimates (probability)

Whether to enable probability estimates. This must be enabled prior to calling fit, will slow down that method as it internally uses 5-fold cross-validation, and predict_proba may be inconsistent with predict. Read more in the User Guide <scores_probabilities>.

Random seed (random_state)

Controls the pseudo random number generation for shuffling the data for probability estimates. Ignored when probability is False. Pass an int for reproducible output across multiple function calls. See random_state.

Use shrinking heuristic (shrinking)

Whether to use the shrinking heuristic. See the User Guide <shrinking_svm>.

Tolerance (tol)

Tolerance for stopping criterion.

Examples

The node can be found in:

Implementation

class node_svc.SupportVectorClassifier[source]