A decision tree predicts by asking a sequence of feature-based questions. Each decision node sends an example down one branch; the leaf reached returns a class label for classification or a numeric value for regression. The resulting paths partition feature space into nonoverlapping regions, making the model’s logic directly inspectable. section 1.3.1 section 9.1.2
Figure 1.3 Decision trees partition the feature space into axis-parallel rectangles. When used for classification, the tree checks for conditions on the features in the decision nodes, funneling the example to the left or right after each test. Ultimately, the example filters down to a leaf node, which will give its classification label. The partition of the feature space according to this decision tree is shown on the left.
The feature-space view shows how successive threshold tests carve inputs into axis-parallel regions, with a leaf prediction assigned to each region. section 1.3.1
Tree depth controls complexity. A depth-1 tree, or decision stump, has one test and two leaves, so it represents only simple functions. Adding nodes creates richer feature combinations and nonlinear behavior, but a very deep tree can fit training data nearly perfectly while generalizing poorly to new data. section 1.3.1 section 7.1.5
A practical workflow is:
- Start with labeled training data and reserve test data for evaluation. section 1.3
- Train trees across a range of maximum depths rather than assuming that a more complex tree is better. section 1.3.1
- Compare training and test R² for regression; a widening gap signals overfitting. section 1.3.1
- Inspect the learned splits and paths to identify the features and rules driving predictions. section 9.1.2
Nonlinear regression with a bounded-depth tree
For noisy samples from a one-variable nonlinear function, a DecisionTreeRegressor with max_depth=5 is trained on a training split and evaluated with mean squared and mean absolute error on held-out data. The tree is one of two nonlinear regression approaches compared, alongside a neural network regressor. section 7.1.5
Trees are useful when prediction logic must be understandable. On Iris classification, root-to-leaf paths can be rewritten as ordinary conditional rules; a trained tree uses petal width and petal length to separate three species. Such sparse, sequential rules make a tree a glass-box model rather than a black-box predictor. section 9.1.2
Figure 9.3 Decision tree learned on the Iris data set for classification of irises into three species: Iris setosa, Iris versicolour, and Iris virginica. The standard convention for splits is followed here: if the split function evaluates to true, we proceed to the right branch; if it evaluates to false, the left branch.
The rendered Iris tree makes each split, branch choice, and leaf-level class prediction visible as a readable decision process. section 9.1.2












