Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Decision tree learning
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Information gain=== {{main|Information gain in decision trees}} Used by the [[ID3 algorithm|ID3]], [[C4.5 algorithm|C4.5]] and C5.0 tree-generation algorithms. [[Information gain]] is based on the concept of [[information entropy|entropy]] and [[information content]] from [[information theory]]. Entropy is defined as below :<math>\Eta(T) = \operatorname{I}_{E}\left(p_1, p_2, \ldots, p_J\right) = - \sum^J_{i=1} p_i \log_2 p_i</math> where <math>p_1, p_2, \ldots</math> are fractions that add up to 1 and represent the percentage of each class present in the child node that results from a split in the tree.<ref name="Witten 2011 102β103">{{Cite book|title=Data Mining|url=https://archive.org/details/dataminingpracti00witt_966|url-access=limited|last1=Witten|first1=Ian|last2=Frank|first2=Eibe|last3=Hall|first3=Mark|publisher=Morgan Kaufmann|year=2011|isbn=978-0-12-374856-0|location=Burlington, MA|pages=[https://archive.org/details/dataminingpracti00witt_966/page/n136 102]β103}}</ref> :<math display="block"> \overbrace{IG(T,a)}^\text{information gain} = \overbrace{\Eta(T)}^\text{entropy (parent)} - \overbrace{\Eta(T\mid a)}^\text{sum of entropies (children)} </math><math>=-\sum_{i=1}^J p_i\log_2 p_i - \sum_{i=1}^J - \Pr(i\mid a)\log_2 \Pr(i\mid a)</math> Averaging over the possible values of <math>A</math>, :<math display="block"> \overbrace{E_A(\operatorname{IG}(T,a))}^\text{expected information gain} = \overbrace{I(T; A)}^{\text{mutual information between } T \text{ and } A} = \overbrace{\Eta(T)}^\text{entropy (parent)} - \overbrace{\Eta(T\mid A)}^\text{weighted sum of entropies (children)} </math><math>=-\sum_{i=1}^J p_i\log_2 p_i - \sum_a p(a)\sum_{i=1}^J-\Pr(i\mid a) \log_2 \Pr(i\mid a) </math> :Where weighted sum of entropies is given by, :<math>{\Eta(T\mid A)}= \sum_a p(a)\sum_{i=1}^J-\Pr(i\mid a) \log_2 \Pr(i\mid a)</math> That is, the expected information gain is the [[mutual information]], meaning that on average, the reduction in the entropy of ''T'' is the mutual information. Information gain is used to decide which feature to split on at each step in building the tree. Simplicity is best, so we want to keep our tree small. To do so, at each step we should choose the split that results in the most consistent child nodes. A commonly used measure of consistency is called [[Information theory|information]] which is measured in [[bit]]s. For each node of the tree, the information value "represents the expected amount of information that would be needed to specify whether a new instance should be classified yes or no, given that the example reached that node".<ref name="Witten 2011 102β103"/> Consider an example data set with four attributes: ''outlook'' (sunny, overcast, rainy), ''temperature'' (hot, mild, cool), ''humidity'' (high, normal), and ''windy'' (true, false), with a binary (yes or no) target variable, ''play'', and 14 data points. To construct a decision tree on this data, we need to compare the information gain of each of four trees, each split on one of the four features. The split with the highest information gain will be taken as the first split and the process will continue until all children nodes each have consistent data, or until the information gain is 0. To find the information gain of the split using ''windy'', we must first calculate the information in the data before the split. The original data contained nine yes's and five no's. :<math> I_E([9,5]) = -\frac 9 {14}\log_2 \frac 9 {14} - \frac 5 {14}\log_2 \frac 5 {14} = 0.94 </math> The split using the feature ''windy'' results in two children nodes, one for a ''windy'' value of true and one for a ''windy'' value of false. In this data set, there are six data points with a true ''windy'' value, three of which have a ''play'' (where ''play'' is the target variable) value of yes and three with a ''play'' value of no. The eight remaining data points with a ''windy'' value of false contain two no's and six yes's. The information of the ''windy''=true node is calculated using the entropy equation above. Since there is an equal number of yes's and no's in this node, we have :<math> I_E([3,3]) = -\frac 3 6\log_2 \frac 3 6 - \frac 3 6\log_2 \frac 3 6 = -\frac 1 2\log_2 \frac 1 2 - \frac 1 2\log_2 \frac 1 2 = 1 </math> For the node where ''windy''=false there were eight data points, six yes's and two no's. Thus we have :<math> I_E([6,2]) = -\frac 6 8\log_2 \frac 6 8 - \frac 2 8\log_2 \frac 2 8 = -\frac 3 4\log_2 \frac 3 4 - \frac 1 4\log_2 \frac 1 4 = 0.81 </math> To find the information of the split, we take the weighted average of these two numbers based on how many observations fell into which node. :<math> I_E([3,3],[6,2]) = I_E(\text{windy or not}) = \frac 6 {14} \cdot 1 + \frac 8 {14} \cdot 0.81 = 0.89 </math> Now we can calculate the information gain achieved by splitting on the ''windy'' feature. :<math> \operatorname{IG}(\text{windy}) = I_E([9,5]) - I_E([3,3],[6,2]) = 0.94 - 0.89 = 0.05 </math> To build the tree, the information gain of each possible first split would need to be calculated. The best first split is the one that provides the most information gain. This process is repeated for each impure node until the tree is complete. This example is adapted from the example appearing in Witten et al.<ref name="Witten 2011 102β103"/> Information gain is also known as [[Diversity index#Shannon index|Shannon index]] in bio diversity research.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)