Decision Trees and Regression Trees

Context: FIT1043_MOC, FIT2086_MOC, FIT3003_MOC Β· a predictive model you can read as rules Β· splits the feature space into regions Β· the building block of a Random Forest Β· how FIT2086 grows and sizes one βž” Decision Tree Learning (Likelihood Splits, Pruning, CV) Β· FIT3003’s hand build by lowest SSR βž” Regression Tree Construction (SSR Splits)

Quick Revision

  • 🎯 Objective: classify or predict by walking a tree of feature tests βž” decision tree = categorical, regression tree = real value; each leaf holds a fitted model for its region.
  • πŸ“¦ Core Components: recursive partitioning | leaf model (Bernoulli/mode vs Normal/mean) | split criterion (purity/info gain; FIT2086: NLL) | complexity number of leaves.
  • ⚑ Key Constraint: the algorithm’s choices β€” which feature to split on and when to stop β€” determine the tree; a large enough fits the training data perfectly ⟹ overfits.

πŸ“ How It Works

1. Two Kinds of Tree

  • Decision tree βž” predicts a binary/multi-class categorical outcome (play tennis: yes/no).
  • Regression tree βž” predicts a continuous real value (leaves hold numbers like 45.6).
  • Structure βž” start at the root, follow a branch per feature test, reach a leaf = the prediction.

2. Building & Predicting

  • Recursive partitioning βž” repeatedly divide the feature space into regions that group similar instances together.
  • Decision-tree leaf βž” predict the most common class in that region.
  • Regression-tree leaf βž” predict the average value in that region.

3. Split Criteria & Stopping

  • Which feature to split βž” chosen by a purity / information-gain measure (e.g. entropy); algorithms differ β€” ID3, C4.5, CART.
  • When to stop βž” further splits stop helping: minimum samples per node, maximum depth, or negligible accuracy gain.

4. The Statistical View (FIT2086)

  • Same job as regression βž” ; only the form of differs β€” highly non-linear, yet still interpretable.
  • Partition βž” the splits carve predictor space into disjoint regions ; each region is a leaf.
  • Leaf model βž” each leaf holds a model fitted to its own data: Bernoulli for binary targets Β· Normal (own mean and variance) for regression.
  • Predict βž” traverse from the root taking the branch your satisfies βž” use that leaf’s model.
  • Complexity βž” (number of leaves) βž” more leaves ⟹ closer fit to the training data.
  • Multi-class βž” generalises directly β€” the leaf model becomes a categorical distribution.

5. Strengths, Weaknesses, Instability (FIT2086)

  • Strengths βž” highly interpretable Β· handles non-linearity Β· handles interactions (split on then on ⟹ they interact) Β· mixes continuous, categorical and count predictors Β· multiclass for free Β· variable selection built in (unused predictors never split).
  • Non-linearity, regression βž” truth : linear fit misses the curve; trees with leaves give ever finer staircases, tracing it almost exactly.
  • Non-linearity, classification βž” tree boundary = axis-aligned step line; Logistic Regression boundary = one straight line.
  • Weaknesses βž” good tree hard to find (search is approximate) Β· unstable β€” a slight data change can give a drastically different tree Β· inefficient when the truth is linear (many leaves, many parameters to approximate a line).
  • Instability, same 185 patients βž” three trees score , , β€” near-equal fits, different structures βž” no clear winner ⟹ motivates random forests.
  • Instability, Studio 9 diabetes βž” CV-pruning the 14-leaf tree to 7 leaves moves the worst-progression leaf from BMI & BP () to BMI & BP & S6 (), while BP still predicts ⟹ similar predictions, different structure βž” Trees, Forests and kNN in R (rpart, randomForest, kknn).

βš™οΈ Core Implementation

πŸ”Ή Decision tree β€” β€œplay tennis?”

πŸ”Ή Decision tree β€” high blood pressure (FIT2086)

βš–οΈ Core Decision Matrix

TreePredictsLeaf valueFIT2086 leaf model
Decision treecategory (yes/no, classes)most common class in regionBernoulli / categorical,
Regression treereal valueaverage value in regionNormal, own and

When It Flips: both trees are built the same way (recursively partition the feature space); they differ only in the leaf rule β€” mode for classification, mean for regression.

🧠 Active Recall