F_VN_CreateSvmModelExp

F_VN_CreateSvmModelExp 1:

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. (expert function)

Syntax

Definition:

FUNCTION F_VN_CreateSvmModelExp : HRESULT
VAR_INPUT
    ipMlModel      : Reference To ITcVnMlModel;
    eSvmType       : ETcVnSvm;
    fC             : LREAL;
    fNu            : LREAL;
    fP             : LREAL;
    eKernelType    : ETcVnSvmKernelType;
    fGamma         : LREAL;
    fCoef0         : LREAL;
    fDegree        : LREAL;
    nMaxIterations : UDINT;
    fEpsilon       : LREAL;
    hrPrev         : HRESULT;
END_VAR

F_VN_CreateSvmModelExp 2: Inputs

Name

Type

Description

ipMlModel

Reference To ITcVnMlModel

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

eSvmType

ETcVnSvm

SVM model type

fC

LREAL

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

fNu

LREAL

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

fP

LREAL

Parameter p (required for TCVN_SVM_EPS_REGRESSOR; ignored otherwise)

eKernelType

ETcVnSvmKernelType

Kernel type

fGamma

LREAL

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

fCoef0

LREAL

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

fDegree

LREAL

Degree (used by polynomial kernels; ignored otherwise)

nMaxIterations

UDINT

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

LREAL

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)

hrPrev

HRESULT

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

F_VN_CreateSvmModelExp 3: Return value

HRESULT

Weiterführende Informationen

Die Funktion F_VN_CreateSvmModelExp ist eine Expert-Variante von F_VN_CreateSvmModel. Sie enthält zusätzliche Parameter.

Parameter

Modell

In dem Interface Pointer ipMlModel wird das erstellte Modell zurückgegeben.

Modell-Typ

eSvmType legt fest, ob das SVM-Modell zur Klassifizierung, zur Regression oder zur Anomalie-Detektion genutzt wird:

  • TCVN_SVM_C_CLASSIFIER
  • TCVN_SVM_NU_CLASSIFIER
  • TCVN_SVM_NOVELTY_DETECTOR
  • TCVN_SVM_EPS_REGRESSOR
  • TCVN_SVM_NU_REGRESSOR

Modell-Parameter

Die Verwendung und Bedeutung der Parameter fC, fNu und fP hängt vom ausgewähltem eSvmType ab.

Kernel-Typ

Mit eKernelType wird der verwendete Kernel-Typ zur Berechnung festgelegt. Der Kernel-Typ hängt von der Aufgabenstellung / Datenverteilung ab und muss daran angepasst werden.

Kernel-Parameter

Die Verwendung und Bedeutung der Parameter fGamma, fCoef0 und fDegree hängt vom ausgewähltem eKernelType ab.

Maximale Iterationen

Für die Optimierung werden maximal so viele Iterationen genutzt, wie in nMaxIterations angegeben sind. Wenn der Wert 0 ist, wird der jeweilige Default-Wert verwendet.

Abbruchgrenze

Die Optimierung wird abgebrochen, sobald sich der Fehler zwischen zwei Iterationen nicht stärker verändert, als in fEpsilon angegeben ist. Wenn der Wert 0 ist, wird der jeweilige Default-Wert verwendet.

Anwendung

Ein SVM-Modell zur Klassifikation kann z.B. so erstellt werden:

hr := F_VN_CreateSvmModelExp(
    ipMlModel       := ipMlModel,
    eSvmType        := TCVN_SVM_NU_CLASSIFIER,
    fC              := 0,
    fNu             := 0.1,
    fP              := 0,
    eKernelType     := TCVN_SKT_RBF,
    fGamma          := 1,
    fCoef0          := 0,
    fDegree         := 0,
    nMaxIterations  := 0,
    fEpsilon        := 0,
    hrPrev          := hr);

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