F_VN_GetFeatureScales

F_VN_GetFeatureScales 1:

Calculate the scaling parameters for each feature in the input samples based on the scaling type.

Syntax

Definition:

FUNCTION F_VN_GetFeatureScales : HRESULT
VAR_INPUT
    ipSamples           : ITcVnContainer;
    ipScales            : Reference To ITcVnContainer;
    eFeatureScalingType : ETcVnFeatureScalingType;
    hrPrev              : HRESULT;
END_VAR

F_VN_GetFeatureScales 2: Inputs

Name

Type

Description

ipSamples

ITcVnContainer

Container holding input sample(s) (ContainerType_Vector_REAL, ContainerType_Vector_LREAL, ContainerType_Vector_Vector_REAL or ContainerType_Vector_Vector_LREAL)

ipScales

Reference To ITcVnContainer

Returns a container with the scaling parameters for each feature (Vector_REAL or Vector_LREAL depending on the type of ipSamples).

eFeatureScalingType

ETcVnFeatureScalingType

Feature scaling type

hrPrev

HRESULT

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

F_VN_GetFeatureScales 3: Return value

HRESULT

Further information

The function F_VN_GetFeatureScales calculates scaling parameters for each feature value of the samples transferred. The corresponding scaling can then be applied using the F_VN_FeatureScaling function for feature normalization. The same scaling can also be used with F_VN_InverseFeatureScaling to invert the scaling of the prediction results of a regression.

Parameter

Samples

The samples used to calculate the scaling parameters are transferred as containers to ipSamples. The number of feature values must be the same for each sample.

Scaling

The calculated scaling parameters are returned as a container via the reference ipScales. The number and order of the elements in the container depend on the scaling type, which is always found in the first element. With MAXABS there is always one scaling value per feature. For the other types, there are always two scaling values per feature.

Scaling type

The desired scaling type is transferred to eFeatureScalingType as the enum ETcVnFeatureScalingType. The options are:

Application

For example, the calculation of scaling parameters using the MINMAX method looks like this:

hr := F_VN_GetFeatureScales(
    ipSamples           := ipSamples,
    ipScales            := ipScales,
    eFeatureScalingType := TCVN_FST1_MINMAX,
    hrPrev              := hr);

If the number of feature values per sample in ipSamples is 12, for example, ipScales will have exactly 1 + 2 * 12 = 25 elements for this scaling type.

Related functions

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