One question, and the pile goes from 13% spam to 99.6%.
Has it got a five digit number in it? That single question splits 4,459 messages into 466 that are almost all spam and 3,993 that are almost all not. Then the tree asks again on each pile, and again, and the whole model ends up small enough to read out loud. Five nodes, and you choose the question.
- Score
- 0
- Best
- 0
- Streak
- ×0
- Node
- 1/5
A decision tree is one question at a time. Pick the question you would ask first about this pile of messages, and see how much of the guesswork it actually removes.
Messages where: not has a five digit number in it, and not mentions money, and contains a web address
30 messages, 20 of them spam.
That leaves 0.918 bits of uncertainty about this pile. Which question takes the most of it away?
One pile of 4,459 training messages, about one in seven of them spam. A tree does exactly what the first module of this track did, and then does it again to whatever it produces.
Loading the tree…
The same measure, applied over and over.
NextMany weak opinions+What is actually going onWhy is this the model people reach for when it has to be explained?Because the model and its explanation are the same object. There is nothing else to translate.
Every other model on this track answers “why” with a weight, a probability or a distance. A tree answers with the path a message took, in the words the features were written in, and that path is not a story told afterwards. It is the computation.
Which is why trees turn up wherever a decision has to be defended: credit, benefits, triage. The trade is usually accuracy. The word-based model earlier in this track beats this tree, and it cannot tell anybody why it refused them.
One honest caveat. Readability collapses with depth. A tree twenty levels deep is not an explanation, it is a program, and people who claim their model is interpretable because it is a tree rarely mention its depth.
+What is actually going onWhy are trees called unstable?Because the first split decides everything after it, and the first split can flip on a handful of examples.
If two questions are nearly tied at the root, a few different training messages can swap them, and the entire tree underneath is then grown on a different pile. The result is not a slightly different model. It is a different model that happens to score about the same.
Hastie and colleagues treat this as the defining weakness of trees, and it is the reason the next module exists. If a single tree wobbles that much, grow a great many of them on slightly different data and let them vote, and the wobble largely cancels.
You can feel it in the game: several nodes have two candidates within a few hundredths of a bit. Those are the nodes where the tree you were shown is one of several equally reasonable trees.
+Go and try this for realRead a decision path out loud
Go and try this
Read a decision path out loud
Find any rule-based or tree-based decision in your organisation, and trace one real case through it, out loud, in the words of the rules.
Then ask whether the person affected would accept that as a reason.
What to watch for: Whether the path is a reason or just a route. If the questions are things like feature_47 above 0.31, the tree is readable in principle and useless in practice, and that is a feature problem again.
+Check yourselfIt marks itself, and nothing is sent anywhere.
Which of these is a tree good for, and which not?
Tap an item, then tap where it belongs. Dragging works too.
The tree picked the best question at every node. Does that give the best possible tree?
Sources
- SMS Spam Collection v.1
Almeida, Gómez Hidalgo & Yamakami
Every pile, count and gain on this page, on the same seeded 80/20 split the rest of the site uses.
Free to use with attribution to the authors' 2011 paper
- Induction of Decision Trees
J. R. Quinlan, Machine Learning 1(1), 1986
The algorithm this page runs: choose the split with the highest information gain, recurse, and stop when a pile is pure or too small.
- The Elements of Statistical Learning, second edition
Hastie, Tibshirani & Friedman (Springer, 2009)
Chapter 9 on trees: their instability, why greedy growth is not optimal, and why pruning exists.