Decision Trees Flashcards
What is a decision tree?
A decision support tool which uses a tree like graph used to model decisions and possible consequences
What does an internal node represent?
A feature. For example, ‘Outlook’
What does a branch correspond to?
A feature value. For example, ‘rain’
What does a leaf represent?
A classification
What is the algorithm for creating a decision tree?
- Split objects into subsets
- Are they pure
- Yes, STOP
- No, repeat
What do we mean by a subset being pure?
All of the items in the set give the same output.
i.e all examples give no
After a split, what do we want to be more certain about?
More about the yes/no decision.
We want the subsets to be more pure
What does entropy measure?
The uncertainty within a dataset
What is the formula for entropy?
∑ − P(i) log2 ( P(i) )
Sum of all separate parts of the set
Where P(i) is the percentage of i in the set
What does an entropy of 1 tell us about a set?
There is an even split of all i in the set
What does an entropy of 0 tell us about a set?
There is only one type of i in the set
What does information gain measure?
The effectiveness of a feature in classifying training data
What is the formula for information gain
Entropy (S) - ∑ | S(v) | / |S| Entropy( S(v) )
What does the ID3 Algorithm do?
It deicides which feature is best to split on recursively, using the information gain of each of the possible features until there are no more features
What is the outline of the ID3 Algorithm
Create root node
A = Feature that has highest information gain
set a as Root
For each possible value v of A:
- Add new branch corresponding A -> v
- let S(v) be the subset of examples in S with A=v
- if S(v) is empty: add leaf node with most common value of Label in S
- else: below this branch add a subtree
repeat