This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, go to https://wso2.com/documentation/.

Machine Learning Extension

This extension provides Siddhi the capability to make predictions based on Machine Learning models. Supported functions of the ML extension are as follows.

Predict function

Syntax<double|float|long|int|string|boolean> ml:predict(<string> pathToMLModel, <string> dataType)
Extension TypeStream Processor
Description

Returns an output event with the additional attribute that has the response variable name of the model, set with the predicted value, using the feature values extracted from the input event.

This function uses the following input parameters.

  • pathToMLModel: The file path or the registry path to the location of the ML model. If the model storage location is registry, the value of this parameter should have registry as the prefix.
  • dataType: The data type of the predicted value (doublefloatlonginteger/intstringboolean/bool).
Example

 predict(‘registry:/_system/governance/mlmodels/indian-diabetes-model’)

Syntax<double|float|long|int|string|boolean> ml:predict(<string> pathToMLModel, <string> dataType, <double> input)
Extension TypeStream Processor
Description

Returns an output event with the additional attribute that has the response variable name of the model, set with the predicted value, using the feature values extracted from the input event.

This function uses the following input parameters.

  • pathToMLModel: The file path or the registry path to the location of the ML model. If the model storage location is registry, the value of this parameter should have registry as the prefix.
  • dataType: The data type of the predicted value (doublefloatlonginteger/intstringboolean/bool).
  • input: An attribute of the input stream that is sent to the ML model as a value to based on which the prediction is made. The predict function does not accept any constant values as input parameters. You can have multiple input parameters.
Examplepredict(‘registry:/_system/governance/mlmodels/indian-diabetes-model’, NumPregnancies, TSFT, DPF, BMI, DBP, PG2, Age, SI2)