A Hybrid LSTM–XGBoost Framework Optimized by Particle Swarm Optimization for Short-Term Energy Demand Forecasting Using Large-Scale Smart Meter Data

Authors

  • Rand Jalal Institute of Informatics for Postgraduate Studies, University of Information and Communications Technology, Iraq
  • Intisar Al-Mejibli Biomedical Informatics College, University of Information Technology and Communications, Baghdad, Iraq

DOI:

https://doi.org/10.29304/jqcsm.2026.18.32974

Keywords:

Keywords Energy demand forecasting; Smart grids; LSTM; XGBoost; Particle Swarm Optimization; Hybrid models; Time-series forecasting.

Abstract

Abstract

Rapid proliferation of cloud storage services has enlarged the issue of protecting user data from

The short term electricity demand forecast is an essential for the operation of smart grid, demand response programs, peak load management and sustainable energy planning. Given the nonlinear, dynamic and time-dependent nature of the energy demand patterns, however, predicting electricity consumption remains difficult. To tackle these challenges, the present study proposes to optimize the Hybrid LSTM–XGBoost forecasting framework by exploiting the advantage of temporal sequence learning of LSTM networks and the nonlinear regression power of Extreme Gradient Boosting (XGBoost). Moreover, Particle Swarm Optimization (PSO) algorithm is used to automatically optimize the hyperparameters of XGBoost component to improve the forecasting accuracy and eliminate the need for extensive manual tuning. A Walk-Forward Validation (WFV) strategy is used during the experimental process to achieve realistic and leakage-free model assessment. The proposed framework is evaluated based on a large-scale real world data set of smart meters gathered by the Pecan Street project which produces high-resolution measurements of residential electricity consumption. A scalable pre-processing pipeline and extensive feature engineering approach are designed to capture temporal, lag-based and statistical features that represent the electricity consumption behavior well. The experimental results validate that the proposed Hybrid LSTM–XGBoost + PSO model always has better performance than the baseline XGBoost model and the non-optimized Hybrid LSTM–XGBoost model. The proposed approach gives the minimum forecasting error, maximum coefficient of determination, and consistent results in all the walk forward period validation folds. The results suggest that the deep temporal feature extraction, ensemble regression, intelligent hyperparameter tuning, and leakage-free time-aware assessment methods are an accurate, robust, and practical approach to short-term electricity demand forecasting in smart grid settings.

Downloads

Download data is not yet available.

References

References

T. Chen and C. Guestrin, “XGBoost: A scalable tree boosting system,” in Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), San Francisco, CA, USA, 2016, pp. 785–794.

S. Hochreiter and J. Schmidhuber, “Long short-term memory,” Neural Computation, vol. 9, no. 8, pp. 1735–1780, 1997.

C. Sun, Q. Lv, S. Zhu, W. Zheng, Y. Cao, and J. Wang, “Ultra-short-term power load forecasting based on double-layer XGBoost considering multi-feature effects,” High Voltage Technology, vol. 48, pp. 2885–2898, 2021.

Z. Chen, J. Liu, C. Li, X. Ji, D. Li, Y. Huang, F. Di, X. Gao, and L. Xu, “Ultra-short-term power load forecasting based on LSTM and XGBoost combined model,” Power Grid Technology, vol. 22, pp. 614–620, 2020.

A. Banks, J. Vincent, and C. Anyakoha, “A review of particle swarm optimization. Part I: Background and development,” Natural Computing, vol. 6, no. 4, pp. 467–484, 2007.

H. Tan, Q. Yang, J. Xing, K. Huang, S. Zhao, and H. Hu, “Photovoltaic power prediction based on XGBoost–LSTM combined model,” Journal of Solar Energy, vol. 43, pp. 75–81, 2022.

R. Masini, M. Medeiros, and E. Mendes, “Machine learning advances for time series forecasting,” Journal of Economic Surveys, vol. 35, no. 1, pp. 201–243, 2021.

M. Lafuente-Cacho et al., “State of the art for solar and wind energy forecasting methods for sustainable grid integration,” Current Sustainable/Renewable Energy Reports, vol. 12, no. 1, 2025.

J. Kim, H. Kim, D. Lee, and S. Yoon, “A comprehensive survey of deep learning for time series forecasting: Architectural diversity and open challenges,” Artificial Intelligence Review, vol. 58, no. 7, pp. 1–95, 2025.

I. Hussain et al., “Predicting monthly wind speeds using XGBoost: A case study for renewable energy optimization,” Processes, vol. 13, no. 6, p. 1763, 2025.

M. Rhafes, O. Moussaoui, and M. Raboaca, “Machine learning models in renewable energy forecasting: A systematic literature review,” Indonesian Journal of Electrical Engineering and Computer Science, vol. 37, no. 3, pp. 1874–1891, 2025.

M. Baltruszewicz et al., “Social outcomes of energy use in the United Kingdom,” Ecological Economics, vol. 205, p. 107686, 2023.

D. Lorente et al., “Renewable energy, economic complexity and biodiversity risk,” Environmental and Sustainability Indicators, vol. 18, p. 100244, 2023.

A. Androniceanu and O. Sabie, “Overview of green energy as a strategic option for sustainable development,” Energies, vol. 15, p. 8573, 2022.

R. J. Hyndman and G. Athanasopoulos, Forecasting: Principles and Practice, 3rd ed. Melbourne, Australia: OTexts, 2021.

C. Bergmeir, R. J. Hyndman, and B. Koo, “On the validity of cross-validation for time series prediction,” Computational Statistics & Data Analysis, vol. 120, pp. 70–83, 2018.

Pecan Street Inc., “Dataport,” Available: https://dataport.pecanstreet.org. Accessed: 2026.

L. Semmelmann, S. Henni, and C. Weinhardt, “Load forecasting for energy communities: A novel LSTM-XGBoost hybrid model based on smart meter data,” Energy Informatics, vol. 5, Suppl. 1, 2022.

E. Demir and S. Gunal, “Short-term electricity consumption forecasting with deep learning,” The Journal of Supercomputing, vol. 81, 2025.

T. A. Rajaperumal and C. C. Columbus, “Transforming the electrical grid: The role of AI in advancing smart, sustainable, and secure energy systems,” Energy Informatics, vol. 8, 2025.

M. Huotari, A. Malhi, and K. Främling, “Machine Learning Applications for Smart Building Energy Utilization: A Survey,” Archives of Computational Methods in Engineering, vol. 31, pp. 2537–2556, 2024.

Downloads

Published

2026-09-30

How to Cite

Jalal, R., & Al-Mejibli, I. (2026). A Hybrid LSTM–XGBoost Framework Optimized by Particle Swarm Optimization for Short-Term Energy Demand Forecasting Using Large-Scale Smart Meter Data. Journal of Al-Qadisiyah for Computer Science and Mathematics, 18(3), Comp 560–572. https://doi.org/10.29304/jqcsm.2026.18.32974

Issue

Section

Computer Articles