Decision Trees and Regression Trees

Context: FIT1043_MOC Β· a predictive model you can read as rules Β· splits the feature space into regions Β· the building block of a Random Forest

Quick Revision

  • 🎯 Objective: classify or predict by walking a tree of feature tests βž” decision tree = categorical, regression tree = real value.
  • πŸ“¦ Core Components: recursive partitioning | leaf prediction (mode vs mean) | split criterion (purity/info gain).
  • ⚑ Key Constraint: the algorithm’s choices β€” which feature to split on (purity/information gain) and when to stop β€” determine the tree.

πŸ“ 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.

βš™οΈ Core Implementation

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

βš–οΈ Core Decision Matrix

TreePredictsLeaf value
Decision treecategory (yes/no, classes)most common class in region
Regression treereal valueaverage value in region

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