Integrating a Machine Learning model
To call a Machine Learning model from your rule project, you must import the model into Rule Designer.
Before you begin
You must get a JSON or YAML file that represents the data model of the Machine Learning endpoint (see Exporting JSON for a cloud-hosted Machine Learning endpoint).
About this task
The following task focuses on the create option for integrating a Machine Learning model.
Procedure
Results
- XOM with two Java™ classes:
- Class 1:
- Name taken from the bottom field in the create panel
- Getters and setters for the input values in the swagger file
- Method to set the deployment ID (
setDeploymentID(String)) - Method to perform a model execution (
execute()) - Method to query if the returned values are from the defaults
(
isReturningDefaultValues()) - Method to get the a return code from the call (
getReturnCode()). (List below of possible return codes.) - Getters for the output values
- Class 2:
If Machine Learning cannot be accessed at run time, you can configure it to use default values by specifying that this is permitted in your rules. See Example: Adding a Machine Learning model. When default values are needed, the runtime obtains them from this bean class.
- Class 1:
- A BOM class is created that provides a verbalization for the new XOM
- A variable set is created with two variables:
- BOM class to be used for accessing Machine Learning
- Deployment ID for use when calling Machine Learning
- Sample rules in the rule package:
- Rule 1 calls Machine Learning.
- Rule 2 uses the score from Machine Learning.
This sample rules can be used in your call. At the end, the rule prints out the returned values. You delete these print statements and use the output values in the rules that follow in the ruleflow.