Introduction
A classification tree turns a set of predictor values into a route through a sequence of simple tests. Each test sends the case along a branch; the route ends at a terminal node, where the tree provides its classification output. Reading that route correctly is essential: a case that takes the wrong branch can end at a different terminal node even if every split in the tree is understood.
This tutorial focuses on the structure of a classification tree and on tracing cases through a tree that has already been specified. It does not address how a fitting procedure chooses the splits or estimates class probabilities. The examples assume that each case has values for all predictors used in the tree and that the stated branch rules are applied as written.
Nodes, Splits, Branches, and Paths
The parts of a tree describe different roles in the routing process. A split is a test applied to one or more predictor values, such as whether \(x_1 \leq 12\) or whether a category belongs to a specified group. A branch is a connection leaving a node and leading to a child node. Each branch corresponds to an outcome of the split at the parent node.
A node where the tree applies a split is an internal node. A node with no children and no further split is a terminal node, also called a leaf. A path is the ordered sequence of branches followed from the root to a terminal node. The conditions encountered along a path jointly describe which predictor values reach that leaf.
| Tree part | Meaning | Question to ask when reading it |
|---|---|---|
| Root node | Starting point for every case presented to the tree | What is the first test, if this node is nonterminal? |
| Internal node | A node that applies a predictor-based split | Which value or values are tested here? |
| Branch | A connection representing an outcome of a split | Which outcome does this branch represent? |
| Terminal node | A leaf with no further split | Where does this case’s route end? |
| Path | The sequence of branches from root to leaf | What conditions must all hold for the case to reach this leaf? |
For a binary numeric split such as \(x \leq c\), the two branches commonly correspond to \(x \leq c\) and \(x > c\). The boundary value \(c\) belongs to the first branch under that stated rule. A categorical split might send one specified set of categories down one branch and its complement down another. Some trees can have more than two branches at a node; in that case, each branch represents one of the explicitly stated outcomes.
The label displayed at a terminal node is the tree’s classification output for cases reaching that leaf. A terminal node may also display other summaries, but interpreting estimated class probabilities is a separate task. For routing, the essential information is the node’s split rule, the branch outcomes, and whether a node is terminal.
Why the Leaves Divide the Predictor Space
A useful way to read a path is as a set of simultaneous conditions. Suppose a path first follows \(x_1 \leq 12\), then follows \(x_2 > 4\). A case reaches the associated leaf only if both conditions hold. The path therefore identifies a region of the predictor space, not merely a list of separate labels.
The basic reason this works is that each split divides the cases arriving at a node among its child branches. For a binary test \(T\), one child receives cases for which \(T\) is true and the other receives cases for which \(T\) is false. These outcomes are mutually exclusive and together include every case for which the test is defined. Applying this fact successively down the tree gives the following result.
To justify the result, start with a case at the root. At the first split, exactly one of \(T\) and “not \(T\)” is true, so the case takes exactly one outgoing branch. The same argument applies at each subsequent internal node reached by the case. Because a finite tree has no endless sequence of child nodes, the route eventually ends at a node with no children: a terminal node. Since the case takes only one branch at every split, it cannot reach two different leaves. This argument relies on the branch rules being complete and unambiguous for the case; missing predictor values require an explicit handling rule if they are possible.
Tracing a Case Through a Numeric Split
Read a tree from the root downward. At each internal node, identify the predictor named in the test, compare the case’s value with the condition exactly as written, and follow the matching branch. Do not skip an internal node because another predictor seems more relevant, and do not treat a threshold as an approximate or smooth effect.
Worked Example: A Warranty-Claim Classification Tree
A hypothetical equipment warranty team uses this already-fitted tree to classify incoming claims as “Routine” or “Review.” The root tests whether operating hours are at most 2,000. The “Yes” branch leads to a test of whether the device has a sensor alert. For that test, “Yes” leads to a terminal node labelled “Review,” and “No” leads to a terminal node labelled “Routine.” The root’s “No” branch leads directly to a terminal node labelled “Review.” Trace two claims: Claim A has 2,000 operating hours and no sensor alert; Claim B has 2,001 operating hours and no sensor alert.
Method. Start at the root for each claim, evaluate its operating-hours test, and continue only if the selected branch leads to another internal node.
Claim A, first split. Its operating hours are 2,000. The root condition is “at most 2,000,” meaning \(2{,}000 \leq 2{,}000\), which is true. Claim A takes the “Yes” branch.
Claim A, second split. The next test asks whether there is a sensor alert. Claim A has no alert, so it takes the “No” branch and ends at the “Routine” terminal node. Its path is: operating hours at most 2,000; no sensor alert.
Claim B. Its operating hours are 2,001, so \(2{,}001 \leq 2{,}000\) is false. It takes the root’s “No” branch directly to the “Review” terminal node. The sensor-alert test is not reached, so Claim B’s alert value does not affect its route.
Check. Claim A ends at “Routine,” while Claim B ends at “Review.” The boundary value 2,000 follows the “Yes” branch because the rule says “at most,” not “less than.” This avoids the common mistake of assigning the boundary value to the other branch or evaluating a split that the case never reaches.
Categorical Splits and Multi-Step Paths
A categorical split routes cases according to category membership. For example, a node might test whether a service channel is “Online.” If the answer is Yes, the case takes one branch; if No, it takes the other. When a split groups several categories together, read the full group named by the rule. The category’s spelling or apparent similarity to another category does not change the test.
Worked Example: Routing Applications by Channel and History
A hypothetical training program uses this classification tree to label applications “Manual check” or “Standard.” The root asks whether the application channel is Online. The Yes branch leads to a split asking whether the applicant has prior program history: Yes leads to “Standard,” and No leads to “Manual check.” The root’s No branch leads to a split asking whether the channel is Partner. At that node, Yes leads to “Manual check” and No leads to “Standard.” Trace an Online applicant with no prior history and a Partner applicant with prior history.
Method. For each applicant, evaluate the root’s channel test first. At a second node, use only the test shown on the selected branch.
Online applicant, first split. The channel is Online, so the root test is true. The applicant takes the Yes branch to the prior-history test.
Online applicant, second split. The applicant has no prior history, so the answer to the second test is No. The route ends at “Manual check.” The full path conditions are: channel is Online; prior program history is absent.
Partner applicant, first split. The channel is Partner, not Online, so the root test is false. The applicant takes the No branch to the test asking whether the channel is Partner.
Partner applicant, second split. The answer is Yes, so the applicant reaches “Manual check.” The prior-history information is not used on this route because no node along the path tests it.
Check. Both applicants reach “Manual check,” but by different paths. The Online applicant’s route uses the history test, whereas the Partner applicant’s route does not. The common mistake avoided here is applying every listed predictor test to every applicant; a case is evaluated only at nodes on its own route.
Mixed Splits and Careful Branch Tracking
A tree can use different predictors at different nodes, and a predictor can appear more than once. The route is determined by the sequence of local tests, not by a single overall rule. Keep a short record of each decision as it is made. This is especially helpful when a later test reuses a predictor or when the tree has several levels.
Worked Example: A Multi-Level Equipment Inspection Tree
A hypothetical inspection service classifies equipment as “Inspect soon” or “Routine.” At the root, it tests whether days since the last service are at most 90. The Yes branch leads to a vibration test: vibration at most 4.5 leads to “Routine,” while vibration above 4.5 leads to “Inspect soon.” The root’s No branch leads to a temperature test: temperature at least 75 leads to “Inspect soon,” while temperature below 75 leads to a second vibration test. At that final test, vibration at most 4.5 leads to “Routine” and vibration above 4.5 leads to “Inspect soon.” Trace these records: (1) 90 service-gap days, vibration 4.5, temperature 80; (2) 91 service-gap days, temperature 74, vibration 4.6.
Method. Follow the root branch first, then evaluate only the tests encountered on that branch. Use the stated inclusive boundary at each split.
Record 1, root. The condition is days since service at most 90. Since \(90 \leq 90\), the result is Yes. The case goes to the first vibration test. Its temperature value is not used on this route.
Record 1, vibration test. The condition is vibration at most 4.5. Since \(4.5 \leq 4.5\), the case takes that branch to “Routine.” The path is: service gap at most 90 days; vibration at most 4.5.
Record 2, root. Since \(91 \leq 90\) is false, the case takes the No branch to the temperature test.
Record 2, temperature test. The rule is temperature at least 75. Since 74 is not at least 75, the case takes the branch for temperature below 75. It then reaches the second vibration test.
Record 2, second vibration test. Since \(4.6 \leq 4.5\) is false, vibration is above 4.5. The case ends at “Inspect soon.” Its path is: service gap above 90 days; temperature below 75; vibration above 4.5.
Check. Record 1 ends at “Routine,” and Record 2 ends at “Inspect soon.” The common mistake avoided is using Record 1’s temperature value even though its route never reaches a temperature node. A predictor value can be known and still be irrelevant to that case’s path.
Common Routing Errors
- Assuming the root must contain a split. The root is the starting node. It contains the first split only if it is nonterminal; a tree with no splits has a terminal root.
- Reversing an inequality. For a split stated as \(x \leq c\), the value exactly equal to \(c\) follows the “Yes” branch. Read the operator rather than relying on a visual impression of the diagram.
- Skipping a node or testing a predictor too early. Follow the path in order. A value is relevant to routing only if a reached node tests it.
- Confusing a branch with a node. A branch is the connection and its outcome; the child node is where the route arrives and where another test may occur.
- Stopping at an internal node. A case is not assigned the output of an internal node if the tree shows a further split there. Continue until reaching a terminal node.
- Assuming all trees are binary. Some trees can have more than two branches at a node. Follow the stated outcome categories instead of forcing a Yes/No interpretation.
Check Your Understanding
For each problem, trace the route using only the split rules provided. Assume all predictor values are present.
- A tree tests at its root whether monthly usage is at most 300. Yes leads to “Low-use,” and No leads to “High-use.” What label does a case with usage 300 receive? (Answer: Low-use.)
- A tree tests whether the intake channel is Mobile. Yes leads to a test of whether the application is complete; Yes gives “Fast track,” No gives “Follow-up.” The root’s No branch is terminal and labelled “Standard.” What is the route and label for a complete Web application? (Answer: Not Mobile; terminal node Standard.)
- A root tests whether account age is below 2 years. Yes leads to “Review”; No leads to a test of whether the account has an alert, where Yes gives “Review” and No gives “Routine.” What label does a 2-year-old account with no alert receive? (Answer: No, account age is below 2 years; then No, alert is present; label Routine.)
- A root tests whether a sensor reading is above 10. Yes leads to a test of whether the site is Coastal; Coastal gives “Inspect” and non-Coastal gives “Routine.” The root’s No branch is terminal and labelled “Routine.” What label does a case with reading 10 at a Coastal site receive, and which test is not reached? (Answer: Routine; the Coastal test is not reached.)
- A tree has a root that tests whether the category is A. Yes leads to a terminal node labelled “Class 1.” No leads to a test of whether score is at least 70; Yes gives “Class 2,” and No gives “Class 1.” Trace a category B case with score 70. (Answer: Category is not A; score is at least 70; terminal label Class 2.)