This page explains how a classification tree turns recorded examples into branching questions.
In Section C, you compared options and explained a choice. A tree makes a different part of the reasoning visible: which question comes next, and where does each answer lead?
In Section B, you saw trees that map choices and uncertain outcomes. This lesson develops classification trees: they use the characteristics of a case to assign it to a category. The weather example classifies conditions as “Play” or “Don’t play.” This gives us a rule to follow, while the matrix in Section C helps weigh the consequences of a choice.
To follow a tree, we need to recognise its starting question, the paths it creates, and its final categories. The labels below describe those parts.
The Parts of a Tree
| Part | Role |
|---|---|
| Root | The first question and entry point at the top of the tree. |
| Question nodes | Tests that split cases into different paths. |
| Branches | Possible answers to each question. |
| Leaves | Final outcomes at the end of a path. |
| Classes | The possible output categories. |

Now that you can identify the parts, follow how they connect. A complete path tells us which conditions lead to a particular category.
2. Read a Tree as Decision Rules
Follow each path from the root to a leaf to form an if–then rule. In the weather example, “outlook” means sunny, overcast, or rainy conditions. Humidity measures moisture in the air. Read ≤ 70 as “70 or less” and > 70 as “more than 70.”
| Conditions | Result |
|---|---|
| Sunny and humidity ≤ 70 | Play |
| Sunny and humidity > 70 | Don’t play |
| Overcast | Play |
| Rain and windy | Don’t play |
| Rain and not windy | Play |
The table turns the diagram’s paths into rules. Try following one of those paths yourself before opening the answer.
Quick Check
It is sunny, humidity is 72, and it is windy. Which path would you follow, and what is the result?
Check Your Answer
Follow Sunny → Humidity > 70 → Don’t play. Wind is not needed on this branch.
Explore the Original 14-Day Dataset
A dataset is a collection of recorded examples. These 14 rows show the weather conditions and the “Play” label for each day. Compare the rows with the rules above.
| Day | Outlook | Humidity | Windy | Play |
| 1 | Sunny | 34 | Yes | Play |
| 2 | Sunny | 15 | No | Play |
| 3 | Sunny | 72 | Yes | Not Play |
| 4 | Sunny | 86 | Yes | Not Play |
| 5 | Sunny | 98 | No | Not Play |
| 6 | Overcast | 25 | Yes | Play |
| 7 | Overcast | 30 | Yes | Play |
| 8 | Overcast | 75 | No | Play |
| 9 | Overcast | 57 | No | Play |
| 10 | Rain | 72 | No | Play |
| 11 | Rain | 88 | No | Play |
| 12 | Rain | 93 | No | Play |
| 13 | Rain | 65 | Yes | Not Play |
| 14 | Rain | 59 | Yes | Not Play |
You can now follow an existing tree. But how do we choose its questions in the first place? Recorded examples can help us identify questions that separate the categories.
3. Build a Tree from Data
A tree can be built by hand or learned from examples using an algorithm: a step-by-step procedure. ID3 (Iterative Dichotomiser 3) is one such algorithm. It uses information gain, a measure of how much a question reduces the mixture of categories, to choose a split.
- Identify the target class: the category you want to predict, such as Play/Don’t play.
- Compare possible attributes (recorded characteristics, such as outlook) and how well they separate the categories.
- Split on the attribute with the greatest information gain.
- Repeat within mixed branches until no further split is needed or possible.
Key idea: ID3 makes the best local choice at each split—a greedy strategy. This does not guarantee the best overall tree, and fitting known examples does not guarantee accuracy on new ones.
Choosing questions also affects the shape of a tree. Some cases may reach an answer quickly while others need several questions. Consider how that affects clarity.
Tree Forms and Trade-offs

A more balanced tree distributes questions more evenly across paths. An uneven tree may reach some answers quickly while requiring more questions for others. Consider clarity, the longest path, and how well the rules work on new cases.
Going Further: Entropy and Information Gain
Entropy measures how mixed the target classes are. A branch containing only one class has entropy 0; a mixed branch has higher entropy.
H(S) = −Σ pᵢ log₂(pᵢ), where pᵢ is the proportion of examples in class i. Σ means add the terms for all classes; log₂ is a base-2 logarithm used in this calculation. Terms with pᵢ = 0 contribute 0.
Information gain = entropy before the split − weighted entropy after the split. Weight each resulting group by its share of the original dataset.
A question with greater information gain separates the classes more clearly. You can use this principle without doing the calculations in the activity on the next page.
You have followed a tree and seen how questions can separate categories. Next, build your own tree from the lesson’s fictional stock dataset.
