Curvingo · Made in India

Glossary

Select one of the keywords on the left…

Decision TreesIntroduction

Reading time: ~10 min

Meena runs a fruit stall at the Vashi mandi in Navi Mumbai. Her two best sellers look alike to a beginner: the round, golden Alphonso (₹80 each) and the long, greenish Totapuri (₹20 each). This morning two crates tipped over and the mangoes rolled together. Her new helper Sonu cannot tell them apart — and every Alphonso he sells at the Totapuri price loses her ₹60.

Meena has no time to teach Sonu everything she knows. She wants a short list of yes/no questions that he can follow.

First, a warm-up game. Sina has secretly picked one of these eight mangoes; each card shows its weight and its length. Ask yes/no questions until only one card is left.

The best questions cut the cards that are left in half: 8, then 4, then 2, then 1 — three questions, whichever mango Sina picks. A question whose answer you already know cuts nothing at all. Hold on to that idea: it is exactly how a computer chooses its questions.

Roots, Branches and Leaves

Write your questions down as a flowchart and you have a decision tree. Each question is a decision node, and it asks about one feature, like "Is it heavier than 275 g?". The very first question is the root node. Each answer, yes or no, is a branch that leads to the next question. A path ends at a leaf node, which holds the tree's .

Training a decision tree means letting the computer choose the questions, their order and their cut-off values, from examples whose answers we already know. When a tree is finished, what sits at the very end of every path?

A decision node
The root node
A leaf node

Why decision trees?

You can read a decision tree like a recipe. To see why it called a mango an Alphonso, follow its path from the root: "no longer than 10.25 cm, no heavier than 292.5 g". Many other models are a "black box" whose reasons are hard to see; a tree shows its reasoning.

Sina