In cost-complexity pruning, the cost of a tree is Rα(T)=R(T)+α∣T∣, where R(T) is the training error rate and ∣T∣ the number of leaves. Node t (as a leaf) has R(t)=0.10, and the subtree below it has 4 leaves with total error R(Tt)=0.04. Node u in another branch has R(u)=0.06, and its subtree has 2 leaves with R(Tu)=0.03. At what α is each pruned, which goes first, and how is α chosen?

Supervised learning, Pruning
Level L2 Elementary. Length Medium. Nature Th+Mat Both.

What's being asked

Whether you can compute the weakest-link α for a node and explain how pruning produces a nested sequence of trees.

Key idea

A subtree Tt is worth keeping while R(t)+α>R(Tt)+α∣Tt∣. The break-even value is αt=R(t)−R(Tt)∣Tt∣−1: the error saved per extra leaf.

Steps

  1. Collapsing t to a leaf changes the cost from R(Tt)+α∣Tt∣ to R(t)+α. They are equal when α=R(t)−R(Tt)∣Tt∣−1.
  2. Node t: αt=(0.10−0.04)/(4−1)=0.06/3=0.02.
  3. Node u: αu=(0.06−0.03)/(2−1)=0.03.
  4. Weakest link: the smallest α is pruned first. So t goes at α=0.02 and u at α=0.03. At α=0.025 only t has been collapsed.
  5. Repeat (recompute the α values on the pruned tree) to get a nested sequence of trees T0⊃T1⊃⋯⊃ root.
  6. Choose α by K-fold cross-validation: pick the one with the lowest validation error, often with the 1-standard-error rule to prefer the smaller tree. Then use that α on the full data. We must not choose it using training error, because that always prefers α=0.

Common mistakes

How long your answer should be

A short paragraph and 3 lines of arithmetic.

Read this

Previous in Supervised learning: A regression tree is grown on x=1,2,3,4,5,6 with y=2,3,2,9,10,8. Which threshold does the first split choose using the sum of squared errors (SSE), and what are the leaf predictions and the SSE reduction?
Next in Supervised learning: In stacking, a meta-learner is trained on the predictions of base models. Why must the meta-features be out-of-fold predictions, and how are they produced with 5-fold cross-validation for 3 base models? What goes wrong if you use the base models' predictions on their own training data?