Decision Tree Learning (Likelihood Splits, Pruning, CV)

Context: FIT2086_MOC · how a decision tree is grown and sized · the split score is the Bernoulli NLL from Maximum Likelihood Estimation · sizing reuses Model Selection and Information Criteria (AIC, BIC) and Cross-Validation with as the complexity Parent Framework: Decision Trees and Regression Trees

Quick Revision

  • 🎯 Objective: score a split by the minimised NLL of its leaves ➔ purer leaves = smaller NLL ➔ grow greedily, then size by IC or CV.
  • 📦 Core Components: split score ➔ Bernoulli NLL per leaf | forward search ➔ greedy, stop when no split lowers the score | prune ➔ grow big, cut back to the best .
  • ⚠️ Key Constraint: splitting can never increase the minimised NLL ⟹ NLL alone always grows the tree to (perfect fit, overfit) ⟹ the tree must be penalised (IC) or cross-validated.

📝 How It Works

1. Why Not Just Maximise the Likelihood

  • Perfect fit ➔ if predictor values distinguish every observation, a large enough fits the training data perfectly ➔ overfits.
  • Model selection instead ➔ score every tree by AIC, BIC, … or a CV error ➔ choose the smallest score ➔ trades goodness-of-fit against tree complexity.
  • Search is approximate ➔ the number of possible trees is enormous even for moderate ⟹ greedy search, never exhaustive.

2. What Makes a Good Split

  • Setup ➔ binary targets in one leaf; ones, zeros.
  • Leaf score ➔ minimised Bernoulli NLL (with ).
  • Purity reading ➔ largest at (least pure) · zero at or (pure) · symmetric in ➔ : peaks at when .
  • Split score ➔ sum the leaf NLLs; the best split has the smallest total.
  • Numeric predictor ➔ search thresholds : leaves and ➔ keep the giving the smallest total NLL.
  • Never worse ➔ the unsplit fit is the special case of the split model ⟹ the split’s minimum NLL the parent’s ⟹ likelihood guides which split, not whether to stop.
  1. Start with one leaf (the root).
  2. Try splitting on every predictor (every threshold) and compute the criterion score of each resulting tree.
  3. If no split improves (lowers) the score ➔ stop.
  4. Otherwise take the split giving the smallest score.
  5. Go back to step 2.
  • Greedy ➔ each step is locally best; an early bad split is never undone.

4. Pruning and K-fold CV for Trees

  • Pruning ➔ grow a large, overfitted tree (forward search, splitting on whatever cuts NLL most) ➔ prune back subtrees (replace a subtree by one leaf) ➔ how far is set by an information criterion ➔ still approximate, but often better than forward search.
  • CV sizing ➔ complexity parameter ; input ; for : split into disjoint folds; for : grow a tree with leaves on all folds except ➔ prune to ➔ predict fold with all pruned trees ➔ accumulate errors; average over the runs.
  • Choose ➔ ➔ grow the final tree with leaves on all the data.
  • Cost per run ➔ big trees grown, pruned trees scored.

🧮 Proof Blueprint

  • Theorem ➔ for a leaf with ones among , .
  • Strategy ➔ write the iid Bernoulli likelihood, plug in the MLE (Maximum Likelihood Estimation), take .
  • Derivation Steps:
  • Q.E.D. ➔ the leaf score is the entropy of the leaf’s class proportions — the “purity” measure falls out of maximum likelihood.

📊 Exam Execution Trace & Applied Exercises

Manual Execution Trace

Toy data, , binary predictors :

12345678910
1101000110
0000011111
1101100010
StepTreeLeaf values per leafLeaf NLLsTotal NLL
0rootall 10
1split : · : ·
2split : · : ·
  • Verdict ➔ gives much purer leaves (, vs , ) ⟹ split on .

Greedy growth on 185 patients (leaf label ; score = the lecture’s information criterion, lower is better):

StepActionLeavesScoreKept?
0root—
1split on SexM · F ✓ improves
2split Female on Age M · F · F ✓ improves
3also split Male on Age M · M · · ✗ worse ➔ stop

Applied Exercise

Problem: a leaf holds with , . Find and the leaf NLL; is it purer than a leaf? Then compare split A (leaves and ) with split B ( and ).

Final Extracted Output: , NLL ⟹ purer than ; split B wins ().

⚠️ Common Mistakes

  • 💡 Selecting the tree by training NLL ➔ it only ever falls as grows; select by IC or CV error.
  • 💡 Averaging leaf NLLs ➔ the split score is the sum over leaves (each already carries its own ).
  • 💡 Keeping a CV fold’s tree as the answer ➔ CV picks ; the final tree is regrown on all the data.

🧠 Active Recall