Integrating Machine Learning

To call Machine Learning models from your rule project, you must import a machine learning model into Rule Designer.

Before you begin

Before beginning this task, you must have a YAML model for your Machine Learning model, extracted from the IBM® Machine Learning for z/OS® web console.

About this task

You manage Machine Learning references from the project context menu in Rule Designer. The Machine Learning references panel has three options:
  • Create: Import Machine Learning models; you can import as many as you like
  • Update: Update or refresh existing Machine Learning models
  • Delete: Removes Machine Learning models from the list

The following task focuses on the Create option for integrating your machine learning models.

Procedure

  1. Right click your rule project and select ODM for z/OS > Enhance with Machine Learning....
    The Selection dialog for Z Machine Learning references opens.
  2. Select Create to import a Machine Learning model.
    The Add a Machine Learning call panel opens.
  3. Under Machine Learning data, click Browse and import a YAML model from one of the following places:
    • Eclipse workspace
    • Your file system
    • MLz server (requires the URL, username, and password to connect to the server)
    After you import the YAML file, the most of the fields on the Add a Machine Learning call panel are populated with default values from your YAML file.
  4. Add a deployment ID to the Mlz Deployment ID field.
    The deployment ID is a unique model ID that you obtain from the Machine Learning user interface (UI). The deployment ID field is automatically filled if you imported from a MLz server.

    If you do not have this ID yet, enter instead a place holder value. You can change this later using the Update button in the Selection dialog.

  5. Review the default values and correct invalid values.
    The values may be invalid if you use them in a previous Machine Learning import or if the characters in the filename are not authorized values.
  6. Click Finish.

Results

The following are created in Rule Designer:
  • A XOM project is created with two Java™ classes:
    • Class 1 (the name matches the last field in the Create panel) contains:
      • Name matches 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 do 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()). See below for the list of possible return codes.
      • Getters for the output values
    • Class 2: If Machine Learning cannot be accessed at runtime then you can configure it to use default values, by specifying this is permitted in your rules. See Example of a machine learning call. When default values are needed the runtime obtains them from this bean class.
  • A BOM class is created providing a verbalization for the new XOM
  • A variable set is created with two variables:
    • An instance of the BOM class, to be used for accessing Machine Learning
    • A variable which holds the Deployment ID, for use when calling Machine Learning
  • Sample rules in the Rule Package. The first rule makes a call to Machine Learning, and the second rule uses the score that Machine Learning returns.:
    Note: This sample rule can be used as the basis of your actual call. At the end of the sample rule it prints out the returned values. You delete these print statements and use the output values in the rules that follow on in the rule flow.