How to Use a Decision Tree?
Decision tree can be used to predict a pattern or to classify the class of a data.
Suppose we have new unseen records of persons.
The following data are called test data (in contrast to training data of previous slide) because we would like to examine the classes of these data.
Person Name |
Gender |
Car Ownership |
Travel Cost ($)/km |
Income Level |
Transportation Mode |
Alex |
Male |
1 |
Standard |
High |
? |
Buddy |
Male |
0 |
Cheap |
Medium |
? |
Cherry |
Female |
1 |
Cheap |
High |
? |
The question is what transportation mode would Alex, Buddy and Cherry use?
Using the decision tree that we have generated, we will use deductive approach to classify whether a person will use car, train or bus as his or her mode along a major route in that city, based on the given attributes.
Start from the root node “Travel cost per km,” the rules are mutually exclusive and exhaustive for each class label on the leaf node of the tree:
|
|
|
- If the travel cost per km is expensive, the person uses car (
mode
=car).
- If the travel cost per km is standard price, the person uses train (
mode
=train).
- If the travel cost is cheap, the decision tree needs to ask next question about the gender of the person.
- If the gender is male, the person uses bus (
mode
=bus).
- If the gender is female, the decision tree needs to ask again on how many cars she owns in her household.
- If she has no car, she uses bus (
mode
=bus); otherwise she uses train (mode
=train).
Snake 1: Are we poisonous?
Snake 2: I don’t know, why?
Snake 1: I just bit my lip.
|