What Is a Decision Tree?

A decision tree classifies an example by asking a sequence of questions about its attributes:

  • Each internal node tests one attribute ("Outlook?").
  • Each branch corresponds to one value (or range) of that attribute ("Sunny").
  • Each leaf gives a prediction ("Play = No").

To classify, start at the root and follow the branches matching the example until you reach a leaf.

Outlook? SunnyOvercastRain Humidity? Yes Wind? HighNormal StrongWeak No Yes No Yes
Mitchell's PlayTennis tree. A Sunny, High-humidity day → No. This is the exact tree ID3 learns in §6.3.

Trees are logic

Every root-to-leaf path is a conjunction (AND) of tests. The whole tree is a disjunction (OR) of the paths ending in "Yes":

$$ \text{Play} \iff (\text{Sunny} \wedge \text{Normal}) \;\vee\; (\text{Overcast}) \;\vee\; (\text{Rain} \wedge \text{Weak}). $$

This is disjunctive normal form. So trees can be converted directly into human-readable if-then rules, and that is a huge practical advantage. Medicine, finance and law often require explainable models.

How expressive are trees?

For Boolean attributes, any Boolean function can be written as a decision tree: in the worst case, give each row of the truth table its own path. But some functions need huge trees:

  • Majority ("Yes if more than half the attributes are true") and parity (XOR, "Yes if an odd number are true") need exponentially many nodes. No single attribute is informative on its own. Only the combination is.
  • For continuous attributes, trees make axis-parallel splits ("distance ≤ 3.2"). A diagonal boundary like "late if distance + hour/2 > 14" can only be approximated by a staircase.

Why not just try every tree?

How many distinct Boolean functions are there on \(n\) Boolean attributes? A truth table has \(2^n\) rows, and each row can be Yes or No, so there are

$$ 2^{2^n} \text{ functions.} $$

For \(n = 6\) that's \(2^{64} \approx 1.8\times 10^{19}\). For \(n = 10\) it's about \(10^{308}\). The space is far too big to search exhaustively. Even finding the smallest consistent tree is NP-hard. So we use a greedy heuristic: build the tree top-down and pick the "most important" attribute at each node. Defining "most important" is the job of §6.2.

Connections: inductive bias, again

A tree that memorizes the training set always exists (one leaf per example), and it generalizes terribly, like the degree-14 polynomial in §2.2. We want a small tree consistent with the data. This preference for simplicity is Occam's razor: among hypotheses that fit the data, prefer the simplest. Why does it work? There are far fewer small trees than big ones, so a small tree that fits the data is unlikely to fit by coincidence. That's the same intuition as "low-variance models generalize."

When are trees a good choice?

  • Instances are attribute–value pairs (tabular data).
  • The target is discrete (classification). Regression trees exist too: their leaves hold numbers.
  • An explanation is needed (disjunctive rules).
  • The data may contain noise or missing values (§6.4).
  • Features have different scales and types. Trees don't care about scaling, and they mix categorical and numeric features freely.