Decision trees: yes/no forks from entropy
Paint two classes of dots and watch ID3 stack axis-aligned cuts. Each split chases information gain until regions turn pure. Readable rules, no black box.
Last week beam search kept parallel token stories alive while decoding. This week the logic is symbolic and legible: a decision tree is just nested if questions on features. Feed it labeled dots and it grows yes/no forks until each region holds one class. No gradient vectors, no hidden weights. You can read the whole classifier aloud.
The gadget uses a tiny ID3 rule: at each step it tries every horizontal and vertical cut, scores information gain (entropy before minus weighted entropy after), and keeps the winner. That is classic supervised learning from the era when engineers still sketched symbolic AI flowcharts. Banks and factories loved the result because auditors could follow the branches.
Above the canvas, three bullets define entropy, information gain, and the tinted regions. The stats line counts class A/B dots; each split shows up as a plain-language question with “mix dropped”.
How to play:
- Click Easy split a few times: every click scatters a slightly different cloud. Then Grow one split and read the live explanation under the canvas.
- Switch to Two steps, grow twice, and see the stair-shaped layout need two different axes.
- Open XOR-ish, set max depth to 2, grow fully: the checkerboard leaks mistakes in the tinted regions.
- Raise max depth to 4, hit Grow to max depth, and watch stacked cuts carve four pure corners.
Try this:
- Paint your own cloud on the canvas, then step split by split. Does the tree match your intuition?
- Compare entropy (root) to the gain on the first split: big gain means the cut really sorted the mess.
Why this matters
Decision trees powered 1980s expert systems and still sit inside random forests and gradient boosting stacks that win tabular data competitions. They trade raw accuracy for explainability, a concern that never went away. Pair this toy with last week’s k-NN (geometry, no training) and the perceptron (one thick line). Trees sit in the middle: trained from labels, but the artifact stays human-readable.
Missed the earlier editions? Train a perceptron, watch a Markov chain babble, lose to unbeatable tic-tac-toe, teach a filter to see edges, watch an agent learn from reward, see how a model reads text in tokens, watch one roll downhill to learn, let a machine find groups on its own, see a line learn to bend, watch words decide who to listen to, explore vs exploit on slot machines, chat with ELIZA, scribble Hopfield memory, count words for spam, paint walls for A*, spin softmax temperature, let neighbors vote, or keep more than one story alive.
- Entropy (0–1): how mixed the labels are. 0 = one class only; 1 = fifty-fifty A/B, maximum uncertainty.
- Information gain: entropy before a cut minus weighted entropy after. Bigger gain = the question sorted more points.
- Tinted rectangles = the tree’s guess in each box at the depth you show. Dashed lines = yes/no questions (left or below the line vs the other side).