2.3.1 · D3Tree-Based & Instance Methods

Worked examples — Decision tree structure and terminology

2,584 words12 min readBack to topic

Everything below reuses only ideas already earned in the parent: a leaf owns a set of samples ; a classification leaf predicts the majority class (fewest wrong labels); a regression leaf predicts the mean (smallest squared error); depth = number of edges on the longest root-to-leaf path.


The scenario matrix

Every worked example below is tagged with the cell of this matrix it covers. Together they fill every cell.

Cell Case class What is "extreme / degenerate" about it
C1 Classification leaf, clear majority ordinary, sanity-anchor
C2 Classification leaf, tie in counts two classes equally frequent — which wins?
C3 Classification leaf, pure (one class only) impurity , degenerate happy case
R1 Regression leaf, several targets mean of a spread
R2 Regression leaf, single sample mean of one number — memorisation limit
G1 Geometry: two axis-aligned splits → boxes the "staircase" made visible
G2 A diagonal boundary a tree cannot draw limiting behaviour: infinitely many steps
D1 Depth counting with an unbalanced tree worst-case path, not average
W1 Real-world word problem (loan approval path) reading a root-to-leaf rule
X1 Exam twist: does adding a split always cut training error? zero / no-op split, sign of gain

C1 — Classification leaf with a clear majority


C2 — A tie: two classes equally frequent


C3 — A pure leaf


R1 — Regression leaf, several targets


R2 — Regression leaf with a single sample (memorisation limit)


G1 — Two axis-aligned splits build boxes


G2 — The diagonal a tree cannot draw


D1 — Depth of an unbalanced tree


W1 — Real-world word problem: reading a decision path


X1 — Exam twist: does a split always reduce training error?


Recall

Recall Quick self-test

Leaf with — prediction and error count? ::: Predict ; error . Leaf with — is prediction well-defined? ::: Loss is (both give error ); label picked by fixed tie-break convention. Regression leaf — prediction and SSE? ::: Mean ; SSE . Single-sample regression leaf — training error? ::: Exactly (perfect fit — overfitting limit). Tree with paths of edge-lengths — depth? ::: (the max, not the average). Can a split raise training error? ::: No — it drops or stays flat; a no-op/empty-child split gives zero gain.


Connections

  • Gini impurity and entropy — turns the "how pure is this leaf" question (C2, C3, R1) into a number the splitter maximises gain on.
  • CART algorithm — the greedy loop that searches splits like X1 to pick the best one.
  • Overfitting and pruning — why the single-sample leaf (R2) and infinite staircase (G2) are dangers, and how to stop.
  • Random Forests — averaging many staircases (G2) to smooth the boundary.
  • Gradient Boosted Trees — stacking trees to fix leftover errors like the stuck in X1.
  • Bias-variance tradeoff — deep trees (R2) are low bias, high variance.

Concept Map

labels

numbers

predicts

predicts

equal counts

zero error

one point

cannot tilt

Leaf owns samples

Classification leaf

Regression leaf

Majority vote

Mean of targets

Tie case C2

Pure leaf C3

Single sample R2

Axis-aligned boxes G1

Diagonal limit G2

Depth is longest path D1