- Year not given
Extracting rules from decision tree
Short answer
For each path from root to leaf, create a rule with all attribute-value tests along the path combined with AND, and the leaf class as the consequent. For instance: IF age=youth AND student=no THEN buys_computer=no. The resulting rules are mutually exclusive and exhaustive, with as many rules as leaves.
How can rules be extracted from decision tree? Explain with an example.
A decision tree can be converted into a set of IF-THEN rules, which are easier to read than a large tree.
Method
- Create one rule for each path from the root to a leaf.
- Each attribute-value test along the path is a condition; the tests are combined with AND.
- The leaf class label is the rule's consequent (THEN part).
- (Optional) Simplify the rules: remove a condition if this does not reduce rule accuracy (pessimistic estimate), and remove duplicate or redundant rules.
The rules from an unpruned tree are mutually exclusive (a record satisfies only one rule) and exhaustive (every record is covered). The number of rules equals the number of leaves.
Example (buys-computer tree)
age?
young/ middle \senior
student? YES credit_rating?
no/ \yes fair/ \excellent
NO YES YES NO
Rules:
- IF age = young AND student = no THEN buys_computer = no
- IF age = young AND student = yes THEN buys_computer = yes
- IF age = middle THEN buys_computer = yes
- IF age = senior AND credit_rating = fair THEN buys_computer = yes
- IF age = senior AND credit_rating = excellent THEN buys_computer = no
Rule 3 has only one condition because its leaf is reached by a single test. The rule set is equivalent to the tree.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Overfitting in ID3 and decision tree rules · Data Mining, chapter 3
- Short note: Decision tree · Data Mining, chapter 3
- Decision tree classifier and Hunt's algorithm · Data Mining, chapter 3
- Decision tree advantages and disadvantages · Data Mining, chapter 3
- Explain decision tree analysis · Engineering Economics, chapter 6 · asked 5×
- Decision tree for plant improvement alternatives · Engineering Economics, chapter 6 · asked 2×
- Decision tree; infinite source blocking formulas · Telecommunications, chapter 6 · asked 2×
- Decision tree; finite source blocking formulas · Telecommunications, chapter 6 · asked 2×