Decision TreesWhere To Partition?
How did the computer know which cut was the best? It needs a number that says how mixed-up a box is. That number is called entropy.
Think of a crate that holds only Alphonsos. Pull out a mango without looking and you know what you will get: no surprise at all. That crate has low entropy, and we call it pure. A crate that is half Alphonso and half Totapuri is a gamble every time: high entropy, or impure. A tree's whole job is to take one messy pile and keep splitting it into neat, low-entropy boxes.
Sort these.
Measuring the Mess
For a box with two kinds, where a fraction of the mangoes are Alphonso and are Totapuri, the entropy is
For example, a crate of 3 Alphonso and 1 Totapuri has , so
The minus signs are there because the logarithm of a number below 1 is negative; they make come out positive. The purple curve shows for every possible mix. Change the crate and complete both missions.
Alphonso in the crate:
Totapuri in the crate:
The curve shows three facts at once. at both ends, where all the mangoes are of one kind. is largest — exactly 1 — in the middle, where the kinds are equally mixed. And the more even the mix, the higher .
Note
Why base 2? Entropy counts yes/no questions. A 50/50 box needs exactly one question to settle it, so its entropy is 1 bit. Sina's eight equally likely cards had an entropy of bits — and you needed exactly three questions. With more than two kinds, the formula simply gets one more term for each kind.
Speed Round: How Mixed?
Get five right to move on.