7 DecisioinTrees
7 DecisioinTrees
Machine Learning
Decision Trees
Instructor: Hongfei Xue
Email: [email protected]
Class Meeting: Mon & Wed, 4:00 PM – 5:15 PM, Denny 109
2
Another Classification Idea
3
Another Classification Idea
4
Another Classification Idea
5
Example with Discrete Inputs
6
Example with Discrete Inputs
7
Decision Trees
8
Decision Tree Algorithm
9
Decision Boundary
Decision trees divide the feature space into axis- parallel (hyper-)
rectangles.
10
Classification and Regression
11
Expressiveness
12
How to Specify Test Condition?
13
Splitting Based on Nominal Attributes
CarType CarType
{Sports, OR {Family,
Luxury} {Family} Luxury} {Sports}
14
Splitting Based on Ordinal Attributes
Size
{Small,
• What about this split? Large} {Medium}
15
Splitting Based on Continuous Attributes
16
Splitting Based on Continuous Attributes
Taxable Taxable
Income Income?
> 80K?
< 10K > 80K
Yes No
17
Learn a Decision Tree
18
Choosing a Good Attribute
19
Choosing a Good Attribute
20
We Flip Two Different Coins
21
Quantifying Uncertainty
22
Quantifying Uncertainty
23
Entropy
24
Entropy of a Joint Distribution
25
Specific Conditional Entropy
26
Conditional Entropy
27
Conditional Entropy
28
Conditional Entropy
29
Information Gain
30
Constructing Decision Trees
31
Decision Tree Construction Algorithm
32
Back to Our Example
33
Attribute Selection
34
How to determine the Best Split: Impurity
35
How to determine the Best Split: Impurity
• Greedy approach:
• Nodes with homogeneous class distribution are preferred
• Need a measure of node impurity:
C0: 5 C0: 9
C1: 5 C1: 1
Non-homogeneous, Homogeneous,
High degree of impurity Low degree of impurity
36
Measure of Impurity: GINI
GINI (t ) = 1 - å[ p( j | t )]2
j
C1 0 C1 1 C1 2 C1 3
C2 6 C2 5 C2 4 C2 3
Gini=0.000 Gini=0.278 Gini=0.444 Gini=0.500
37
Measure of Impurity: GINI
GINI (t ) = 1 - å[ p( j | t )]2
j
38
Which Tree is Better?
39
What Makes a Good Tree?
40
Decision Tree Miscellany
41
Comparison to k-NN
42
Applications of Decision Trees: XBox!
43
Applications of Decision Trees: XBox!
44
Applications of Decision Trees: XBox!
45
Applications of Decision Trees: XBox!
46
Applications of Decision Trees
47
Questions?