F_VN_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.
Syntax
Definition:
FUNCTION F_VN_CreateSvmModel : HRESULT
VAR_INPUT
ipMlModel : Reference To ITcVnMlModel;
eSvmType : ETcVnSvm;
fC : LREAL;
fNu : LREAL;
fP : LREAL;
eKernelType : ETcVnSvmKernelType;
fGamma : LREAL;
fCoef0 : LREAL;
fDegree : LREAL;
hrPrev : HRESULT;
END_VAR
Inputs
|
Name |
Type |
Description |
|---|---|---|
|
ipMlModel |
Reference To ITcVnMlModel |
Returns the created model (Non-zero interface pointers are reused.) |
|
eSvmType |
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 |
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) |
|
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function F_VN_CreateSvmModel creates a Support Vector Machine (SVM) model.
Support Vector Machine models
Support Vector Machines can also be used for sophisticated non-linear problems. The prediction is based exclusively on the so-called support vectors, which is why SVM models are comparatively memory-efficient. All samples are required for training at the same time (batch training) and post-training is not possible.
Parameter
Model
The created model is returned in the interface pointer ipMlModel.
Model type
eSvmType specifies whether the SVM model is used for classification, regression or anomaly detection:
- TCVN_SVM_C_CLASSIFIER
- TCVN_SVM_NU_CLASSIFIER
- TCVN_SVM_NOVELTY_DETECTOR
- TCVN_SVM_EPS_REGRESSOR
- TCVN_SVM_NU_REGRESSOR
Model parameters
The use and meaning of the parameters fC, fNu and fP depends on the selected eSvmType.
Kernel type
The kernel type used for the calculation is defined with eKernelType. The kernel type depends on the task / data distribution and must be adapted accordingly.
Kernel parameters
The use and meaning of the parameters fGamma, fCoef0 and fDegree depends on the selected eKernelType.
Expert parameters
The expert variants F_VN_CreateSvmModelExp and F_VN_CreateSvmModelExp2 contain additional parameters.
Application
For example, an SVM model for classification can be created like this:
hr := F_VN_CreateSvmModel(
ipMlModel := ipMlModel,
eSvmType := TCVN_SVM_NU_CLASSIFIER,
fC := 0,
fNu := 0.1,
fP := 0,
eKernelType := TCVN_SKT_RBF,
fGamma := 1,
fCoef0 := 0,
fDegree := 0,
hrPrev := hr);Required License
TC3 Machine Learning Realtime Inference
Return value