Accurate real-time electricity price forecasting is of critical importance for market participants seeking to optimize energy procurement, dispatch scheduling, and arbitrage strategies in liberalized electricity markets. However, existing forecasting approaches suffer from several key limitations: (1) conventional statistical models fail to capture the complex nonlinear interactions among generation mix, load demand, and temporal variables that collectively drive price dynamics; (2) single-model approaches lack robustness and are sensitive to overfitting, limiting their generalizability across diverse market conditions; (3) the interpretability of black-box prediction models remains insufficient, hindering the practical deployment of data-driven forecasting systems in operational decision-making. To address these challenges, this study proposes a comprehensive machine learning framework based on six tree-based ensemble models for hourly electricity price prediction in the Spanish electricity market. The proposed framework introduces three key contributions: (1) a systematic feature engineering pipeline incorporating lagged price variables, rolling statistics, and calendar-based temporal encodings; (2) a rigorous comparative evaluation of Decision Tree, Random Forest, Extra Trees, Gradient Boosting, XGBoost, and LightGBM under identical experimental conditions; (3) a SHAP-based interpretability analysis that quantifies feature contributions and interaction effects at both global and local levels. Experimental results on the ENTSO-E Spanish market dataset demonstrate that XGBoost achieves the best overall predictive performance, with an R² of 0.9660 and MAE of 1.5631 €/MWh.
Jędrzejewski A, Lago J, Marcjasz G, et al., 2022, Electricity Price Forecasting: The Dawn of Machine Learning. IEEE Power and Energy Magazine, 20(3): 24–31.
Wang P, Xu K, Ding Z, et al., 2022, An Online Electricity Market Price Forecasting Method Via Random Forest. IEEE Transactions on Industry Applications, 58(6): 7013–7021.
Shah R, Shah H, Bhim S, et al., 2021, “Short-Term Electricity Price Forecasting using Ensemble Machine Learning Technique. 2021 1st International Conference in Information and Computing Research (iCORE), Manila, Philippines, 145–150.
Sahoo S, Swain S, Dash R, 2023, An Analysis of Machine Learning Methods for Electricity Price Forecasting. 2023 1st International Conference on Circuits, Power and Intelligent Systems (CCPIS), Bhubaneswar, India, 1–5.
Alkawaz A, Abdellatif A, Kanesan J, et al., 2022, Day-Ahead Electricity Price Forecasting Based on Hybrid Regression Model. IEEE Access, 2022(10): 108021–108033.
Mubarak H, Ahmad S, Hossain A, et al., 2023, Short-Term Electricity Price Forecasting Using Interpretable Hybrid Machine Learning Models. 2023 IEEE IAS Global Conference on Renewable Energy and Hydrogen Technologies (GlobConHT), Male, Maldives, 1–6.
Arya K, Vijaya Chandrakala K, 2021, Machine Learning Based Prediction and Forecasting of Electricity Price During COVID-19, 2021 IEEE International Power and Renewable Energy Conference (IPRECON), Kollam, India, 1–6.
Han L, Ban C, Zhang C, et al., 2024, Electricity Price Forecasting in Power Markets Based on Machine Learning, 2024 IEEE 4th International Conference on Digital Twins and Parallel Intelligence (DTPI), Wuhan, China, 91–96.
Heijden T, Lago J, Palensky P, et al., 2021, Electricity Price Forecasting in European Day Ahead Markets: A Greedy Consideration of Market Integration. IEEE Access, 2021(9): 119954–119966.
Yorat E, Zor K, Özbek N, 2023, Day-Ahead Electricity Price Forecasting Using Artificial Intelligence-Based Algorithms, 2023 International Conference on Innovation and Intelligence for Informatics, Computing, and Technologies (3ICT), Sakheer, Bahrain, 121–126.
Yildirim B, Yildiz S, Turkoglu A, et al., 2023, Evaluating LMP Forecasting with LSTM Networks: A Deep Learning Approach to Analyzing Electricity Prices During Unpredictable Events, 2023 5th Global Power, Energy and Communication Conference (GPECOM), Nevsehir, Turkiye, 477–482.