Developers · September 15, 2026
Forecasting Future Values with Decision Trees
A new article discusses the application of decision tree-based models for forecasting future values from time series data. The piece outlines how to convert raw time series into a structured supervised learning dataset and apply these models effectively.
The article highlights that decision tree-based models are commonly used in machine learning for various predictive tasks, including classification and regression, primarily with structured, tabular data. However, when paired with appropriate data processing and feature extraction methods, these models can also be utilized for more complex data types such as text, images, and time series.
A practical segment of the article features a tutorial on using a monthly airline passengers dataset, which is accessible in the sktime library. This dataset provides monthly passenger counts indexed by year-month from 1949 to 1960, serving as a single-variable time series.
To create a fully structured dataset, the article introduces a custom function called make_lagged_df_with_rolling, which processes the raw time series data. This function generates important features necessary for effective predictions. The training and testing of the decision tree follow standard procedures using scikit-learn, focusing on predicting passenger numbers for future months based on the extracted features.
The author notes that the mean absolute error (MAE) from one run was approximately 45.32, indicating decent predictive accuracy, though there remain opportunities for enhancement through ensemble methods and hyperparameter tuning. The approach differs from traditional methods by predicting future values based on various features instead of solely on past values of the same variable.