Task 2: Creating and configuring a predictive model

You upload a PMML file to create a transparent predictive model. Then, you map input and output data types from the PMML file to data types from the data model.

Step 1: Creating a transparent predictive model

  1. Open the Customer retention decision service.
  2. Click Create + in the Models tab.
  3. Select Predictive model. Enter Transparent churn as the name.
  4. Make sure the existing Data data model is used as the data source. Then, click Create.
  5. Click Configure in the right panel.
  6. Select Local machine learning model as the configuration method and click Next.
  7. Browse to the churn.pmml file you downloaded in Task 1.
  8. Keep Business rules selected as the decision logic generation method and click Next.
  9. Map input data from the PMML file to data types defined in the Data data model:
    Table 1. Data mapping details
    Data type Source type or value Maps to
    Status marital status the marital status of CustomerRecord
    S single
    D divorced
    M married
    Gender gender the gender of CustomerRecord
    F female
    M male
    Usage double (64 bits) the usage of Subscription
    EstIncome double (64 bits) the estimated income of CustomerRecord
    Children double (64 bits) the children of CustomerRecord
    Age double (64 bits) the age of CustomerRecord
    Paymethod payment method the payment method of Subscription
    Auto auto
    CC creditCard
    CH check
    CarOwner boolean Customer Record is car owner
    Y TRUE
    N FALSE

    You cannot map the RatePlan data type to a corresponding data type from Data. You will define a mapping rule in the next step to do so.

  10. Click Apply.
  11. Explore the generated predictive model: open the Prediction node and go to the Logic tab to review the rules that were created.
  12. Go back to the decision diagram.

Step 2: Editing input mapping

  1. Update the diagram:
    1. Delete the Input node.
    2. Connect the CustomerRecord and Subscription nodes to the Input mapping node.
    3. Delete the connection links between CustomerRecord and Subscription nodes to the Prediction node.

    The following screenshot shows what the diagram should look like:

    Predictive model with input nodes and decision nodes
    1. Click the Input mapping node.
    2. Go to the Logic tab and create a decision table named rate plan mapping.
    3. Select the rate plan of 'Subscription' under Subscription in the wizard.
    4. Click Create.
    5. Whereas rate plan is a double in the PMML churn model, it is an enumeration in the Data data model. Update the decision table to map types:
      rate plan Input mapping
      Basic 0
      Essentials 1
      Gold 2
      Premium 3

The ML model input type is automatically generated from the PMML dictionary when the rules are imported. You can review the DataDictionary of the PMML file to see how it is defined.

Step 3: Editing output mapping

  1. Navigate back to the diagram and open the Output mapping node.
  2. Set its output type to number.
  3. Go to the Logic tab and create a business rule named mapOutputData.
  4. Enter the following rule in the editor:
        if the predicted of 'Weight Comparison' is "T" 
    then
        set decision to the confidence of 'Weight Comparison' ;
    else
        set decision to (1 - the confidence of 'Weight Comparison');

Step 4: Running the predictive model

  1. Go to the Run tab.
  2. Create a test data set.
  3. Edit its content as JSON and enter the following data:
     {
       "customerRecord": {
         "age": 35,
         "carOwner": false,
         "children": 1,
         "estimatedIncome": 100000,
         "gender": "Female",
         "location": "urban",
         "maritalStatus": "Single",
         "name": "Jane"
       },
       "subscription": {
         "internationalCalls": 0,
         "localCalls": 0,
         "longDistanceCalls": 0,
         "paymentMethod": "Auto",
         "ratePlan": "Basic",
         "usage": 50
       }
     }  
  4. Click Run.

    It returns a number: the probability of a customer to churn.