Contents
06Information gain and mutual information
Suppose you do not know which of the two cities you are in, each equally likely. Tomorrow’s chance of rain is then \frac12(0.0032+0.558)=0.281, and its entropy is H(0.281)=0.86 bits. If you learn the city, the remaining entropy is the average of the two cities’ entropies, \frac12(0.031+0.99)=0.51 bits. Knowing the city removes 0.86-0.51=0.35 bits of uncertainty.
That difference is the information gain a decision tree uses to choose splits (Quinlan, 1986), (Murphy, 2022, §18.1.2): for a split on a feature X of the label Y,
ID3 grows the tree by taking the split with the largest gain, here the split on city. The same quantity is the mutual information between X and Y, which is itself a KL divergence: how far the joint distribution is from the one that would hold if X and Y were independent (Murphy, 2022, §6.3),
So learning a feature never increases the expected uncertainty about the label.
Pause and think. A tree may split on “customer ID”, which takes a different value for every training example. What is its information gain, and is it a good split?
Show the answer
Every leaf is pure, so H(Y\mid X)=0 and the gain is the largest possible, H(Y). But the split memorizes the training set and says nothing about new customers. Information gain favors features with many values; Quinlan (1986) corrects for this with the gain ratio, and CART uses the Gini impurity instead (Murphy, 2022, §18.1.2).