Table of Contents

Class SVM

Namespace
OpenCvSharp.ML
Assembly
OpenCvSharp.dll

Support Vector Machines

public class SVM : StatModel, IDisposable
Inheritance
SVM
Implements
Inherited Members

Properties

C

Parameter C of a %SVM optimization problem. For SVM::C_SVC, SVM::EPS_SVR or SVM::NU_SVR. Default value is 0.

ClassWeights

Optional weights in the SVM::C_SVC problem, assigned to particular classes.

Coef0

Parameter coef0 of a kernel function. For SVM::POLY or SVM::SIGMOID. Default value is 0.

Degree

Parameter degree of a kernel function. For SVM::POLY. Default value is 0.

Gamma

Parameter gamma of a kernel function. For SVM::POLY, SVM::RBF, SVM::SIGMOID or SVM::CHI2. Default value is 1.

KernelType

Type of a %SVM kernel. See SVM::KernelTypes. Default value is SVM::RBF.

Nu

Parameter nu of a %SVM optimization problem. For SVM::NU_SVC, SVM::ONE_CLASS or SVM::NU_SVR. Default value is 0.

P

Parameter epsilon of a %SVM optimization problem. For SVM::EPS_SVR. Default value is 0.

TermCriteria

Termination criteria of the iterative SVM training procedure which solves a partial case of constrained quadratic optimization problem.

Type

Type of a %SVM formulation. Default value is SVM::C_SVC.

Methods

Create()

Creates empty model. Use StatModel::Train to train the model. Since %SVM has several parameters, you may want to find the best parameters for your problem, it can be done with SVM::TrainAuto.

GetDecisionFunction(int, OutputArray, OutputArray)

Retrieves the decision function

GetDefaultGrid(ParamTypes)

Generates a grid for SVM parameters.

GetSupportVectors()

Retrieves all the support vectors

Load(string)

Loads and creates a serialized svm from a file. Use SVM::save to serialize and store an SVM to disk. Load the SVM from this file again, by calling this function with the path to the file.

LoadFromString(string)

Loads algorithm from a String.

TrainAuto(TrainData, int, ParamGrid?, ParamGrid?, ParamGrid?, ParamGrid?, ParamGrid?, ParamGrid?, bool)

Trains an %SVM with optimal parameters.