Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel3

...

There are two possible Siddhi query syntaxes to use the extension in an execution plan as follows.

  1. <double|float|long|int|string|boolean> predict(<string> pathToMLModel, <string> dataType)
    • Extension TypeStreamProcessor
    • Description: Returns an output event with the additional attribute with the response variable name of the model, set with the predicted value, using the feature values extracted from the input event.
    • ParameterpathToMLModel:  The file path or the registry path where ML model is located. If the model storage location is registry, the value of this this parameter should have the prefix registry:
    • Parameter: dataType: Data type of the predicted value (double, float, long, integer/int, string, boolean/bool).

    • Parameter: percentileValue: Percentile value for the prediction. It should be a double value between 0 - 100. This parameter is only relevant when the algorithm of the model used for prediction is of the Anomaly Detection type.

    • Examplepredict(‘registry:/_system/governance/mlmodels/indian-diabetes-model’,'double')

  2. <double|float|long|int|string|boolean> predict(<string> pathToMLModel, <string> dataType<double> input)

    • Extension TypeStreamProcessor
    • Description: Returns an output event with the additional attribute with the response variable name of the model, set with the predicted value, using the feature values extracted from the input event.
    • ParameterpathToMLModel: The file path or the registry path where ML model is located. If the model storage location is registry, the value of this parameter should have the prefix registry:
    • Parameter: dataType: Data type of the predicted value (double, float, long, integer/int, string, boolean/bool).

    • Parameterinput: A variable attribute value of the input stream which is sent to the ML model as feature values for predictions. Function does not accept any constant values as input parameters. You can have multiple input parameters. 

    • Parameter: percentileValue: Percentile value for the prediction. It should be a double value between 0 - 100. This parameter is only relevant when the algorithm of the model used for prediction is of the Anomaly Detection type.

    • Examplepredict(‘registry:/_system/governance/mlmodels/indian-diabetes-model’,'double', NumPregnancies, TSFT, DPF, BMI, DBP, PG2, Age, SI2)

...

Follow the steps below to simulate the sending of events in WSO2 CEP.

Note

Queries are collectively processed by all the nodes in a CEP cluster. Therefore, make sure that the ML model is located in the same path in all the nodes. This allows all the nodes to access the model when events are sent to a specific node.


  1. Log in to the CEP management console using the following URL, if you are not already logged in: https://<CEP_HOME>:<CEP_PORT>/carbon/
  2. Click Tools, and then click Event Simulator.
  3. Select InputStream:1.0.0 for the Event Stream Name.
  4. Enter the feature values to predict, in the Stream Attributes input fields as shown below.

  5. Click Send, to send the events. You view the values of the output stream named PredictionStream logged by the event publisher in the back end console logs of WSO2 CEP as shown below.

...