Mapping input data types

You must map the input data types of the machine learning model to the data types of your data model.

About this task

When you encapsulate the predictive model in a decision model, it exists as a function in the context of a dependency diagram. This diagram defines the input data types that are available to the predictive function. The input data types that are expected by the machine learning model might be different from these data types that are part of your data model. You must map these data types so that the machine learning model understands the data types that are used in your decision models.

When you configure the predictive model, a data model is also created. It contains the data types that the machine learning model expects as input, and the data type of its prediction.

Procedure

  1. List the data types that are used by the machine learning model. If you do not have this information, you might need to work with the data scientist who created the machine learning model.
  2. In your predictive model, define an input data node for each data type that the model needs to make the prediction.
    1. In the diagram editor, click Add input to create an input data node.
    2. Configure the node: give it a name and select a data type from the list.
    3. Link the input data node to the input mapping node.
  3. Select the input mapping node and open the Logic tab.
  4. Map the input data types by using rules and decision tables.
    • If the mapping is between two data types that are the same except for their name, the mapping is straightforward. In this case, you write a rule statement that looks like this:
      set the age of decision to the age of patient
      You can also write a rule statement that maps multiple data types:
      set decision to a new ML model input where
         the age is the age of patient ,
         the gender is the gender of patient ,
         the systolicbloodpressure is the systolic blood pressure of patient ,
         the diastolicbloodpressure is the diastolic blood pressure of patient ;
    • If the mapping is between different data types, you need to convert them.
      In the following example, the gender of the patient is an enumeration (male or female) in the data model but the machine learning model expects a number:
      if the gender of patient is female, then set the gender of decision to 0, else set the gender of decision to 1
      The mapping can require a simple computation. In the following example, the sodium to potassium ratio is computed from a medical test result. It is defined as the sodium level / the potassium level:
      set 'SP ratio' of decision to the sodium level / the potassium level

      The mapping can require a more complex computation that you implement with a separate decision table in the input mapping node. For example, the blood pressure of a patient is an enumerated value that can be high, normal, or low. It can be computed from a medical test result, based on the systolic blood pressure and the diastolic blood pressure of the patient. Imagine the decision model can provide these two values, and the machine learning expects the computed blood pressure as input data type. In this case, the easiest way to map the data types is to create a decision table:

        Systolic blood pressure Diastolic blood pressure Blood pressure quality
      Min Max Min Max
      1 < 90 < 60 LOW
      2 90 120 40 80 NORMAL
      3 > 120   HIGH
      4   > 80 HIGH

What to do next

You can now optionally configure the invocation rule that invokes the machine learning model. Else, you can map the data type of the output of the machine learning model to a data type from your data model.