Defining Decision Trees Using Decision Tables - Gnorion/BizVR GitHub Wiki
Suppose you want to model this decision tree:
You could do it with a single decision table but the tree structure is not obvious and every attribute needs to be included even though they are not used by most of the rules.
Or you could do it with a set of tables like this where the tree structure is much clearer
Each table in this tree structure is much simpler and only uses the relevant conditions
While the single table appears more concise the disadvantage of using a single table is that in can introduce spurious missing rules. Notice that in the rules we have tested for < and > but the = test is missing. This will result in some missing rules.
- For the single table we find there are (apparently) 270 missing rules (because the single table needs to consider all combinations - even if they don't apply). This may then make it harder to find the 4 missing rules that are real (see below)
- For the tree structured tables we find there are only 4 missing rules (one for each place where we forgot the = test)
The true missing rules as identified by the validator are these:
if red things=T and weight=10 then result not specified in ruleset Classify By Weight
if green things=T and density=1 then result not specified in ruleset Classify by Density
if blue things=T and length=30 then result not specified in ruleset Classify by Length
if light red things=T and price=100 then result not specified in ruleset Classify by Price
In contrast, here are the first and last few missing rules from the single table approach:
There are 270 missing rules
if color=red and weight<10 and price=100 and taste=sour and density<1 and length<30 then result not specified in ruleset Classify
if color=red and weight<10 and price=100 and taste=sour and density<1 and length>30 then result not specified in ruleset Classify
if color=red and weight<10 and price=100 and taste=sour and density<1 and length=30 then result not specified in ruleset Classify
if color=red and weight<10 and price=100 and taste=sour and density>1 and length<30 then result not specified in ruleset Classify
if color=red and weight<10 and price=100 and taste=sour and density>1 and length>30 then result not specified in ruleset Classify
...(260 more rules)
if color=blue and weight=10 and price=100 and taste=salty and density>1 and length=30 then result not specified in ruleset Classify
if color=blue and weight=10 and price=100 and taste=salty and density=1 and length=30 then result not specified in ruleset Classify
if color=blue and weight=10 and price=100 and taste=bitter and density<1 and length=30 then result not specified in ruleset Classify
if color=blue and weight=10 and price=100 and taste=bitter and density>1 and length=30 then result not specified in ruleset Classify
if color=blue and weight=10 and price=100 and taste=bitter and density=1 and length=30 then result not specified in ruleset Classify
You can see how hard it would be to identify the 4 that are real missing rules