Guided Starter Example
Animal-weight prediction: - Leaf A receives weights [7.2, 8.4, 7.6, 10.2] -> prediction = average = 8.35 - Leaf B receives [9.2] -> prediction = 9.2 For a new animal routed to Leaf A, the model outputs 8.35 lbs.
Generalizing decision trees from class prediction to numeric prediction by minimizing weighted variance and predicting leaf averages.
Regression trees are decision trees for numeric targets. Instead of predicting class labels at leaves, they predict a number. The leaf prediction is usually the average target value of training samples that reached that leaf.
Core difference from classification trees:
Node split scoring: at each node, compute variance of the target at the parent node, then subtract weighted child variances after a candidate split:
variance reduction = Var(parent) - [w_left * Var(left) + w_right * Var(right)]
Choose the split with the highest reduction. This is the regression analogue of information gain.
Leaf prediction rule: once stopping criteria are met (depth limit, low variance reduction, low sample count), output the mean target of leaf samples. That mean is the model's prediction for every future sample routed to that leaf.
Production implication: regression trees are piecewise-constant models. They perform well when target behavior changes across interpretable segments but can be unstable with very small leaves or noisy labels.
Failure mode: over-deep trees can memorize small target fluctuations. Use depth/min-samples/min-gain controls and validation-based tuning.
Source-backed reinforcement: these points add detail beyond short-duration UI hints and emphasize production tradeoffs.
First-time learner note: Read each model as a dataflow system: inputs become representations, representations become scores, and scores become decisions through a chosen loss and thresholding policy.
Production note: Track three things relentlessly in ML systems: data shape contracts, evaluation methodology, and the operational meaning of the model's errors. Most expensive failures come from one of those three.
Regression-tree objective: instead of reducing class impurity, each split tries to reduce target spread inside child nodes. The practical proxy is weighted variance (or weighted squared error), so the algorithm keeps partitioning until numeric targets inside leaves are stable enough to summarize by a mean.
Architecture implication: regression trees are piecewise-constant function approximators. They are often strong on tabular data with sharp regime changes, but they can look stair-stepped on smooth physical relationships unless depth and leaf-size constraints are tuned carefully.
Exhaustive coverage points to ensure complete topic understanding without missing core concepts.
Animal-weight prediction: - Leaf A receives weights [7.2, 8.4, 7.6, 10.2] -> prediction = average = 8.35 - Leaf B receives [9.2] -> prediction = 9.2 For a new animal routed to Leaf A, the model outputs 8.35 lbs.
Guided Starter Example
Animal-weight prediction: - Leaf A receives weights [7.2, 8.4, 7.6, 10.2] -> prediction = average = 8.35 - Leaf B receives [9.2] -> prediction = 9.2 For a new animal routed to Leaf A, the model outputs 8.35 lbs.
Source-grounded Practical Scenario
Generalizing decision trees from class prediction to numeric prediction by minimizing weighted variance and predicting leaf averages.
Source-grounded Practical Scenario
Regression trees are decision trees for numeric targets.
Concept-to-code walkthrough checklist for this topic.
Questions an interviewer is likely to ask about this topic. Think through your answer before reading the senior angle.
Test yourself before moving on. Flip each card to check your understanding โ great for quick revision before an interview.
Drag to reorder the architecture flow for Regression Trees. This is designed as an interview rehearsal for explaining end-to-end execution.
Start flipping cards to track your progress
What does a regression-tree leaf output?
tap to reveal โA numeric prediction, typically the mean target value of training samples in that leaf.