CreateSvmSgdClassifier

Create a linear SVM classifier using stochastic gradient descent for training. The initial reference count is set to one if a new model is created and kept, otherwise. This SVM classifier is only applicable to binary classification problems. It learns a separating hyperplane between a class with label -1 and a class with label 1. These class labels are predefined. For training, any positive class labels are mapped to 1 and any negative class labels are mapped to -1. Models of this type neither support on-line training (sample by sample) nor retraining.

Syntax

Definition:

HRESULT CreateSvmSgdClassifier(
    HRESULT                         hrPrev,
    ITcVnMlModel*&                  ipMlModel,
    ETcVnSvmSgdClassifierType       eType = SSCT_ASGD,
    ETcVnSvmSgdClassifierMarginType eMarginType = SSCMT_SOFT_MARGIN,
    float                           fMarginRegularization = 0.00001f,
    float                           fInitialStepSize = 0.05f,
    float                           fStepDecreasingPower = 0.75f,
    ULONG                           nMaxIterations = 0,
    double                          fEpsilon = 0.0
)

Parameters

Name

Type

Default

Description

hrPrev

HRESULT

 

HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.)

ipMlModel

ITcVnMlModel*&

 

Returns the created model (Non-zero interface pointers are reused.)

eType

ETcVnSvmSgdClassifierType

SSCT_ASGD

Learning algorithm type (default: TCVN_SSCT_ASGD)

eMarginType

ETcVnSvmSgdClassifierMarginType

SSCMT_SOFT_MARGIN

Margin type (default: TCVN_SSCMT_SOFT_MARGIN)

fMarginRegularization

float

0.00001f

Margin regularization parameter (default: 0.00001)

fInitialStepSize

float

0.05f

Initial step size (default: 0.05)

fStepDecreasingPower

float

0.75f

Power parameter (default: 0.75)

nMaxIterations

ULONG

0

Maximum number of iterations (disabled if it equals 0 and fEpsilon is different from 0.0; triggers the usage of the default value of 100000 if nMaxIterations and fEpsilon equal 0)

fEpsilon

double

0.0

Maximum allowed difference of the error between two successive iterations (disabled if it equals 0.0 and nMaxIterations is different from 0; triggers the usage of the default value of 0.00001 if nMaxIterations and fEpsilon equal 0)

CreateSvmSgdClassifier 1: Return value

HRESULT

Required License

TC3 Vision Machine Learning

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.54 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision