F_VN_CreateBoostClassifierExp

F_VN_CreateBoostClassifierExp 1:

Create a Boost classifier. The initial reference count is set to one if a new model is created and kept, otherwise. The Boost classifier is only applicable to binary classification problems. It learns to distinguish between samples labelled with two user-defined class labels by incrementally adding weak classifiers to improve the classification results. Models of this type neither support on-line training (sample by sample) nor retraining. (expert function)

Syntax

Definition:

FUNCTION F_VN_CreateBoostClassifierExp : HRESULT
VAR_INPUT
    ipMlModel        : Reference To ITcVnMlModel;
    eType            : ETcVnBoostClassifierType;
    nMaxDepth        : UDINT;
    nMinSamples      : UDINT;
    nWeakClassifiers : UDINT;
    fWeightTrimRate  : LREAL;
    hrPrev           : HRESULT;
END_VAR

F_VN_CreateBoostClassifierExp 2: Inputs

Name

Type

Description

ipMlModel

Reference To ITcVnMlModel

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

eType

ETcVnBoostClassifierType

Learning algorithm type (default: TCVN_BCT_REAL)

nMaxDepth

UDINT

Maximum tree depth (default: 1)

nMinSamples

UDINT

Minimum number of samples within a node required for splitting (default: 10)

nWeakClassifiers

UDINT

Number of weak classifiers (default: 100)

fWeightTrimRate

LREAL

Weight threshold used during training (off: 0; default: 0.95).

hrPrev

HRESULT

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

F_VN_CreateBoostClassifierExp 3: Return value

HRESULT

Further information

The function F_VN_CreateBoostClassifierExp is an expert variant of F_VN_CreateBoostClassifier. It contains additional parameters.

Parameter

Model

The created model is returned in the interface pointer ipMlModel.

Learning technique

The learning algorithm can be selected via eType. Supported are: Discrete AdaBoost, Real AdaBoost, LogitBoost and Gentle AdaBoost.

Maximum tree depth

nMaxDepth indicates the maximum number of decision levels in a tree. Decision trees with a tree depth of 1 are usually used for boost classifiers. However, higher values are possible.

Minimum number of samples within a node

nMinSamples is the minimum number of samples that must remain in a node during tree formation. Splits that would fall below this number are not carried out.

Number of decision trees

nWeakClassifiers indicates the number of decision trees (weak learners) that are combined for the classifier by boosting.

Runtime optimization

With fWeightTrimRate, the number of samples used for the individual learning steps can be limited using their automatically determined weightings. Values in the interval from 0 to 1 are permitted, whereby only samples with weightings > 1 - fWeightTrimRate are taken into account in the following learning step. The value 0 disables this optimization.

Application

A boost classifier model can be created like this, for example:

hr := F_VN_CreateBoostClassifierExp(
    ipMlModel           := ipMlModel,
    eType               := TCVN_BCT_REAL,
    nMaxDepth           := 1,
    nMinSamples         := 10,
    nWeakClassifiers    := 100,
    fWeightTrimRate     := 0.95,
    hrPrev              := hr);

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