Multiple Outcomes given
This Article shows the various patterns for Outcomes as well as provides a breakdown of individual outcomes that contribute to an overall result with their individual certainties.
When working with Rainbird maps that provide a single answer with an associated certainty, it is often desirable to see a breakdown of single outcomes that contribute to that overall result.
What problem/context does it address?
When Rainbird provides an answer with an associated certainty value, the overall certainty percentage is a combination of multiple smaller percentages.
By default, Rainbird will only show the final result(s), and not the information and decisions that went into reaching a result. This information can be viewed in the evidence tree; however, this is not always appropriate for end-users.
This build pattern can display multiple results: the primary outcome, plus the sub-outcomes including associated certainties.
Figure 1: Setting the Relationship on plural shows all Rule outcomes
Applicability
Use this pattern when:
- You have a Rainbird map where there is a single answer with an associated certainty value, and you want to display a breakdown of how that final result and certainty have been reached, without needing to refer to the evidence tree
- Your Rainbird map comes out with a single answer with no certainty, and you want to display supporting decisions that have contributed to that final answer.
Limitations
This build pattern will not work if the Rainbird map has to provide multiple results in certainty order.
Elements (generic description, linked to other library content)
Make sure you are familiar with the following:
In this example the map is determining the level of risk a car insurance applicant poses. The map considers three factors:
- Age (younger drivers are much riskier, elderly drivers are moderately more risky)
- Location (some areas are more at risk of car theft or vandalism)
- Expected annual mileage (more driving miles means more risk of an accident)
Figure 2: Triangle build for Car insurance model
In this use case there are several pieces of information which are needed. The overall result must be shown, but also a breakdown of each of the individual factors that go into that overall decision.
Start by creating the Concepts:
- Applicant: String
- Risk of Claim: String
- Location: String
- Age Bracket: String
- Expected Annual Mileage: Number
Connect the Concepts with Relationships:
- %APPLICANT lives in location %LOCATION – (singular, question configuration Second Form (object), add instances None)
- %LOCATION location affects risk of claim %RISK_OF_CLAIM – (singular, question configuration none)
- %APPLICANT belongs in age bracket %AGE_BRACKET – (singular, question configuration Second Form (object), add instances None)
- %AGE_BRACKET age bracket affects risk of claim %RISK_OF_CLAIM – (singular, question configuration none)
- %APPLICANT has expected annual mileage %EXPECTED_ANNUAL_MILEAGE – (singular, question configuration Second Form (object))
- %APPLICANT presents risk of claim due to location %RISK_OF_CLAIM – (singular, question configuration none)
- %APPLICANT presents risk of claim due to age bracket %RISK_OF_CLAIM – (singular, question configuration none)
- %APPLICANT presents risk of claim due to mileage %RISK_OF_CLAIM – (singular, singular, question configuration none)
- %APPLICANT presents risk of claim overall %RISK_OF_CLAIM – (plural, question configuration none)
Create Instances for the results you want on the object concept.
For our example three instances are needed:
- Risk of claim due to age bracket
- Risk of claim due to location
- Risk of claim due to mileage
Figure 3: Creating the Instances for the based on rules
In the same method create the below Instances to the ‘Location’ and ‘Age Bracket’ Concepts:
- %LOCATION: High risk location, Low risk location
- %AGE_BRACKET: 18-25, 26-70, 71+
Add the following Facts for the Concept Location:
Figure 4: Select an Object and set the Fact Certainty
set the remaining Facts as follows:
- High risk location location affects Risk of claim due to location – CF 30
- Low risk location location affects Risk of claim due to location – CF 10
then create and set the Certainty Facts in the Concept Age bracket:
- 18-25 age bracket affects risk of claim Risk of claim due to age bracket – CF45
- 26-70 age bracket affects risk of claim Risk of claim due to age bracket – CF15
- 71+ age bracket affects risk of claim Risk of claim due to age bracket – CF20
Now create the Rules. We set the Relationships Minimum rule certainty (under Advanced) to ‘1’, guaranteeing a result for each rule:
- %APPLICANT presents risk of claim due to location Risk of claim
On condition that:
Figure 5: Create Rules on individual Outcome Location
- %APPLICANT presents risk of claim due to age bracket Risk of claim
On condition that:
Figure 6: Create Rules on individual Outcome Age
- Followed by 3 separate Number Bracket Rules on:
- %APPLICANT presents risk of claim due to mileage Risk of claim
On condition that:
Figure 7: Create Rules on individual Outcome Mileage Bracket
When viewing the map generated by the RBLang at the bottom of the article, for a demonstration of the hoursBetween function, please run the query on the ‘how many hours till new year’ relationship.
We continue the build from the ‘Building the Map’ section above, where we created Concepts, Relationships, Instance, Facts and Rules.
In this section, we create the individual Based on Rules who contribute to an overall decision, as well as the overall outcome taking all individual outcomes into consideration.
The Rules added to the below Relationships have the Minimum rule certainty (under Advanced) set to ‘1’, guaranteeing a result for each rule.
- %APPLICANT presents risk of claim due to location Risk of claim
On condition that
Figure 8: Create Rules on individual Outcome Location
- %APPLICANT presents risk of claim due to age bracket Risk of claim
On condition that:
Figure 9: Create Rules on individual Outcome Age
- Followed by 3 Number Bracket Rules on the relationship:
- %APPLICANT presents risk of claim due to mileage Risk of claim
On condition that:
Figure 10: Create Rules on individual Outcome Mileage Bracket
Finally build object-specific rules for each of the rules, referring to the relevant sub-rule.
Those conditions are:
Figure 11: Building the overall rule
By running all four rules on the plural relationship,
Figure 12: Build the Overall Outcome Rule
When running the Rainbird map, we will see four outcomes, displaing both the overall result, plus each of the three individual sub-results that contribute to the overall result.
Figure 13: Query and Multiple Outcomes
Note: that one downside of this technique is that the overall result will not be displayed first. As the overall result is an average of the sub-results, it will have a certainty percentage, lower than some sub-results and higher than others. Rainbird orders the outcomes in certainty order, from highest to lowest.
Click on the ‘Export.rbird’ button to download the ‘Multiple Outcomes Given’ map used in this example. The knowledge map can then be imported into your Rainbird Studio
Query and Results
The main query is built on the rule ‘has risk of claim overall’. The outcome of the query will be the Object we defined.