Decision Tree Regression for Time Series

Created by Dr. Pedram Jahangiry | Enhanced with Claude

This tool fits a decision tree to two lagged values of the classic airline passenger series and redraws the tree diagram, the Lag_1/Lag_2 decision boundaries, and the resulting forecast every time you drag the depth or horizon slider. Because each leaf can only output the average of the training points that land in it, watch the forecast flatten into a staircase and drift away from the trend the further out you push the horizon.

Understanding Decision Tree Regression for Forecasting

This visualization demonstrates how Decision Trees work for time series forecasting using the classic airline passenger dataset. The model uses lagged features (Lag_1 and Lag_2) to predict future passenger counts.

Key Concept: Decision Trees partition the feature space using recursive splits. Each split creates a boundary that divides the data into regions with similar target values. The final prediction in each region is the average of all training points in that region.

2
12
Decision Tree Structure
Feature Space: Lag_1 vs Lag_2 with Decision Boundaries
Time Series: Actual vs Predicted Passengers

Why Decision Trees Struggle with Time Series Forecasting