Table of Contents

Class SVMSGD

Namespace
OpenCvSharp.ML
Assembly
OpenCvSharp.dll

Stochastic Gradient Descent SVM classifier

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

Properties

InitialStepSize

Parameter initialStepSize of a %SVMSGD optimization problem.

public float InitialStepSize { get; set; }

Property Value

float

MarginRegularization

Parameter marginRegularization of a %SVMSGD optimization problem.

public float MarginRegularization { get; set; }

Property Value

float

MarginType

Margin type, one of SVMSGD::MarginType.

public SVMSGD.MarginTypes MarginType { get; set; }

Property Value

SVMSGD.MarginTypes

StepDecreasingPower

Parameter stepDecreasingPower of a %SVMSGD optimization problem.

public float StepDecreasingPower { get; set; }

Property Value

float

SvmsgdType

Algorithm type, one of SVMSGD::SvmsgdType.

public SVMSGD.SvmsgdTypes SvmsgdType { get; set; }

Property Value

SVMSGD.SvmsgdTypes

TermCriteria

Termination criteria of the training algorithm. You can specify the maximum number of iterations (maxCount) and/or how much the error could change between the iterations to make the algorithm continue (epsilon).

public TermCriteria TermCriteria { get; set; }

Property Value

TermCriteria

Methods

Create()

Creates empty model. Use StatModel::Train to train the model. Since %SVMSGD has several parameters, you may want to find the best parameters for your problem or use SetOptimalParameters to set some default parameters.

public static SVMSGD Create()

Returns

SVMSGD

GetShift()

Returns the shift of the trained model (decision function f(x) = weights * x + shift).

public float GetShift()

Returns

float

GetWeights()

Returns the weights of the trained model (decision function f(x) = weights * x + shift).

public Mat GetWeights()

Returns

Mat

Load(string)

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

public static SVMSGD Load(string filePath)

Parameters

filePath string

Returns

SVMSGD

LoadFromString(string)

Loads algorithm from a String.

public static SVMSGD LoadFromString(string strModel)

Parameters

strModel string

The string variable containing the model you want to load.

Returns

SVMSGD

SetOptimalParameters(SvmsgdTypes, MarginTypes)

Function sets optimal parameters values for chosen SVM SGD model.

public void SetOptimalParameters(SVMSGD.SvmsgdTypes svmsgdType = SvmsgdTypes.Asgd, SVMSGD.MarginTypes marginType = MarginTypes.SoftMargin)

Parameters

svmsgdType SVMSGD.SvmsgdTypes

is the type of SVMSGD classifier.

marginType SVMSGD.MarginTypes

is the type of margin constraint.