Notes

Decision Tree Regressor

A decision tree regressor is a way to predict a number (like a price or a demand level) by asking a sequence of simple questions about the input features. It feels a bit like a flowchart: each answer sends you down a branch until you land at a final prediction.

How it makes predictions

A Decision Tree Regressor splits the feature space into regions using rules such as “square_feet < 1,800” or “days_since_last_purchase ≥ 30.” Training builds the tree top-down: at each node it chooses the split that most reduces prediction error in the child nodes. For regression, the common criterion is reducing mean squared error (MSE), which is equivalent to reducing variance within each region. Once a data point reaches a leaf, the prediction is typically the mean target value of the training samples in that leaf.

Why it’s useful (and what can go wrong)

Trees handle nonlinear relationships and feature interactions without requiring you to manually create polynomial features. They’re also easy to visualize and explain. The main risk is overfitting: a deep tree can memorize noise, giving very low training error but poor test performance. Practical control knobs include max_depth, min_samples_leaf, and min_samples_split.

Practical examples and where you’ll see it
  • House price prediction: splits on neighborhood, size, and age; leaf predicts average price for similar homes.
  • Demand forecasting: splits on season, promotions, and store type; leaf predicts expected units sold.
  • Credit risk as a continuous score: splits on utilization and income; leaf outputs an estimated loss amount.

In scikit-learn, you’ll encounter it as

sklearn.tree.DecisionTreeRegressor
.

A Decision Tree Regressor is a supervised learning model that predicts a continuous target by recursively splitting the feature space with if-then rules to form a tree, then outputting a numeric value at each leaf (commonly the mean of training targets in that region). It matters because it provides an interpretable, nonparametric baseline for regression and serves as a core building block for ensemble methods like Random Forests and Gradient Boosting.

Think of a game of “20 Questions,” but instead of guessing an object, you’re estimating a number. A Decision Tree Regressor asks a series of simple yes/no questions about something you know (like a house’s size, neighborhood, and age). Each answer sends you down a different branch of a tree. When you reach the end, the model gives a final numeric guess—like the predicted sale price.

It matters because many real-world problems are about predicting amounts, not categories: delivery time, energy use, or how much a customer might spend. The “tree” structure also makes its reasoning feel easy to follow.