MATLAB File Help: cv.SVM Index
cv.SVM

Support Vector Machines

Support Vector Machines

Originally, support vector machines (SVM) was a technique for building an optimal binary (2-class) classifier. Later the technique was extended to regression and clustering problems. SVM is a partial case of kernel-based methods. It maps feature vectors into a higher-dimensional space using a kernel function and builds an optimal linear discriminating function in this space or an optimal hyper-plane that fits into the training data. In case of SVM, the kernel is not defined explicitly. Instead, a distance between any 2 points in the hyper-space needs to be defined.

The solution is optimal, which means that the margin between the separating hyper-plane and the nearest feature vectors from both classes (in case of 2-class classifier) is maximal. The feature vectors that are the closest to the hyper-plane are called support vectors, which means that the position of other vectors does not affect the hyper-plane (the decision function).

SVM implementation in OpenCV is based on [LibSVM].

cv.SVM implements the "one-against-one" approach for multi-class classification. If N is the number of classes, then N*(N-1)/2 classifiers are constructed, each one trained with data from two classes for every pair of distinct classes (N choose 2).

References

[LibSVM]:

C.-C. Chang and C.-J. Lin. "LIBSVM: a library for support vector machines", ACM Transactions on Intelligent Systems and Technology, 2:27:1-27:27, 2011. (http://www.csie.ntu.edu.tw/~cjlin/papers/libsvm.pdf)

[Burges98]:

C. Burges. "A tutorial on support vector machines for pattern recognition", Knowledge Discovery and Data Mining 2(2), 1998 (http://citeseer.ist.psu.edu/burges98tutorial.html)

See also
Class Details
Superclasses handle
Sealed false
Construct on load false
Constructor Summary
SVM Creates/trains a new SVM instance 
Property Summary
C Parameter `C` of a SVM optimization problem. 
ClassWeights Optional weights in the 'C_SVC' problem, assigned to particular 
Coef0 Parameter `coef0` of a kernel function. 
Degree Parameter `degree` of a kernel function. 
Gamma Parameter `gamma` of a kernel function. 
KernelType Type of a SVM kernel. 
Nu Parameter `nu` of a SVM optimization problem. 
P arameter `epsilon` of a SVM optimization problem. 
TermCriteria Termination criteria. 
Type of a SVM formulation. 
id Object ID 
Method Summary
  addlistener Add listener for event. 
  calcError Computes error on the training or test dataset 
  clear Clears the algorithm state 
  delete Destructor 
  empty Returns true if the algorithm is empty 
  eq == (EQ) Test handle equality. 
  findobj Find objects matching specified conditions. 
  findprop Find property of MATLAB handle object. 
  ge >= (GE) Greater than or equal relation for handles. 
  getDecisionFunction Retrieves the decision function 
  getDefaultName Returns the algorithm string identifier 
  getSupportVectors Retrieves all the support vectors 
  getUncompressedSupportVectors Retrieves all the uncompressed support vectors of a linear SVM 
  getVarCount Returns the number of variables in training samples 
  gt > (GT) Greater than relation for handles. 
  isClassifier Returns true if the model is a classifier 
  isTrained Returns true if the model is trained 
Sealed   isvalid Test handle validity. 
  le <= (LE) Less than or equal relation for handles. 
  load Loads algorithm from a file or a string 
  lt < (LT) Less than relation for handles. 
  ne ~= (NE) Not equal relation for handles. 
  notify Notify listeners of event. 
  predict Predicts response(s) for the provided sample(s) 
  save Saves the algorithm parameters to a file or a string 
  setCustomKernel Initialize with custom kernel 
  train Trains the statistical model 
  trainAuto Trains an SVM with optimal parameters