15 KiB
Lab 5 - Import Machine Learning Predictions into Customer Insights
Contents
Exercise 1: Import Machine Learning Output to Customer Insights
Lab Overview
Introduction
This final lab will close the loop by importing back to Customer Insights the results of your machine learning model which predicts which customers are likely to churn.
Objectives
The objectives of this exercise are to:
- Learn how to import the results from your machine learning model back into Customer Insights
The estimated time for this lab is 45 minutes
Exercise 1: Import Machine Learning Output to Customer Insights
In this section you will learn how to import the results of your machine learning models into Customer Insights.
Step 1: Copy the storage account key for your Azure ML storage account
-
Browse to https://portal.azure.com and sign in with your organizational account.
Search for “asastore” in the search box at the top:
-
On the Security + networking… Access keys blade, click the “Show keys” button:
-
Click the Copy to clipboard button on the right side of the Key textbox under the key1 section:
Step 2: Import Machine Learning Output to Customer Insights
-
Browse to https://home.ci.ai.dynamics.com/ and sign in with your organizational account.
On the Data… Data sources left nav, click the “+ Add data source” button:
-
Choose Microsoft Power Query and give it the name “AzureMlResults” and click Next.
-
Click the Azure tab in the Power Query Online window and click the Azure Blobs option:
-
In the “Account name or URL” type in the name of your storage account for Azure ML (asastore<suffix>) replacing your suffix. Change the Authentication kind to Account key. Paste in the storage account key for your asastore<suffix> storage account. Click Next.
-
Click the checkbox on the container called “azureml-blobstore-<guid>” and click the Transform data button.
-
On the Name column click the dropdown and choose Text filters… Equals:
-
Paste “azureml/Decision_Tree_Results/dtresults/data.csv” into the Filter rows dialog and click Ok.
-
Power Query Online should now show one row with the CSV file which is the output of your ML model. Click the [Binary] link in the Content column for that one row:
-
The columns in your ML results file should show on the screen. On the Transform tab, click the “Use first row as headers” button:
-
The first row has now been promoted to column headers. Now click the ABC button on the Scored Probabilities column and choose “Decimal number” to convert that column to a decimal.
-
Rename this query to PredictedCustomerChurn.
-
On the “Add column” tab click the “Conditional column” button:
-
Name the new column ChurnRisk and setup the conditions as follows. If the model predicts the customer will not churn (Scored Labels=No), return Low. If the model predicts they have a 50% or greater probability of churning (because if it got to this condition, Scored Labels must equal Yes, and Scored Probabilities > .5) return High. Otherwise return Medium. Then click OK and click Next.
-
Accept manually should be selected. Click Save:
-
Click the radio button to the left of the AzureMlResults data source and click the Refresh button at the top of the screen.
-
On the Data… Unify left nav, click the Edit fields button.
-
Click the checkmark next to the PredictedCustomerChurn entity and click Apply:
-
Click the PredictedCustomerChurn entity and set the primary key to customerID and click Save.
-
Go to the Match tab and click the “+Add entity” button and choose the PredictedCustomerChurn entity:
-
Click the “+Add rule” button under the AzureMlResults : PredictedCustomerChurn entity:
-
Choose the CustomerDemographics entity and the customerID fields on both entities. Name this rule and click Done:
-
Click Save and then Run at the top of the screen:
-
Once the run is successful, your results should look like:
-
On the Merge tab, click the “Excluded fields” link:
-
Click the arrow next to Scored Labels, Scored Probabilities, and ChurnRisk fields to include those fields in the merging. Click the Done button.
-
Scroll down to the bottom of the field list, mouse over the Scored Labels field and click the Rename button. Rename Scored Labels to “PredictedChurn”. Rename Scored Probabilities to “PredictedChurnProbability”.
-
Click Save and Run… Run Only Merge at the top of the screen.
-
Once the run is successful, go to the Data… Entities left nav, click on the Customer entity, go to the Data tab and scroll to the right. You should see that the PredictedChurn and PredictedChurnProbability are now included as fields in the customer entity. For clarity, customer 0423-UDIJQ has not yet churned (Churn=No) but has a 52% probability of churning (PredictedChurn=Yes, PredictedChurnProbability=0.52) at some point soon per the ML model. Customer 2480-JZOSN has not yet churned (Churn=No) and the model predicts with a probability of 36% that they will not churn (PredictedChurn=No, PredictedChurnProbability=0.36). In other words, a high (close to 1.0) PredictedChurnProbability doesn’t alone mean they are predicted to churn. The probability is the probability associated to the PredictedChurn field. The customers with a blank PredictedChurn were part of the training set in Azure Machine Learning so no prediction was made.
Step 3: Segment your customers at highest risk of churning
-
Go to the Customers left nav and click “Search & filter index”. Let’s find any customers which have a high probability of churning.
-
Click the “+Add” button to add a field to the index:
-
Check the Churn, PredictedChurn and ChurnRisk fields (decimal fields are not currently supported) and click Add.
-
Mouse over the ChurnRisk field and click the funnel icon to enable filtering on this field. Do the same for the Churn field.
-
When prompted after clicking the funnel icon, accept the default options and click OK.
-
Then click the Save and Run buttons. When refreshing completes, click the Back to Customers button.
In the right side Filter customers pane, filter to Churn=No (not currently churned) and ChurnRisk=High (high predicted risk of churning soon). Now you have filtered your 7,000 customers down to a list of 478 customers at highest risk of churn. Let’s take action on this list of customers.
-
Click the Save filters as segment link and enter a name for this new segment of customers. Click Save.
-
Click Activate.
-
Go to the Segments left nav, select the Customers at High Risk of Churn segment, wait for it to finish refreshing, then click the Download button. You can send this file to your customer care department and ask them to come up with strategies to boost customer satisfaction and improve retention for these high risk customers.
Summary
In this lab, you imported the results of your machine learning model back into Customer Insights and merged this information into the Customer entity. Now you are able to take action from Customer Insights on customers who are predicted to churn.
Next, go to Lab 6.