F_VN_CreateBoostClassifierExp2

F_VN_CreateBoostClassifierExp2 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_CreateBoostClassifierExp2 : HRESULT
VAR_INPUT
    ipMlModel        : Reference To ITcVnMlModel;
    eType            : ETcVnBoostClassifierType;
    nMaxDepth        : UDINT;
    nMinSamples      : UDINT;
    nWeakClassifiers : UDINT;
    fWeightTrimRate  : LREAL;
    ipClassPriors    : ITcVnContainer;
    hrPrev           : HRESULT;
END_VAR

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

ipClassPriors

ITcVnContainer

Class priors (ContainerType_Vector_REAL or ContainerType_Vector_LREAL; only for classifiers; optional, set to 0 if not required or not allowed; default: 0)

hrPrev

HRESULT

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

F_VN_CreateBoostClassifierExp2 3: Return value

HRESULT

Further information

The function F_VN_CreateBoostClassifierExp2 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.

Class-Priors

ipClassPriors is a container that can be used to specify the a priori probabilities of the individual classes.

Application

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

hr := F_VN_CreateBoostClassifierExp2(
    ipMlModel           := ipMlModel,
    eType               := TCVN_BCT_REAL,
    nMaxDepth           := 1,
    nMinSamples         := 10,
    nWeakClassifiers    := 100,
    fWeightTrimRate     := 0.95,
    ipClassPriors       := 0,
    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