Testing the integration in Rule Designer
You can check the integration of Machine Learning in Rule Designer.
About this task
After you set up the Machine Learning integration, you can test it in Rule Designer.
Procedure
- Do the tasks to integrate Machine Learning in Rule Designer (see Integrating a Machine Learning model).
- Right-click your rule project and click Machine Learning Integration > Enhance with Machine Learning.
- Ensure that you have selected the correct deployment ID. It should match your cloud
endpoint, for example:
https://us-south.ml.cloud.ibm.com/ml/v4/deployments/<...> - Check that the rule which calls Machine Learning contains a print command
to display the results, for example:
print "ML return code=" + the return code of 'the sample rule'; print "prediction=" + the prediction of 'the sample rule"; - Ensure that the decision operation includes the input variables that are mapped to the
Machine Learning call. Note: Skip this step if you are using hardcoded Machine Learning values.
- Edit the Java™ XOM for the input parameters. Add a constructor that lets you set the values. This helps when you test in Rule Designer.
- Open the Run menu and click Run Configurations.
- Right-click Decision Operation, and click New Configuration.
- Enter a name for the new configuration, and select your decision operation.
- Open the Parameters & Arguments tab.
- Double-click your input parameter.
- Select Function body, and create a new instance of your Java class by using the constructor in step 6:
custXom.RuleInputs result = new custXom.RuleInputs((Double)0.5,(Double)0.5,(Integer)1); return result; - Click OK to complete the defining of the parameter.
- In the VM arguments, enter the values for variables to access
Machine Learning, for
example:
-Dcom.ibm.rules.ml.rest.baseurl=<cloud endpoint> -Dcom.ibm.rules.ml.rest.authentication.url=<ID token> -Dcom.ibm.rules.ml.rest.authentication.apikey=<API ID> -Dcom.ibm.rules.ml.rest.urlsuƯix=<prediction/version> - Click Run. The console view displays the results (see Machine Learning return codes).