CreateSvmModel

Create an SVM model of the specified type. The initial reference count is set to one if a new model is created and kept, otherwise. Models of this type neither support on-line training (sample by sample) nor retraining. Predictions can only be scalar. (additional expert function for C support vector classifiers)

Syntax

Definition:

HRESULT CreateSvmModel(
    HRESULT            hrPrev,
    ITcVnMlModel*&     ipMlModel,
    ETcVnSvm           eSvmType,
    double             fC,
    double             fNu,
    double             fP,
    ETcVnSvmKernelType eKernelType,
    double             fGamma,
    double             fCoef0,
    double             fDegree,
    ULONG              nMaxIterations = 0,
    double             fEpsilon = 0.0,
    ITcVnContainer*    ipClassWeights = nullptr
)

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.)

eSvmType

ETcVnSvm

 

SVM model type

fC

double

 

Parameter C (required for TCVN_SVM_C_CLASSIFIER, TCVN_SVM_EPS_REGRESSOR, and TCVN_SVM_NU_REGRESSOR; ignored otherwise)

fNu

double

 

Parameter nu (required for TCVN_SVM_NU_CLASSIFIER, TCVN_SVM_NOVELTY_DETECTOR, and TCVN_SVM_NU_REGRESSOR; ignored otherwise)

fP

double

 

Parameter p (required for TCVN_SVM_EPS_REGRESSOR; ignored otherwise)

eKernelType

ETcVnSvmKernelType

 

Kernel type

fGamma

double

 

Parameter gamma (used by polynomial, RBF, sigmoid, and chi-squared kernels; ignored otherwise)

fCoef0

double

 

Parameter coef0 (used by polynomial and sigmoid kernels; ignored otherwise)

fDegree

double

 

Degree (used by polynomial kernels; ignored otherwise)

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)

ipClassWeights

ITcVnContainer*

nullptr

Class weights (ContainerType_Vector_REAL or ContainerType_Vector_LREAL; only valid if eSvmType equals TCVN_SVM_C_CLASSIFIER; optional, set to 0 if not required or not allowed; default: 0)

CreateSvmModel 1: Return value

HRESULT

Required License

TC3 Vision Machine Learning

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1. 4024.44 or later

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

Tc3_Vision