F_VN_PredictBatchExp
Compute predictions for a batch of samples. (expert function)
Can use available TwinCAT Job Tasks for executing parallel code regions.
Syntax
Definition:
FUNCTION F_VN_PredictBatchExp : HRESULT
VAR_INPUT
ipMlModel : ITcVnMlModel;
ipSamples : ITcUnknown;
ipPredictions : Reference To ITcVnContainer;
ipNovelties : Reference To ITcVnContainer;
hrPrev : HRESULT;
END_VAR
Inputs
|
Name |
Type |
Description |
|---|---|---|
|
ipMlModel |
Classifier or regressor to be used | |
|
ipSamples |
Container holding a batch of input samples (ContainerType_Vector_Vector_REAL or ContainerType_Vector_Vector_LREAL) | |
|
ipPredictions |
Reference To ITcVnContainer |
Returns the predicted outputs (depending on ipSamples; class labels (for classification, ContainerType_Vector_DINT) or real-valued predictions (for regression with scalar output, ContainerType_Vector_REAL or ContainerType_Vector_LREAL; for regression with vectorial output, ContainerType_Vector_Vector_REAL or ContainerType_Vector_Vector_LREAL)) |
|
ipNovelties |
Reference To ITcVnContainer |
Returns the degree of novelty (0.0 if a sample is completely known; > 0.0 otherwise) of each sample (ContainerType_Vector_REAL; optional, set to 0 if not required) |
|
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function F_VN_PredictBatchExp is the expert variant of F_VN_PredictBatch. It contains additional parameters.
Parameter
Model
For prediction, the previously trained model must be transferred to ipMlModel.
Samples
The samples are transferred to ipSamples in a container. The type of container must be ContainerType_Vector_Vector_REAL or ContainerType_Vector_Vector_LREAL.
Predictions
The predictions are returned in a container via the reference ipPredictions. Depending on the type of model, the container has a different type:
- Class label for a classification:
ContainerType_Vector_DINT - Numerical prediction values in a scalar regression:
ContainerType_Vector_REALorContainerType_Vector_LREAL,depending onipSamples - Numerical prediction values in a vector regression:
ContainerType_Vector_Vector_REALorContainerType_Vector_Vector_LREAL,depending onipSamples
Degrees of novelty
The degrees of novelty of the samples are returned as containers via the reference ipNovelties.
Application
For example, several samples can be classified at the same time:
hr := F_VN_PredictBatchExp(
ipMlModel := ipMlModel,
ipSamples := ipSamples,
ipPredictions := ipPredictions,
ipNovelties := ipNovelties,
hrPrev := hr);
hr := F_VN_GetAt_DINT(ipPredictions, nClassOfThirdSample, 2, hr);The call of F_VN_GetAt_DINT shows how the class label of the 3rd sample can be get from the predictions.
Related functions
Required License
TC3 Machine Learning Realtime Inference
Return value