How can I display explanations for Machine Learning predictions as a drawer in Oracle Sales?
You can display explanations for machine learning predictions as a drawer in Oracle Sales by:
- Creating a virtual field, which is a field that's generated dynamically and doesn't physically exist in the database.
- Exposing it as a linked field, which when clicked, will open a drawer to display prediction explanations.
Explanations of machine learning predictions provides salespeople with added insight into the highest impacting factors that can help their sales organization improve sales efficiency and productivity. For example, salespeople can take appropriate actions to mitigate any outcomes that negatively impact the prediction. They can also use the insights from positive factors to devise a sales strategy that plays to their unique strengths.
Create a Virtual Field Using Visual Builder Studio (VBS)
Here's an example that shows how to create a virtual field for the Leads object:
- Open Oracle Visual Builder Studio.
- Click the Layouts tab and select .
- Click Create Field and because this field is expected
to be a link, ensure that it follows the format as highlighted in the Type
field as shown: For example, enter the following details:
- Label:
PredictedLeadScore
- ID:
predictedLeadScore
- Type: Select Object (Virtual Field) from the drop-down list.
- Label:
- Click Create.
After creating the virtual field, you must manually edit its configuration to include the following attributes:
labelHint
value
displayField
primaryKey
selfLinkKey
mode
referencedFields
- Click the JSON tab as shown:
- Find the virtual field entry created in the previous task.
- Change the JSON to include the required attributes
Here are sample configurations for the Opportunity Predicted Win Probability and Lead Scoring predefined models. These examples assume that:
- The Predicted Win Probability model uses the
PredWinProb
attribute in the Opportunity object. - The Lead Scoring model uses the
AILeadScore
attribute in the Lead object.
Sample Code Snippet for: Opportunity PredWinProb
Model
"PredictedWinProb": {
"type": "object",
"labelHint": "[[$fields.PredWinProb.metadata.labelHint]]",
"value" : "[[ $fields.PredWinProb.value ]]",
"properties": {
"resource": {
"value": "opportunities"
},
"displayField": {
"attribute": "PredWinProb",
"value": "{{ $fields.PredWinProb.value }}",
"metadata": "[[ $fields.PredWinProb.metadata ]]"
},
"primaryKey": {
"attribute": "OptyId",
"value": "{{ $fields.OptyId.value }}",
"metadata": "[[ $fields.OptyId.metadata ]]"
},
"selfLinkKey": {
"attribute": "OptyNumber",
"value": "{{ $fields.OptyNumber.value }}",
"metadata": "[[ $fields.OptyNumber.metadata ]]"
},
"mode": {
"value" : "drawer"
},
"context" : {
"value" : "[[ {'feature': 'salesmlprediction',
'usecasecode' : 'CX_OPPORTUNITY_WIN_PROBABILITY',
'title': $fields.Name.value()} ]]"
}
},
"referencedFields": [
"Name",
"OptyId",
"OptyNumber",
"PredWinProb",
"StatusCode"
]
}
Sample Code Snippet for: Lead Scoring Model
{
"addField": {
"predictedLeadScore": {
"type": "object",
"labelHint": "[[$fields.AILeadScore.metadata.labelHint]]",
"value" : "[[ $fields.AILeadScore.value ]]",
"properties": {
"AILeadScore": {
"value": "{{ $fields.AILeadScore.value }}",
"metadata": "[[ $fields.AILeadScore.metadata ]]"
},
"mode": {
"value": "drawer"
},
"resource": {
"value": "leads"
},
"primaryKey": {
"attribute": "LeadId",
"value": "{{ $fields.LeadId.value }}",
"metadata": "[[ $fields.LeadId.metadata ]]"
},
"selfLinkKey": {
"attribute": "LeadNumber",
"value": "{{ $fields.LeadNumber.value }}",
"metadata": "[[ $fields.LeadNumber.metadata ]]"
},
"context": {
"value": "[[ {'feature': 'salesmlprediction', 'usecasecode' :
'CX_LEAD_SCORING', 'title': $fields.Name.value()} ]]"
},
"displayField": {
"attribute": "AILeadScore",
"value": "{{ $fields.AILeadScore.value }}",
"metadata": "[[ $fields.AILeadScore.metadata ]]"
}
},
"referencedFields": [
"AILeadScore",
"LeadId",
"LeadNumber",
"Name"
]
}
}
}
Name | Description |
---|---|
labelHint |
Represents the label (field name) that will be displayed in the UI. |
value |
Holds the value of the field for that record ( Field Value ) that you want to expose. |
properties |
|
Exposing Your Virtual Field as a Link Field
- Navigate to the object's Rule Sets and select the
Header Layout of the relevant object such as
Lead.
- Duplicate the rule and clone the layout as follows:
-
Add the virtual field and drag into any available slot on the layout header.
-
Map the virtual field to the Global Hyperlink Template
- Ensure that the virtual field is mapped to the global hyperlink
template, which is predefined and ready-to-use.
The global hyperlink template ensures that clicking the virtual field opens a drawer with the explanations of the Machine Learning predictions.
- Follow these steps to link to the hyperlink template:
- Open the JSON tab of the layout configuration.
- Scroll through the JSON and find
"addTemplates"
section as follows: - Add the following code to the
"addTemplates"
section:Note: Replace the virtual field ID in the code snippet with your Virtual Field ID. -
"addTemplateMap": { "/HeaderLayout": { "predictedLeadScore": "/hyperlinkTemplate" } }
- Ensure that the virtual field is mapped to the global hyperlink
template, which is predefined and ready-to-use.
- Add the attribute referenced as
"value"
in the Virtual Field to the cloned template. - Test and publish your changes. When complete, click the virtual field link
to open a drawer that displays the explanations of the Machine Learning
predictions.
Here's an example of what this will look like when the link is created and the panel displays.