Stable and efficient electricity supply is a core foundation for national economies and industrial activities in modern society. Since power demand fluctuates moment by moment due to complex and diverse factors like season, time of day, and economic c...
Stable and efficient electricity supply is a core foundation for national economies and industrial activities in modern society. Since power demand fluctuates moment by moment due to complex and diverse factors like season, time of day, and economic conditions, accurate demand forecasting is essential for ensuring the stability and maximizing the operational efficiency of the power system. This study aims to develop a model that leverages machine learning techniques to forecast the UK's electricity demand with high accuracy and to conduct an in-depth analysis of the key features influencing the prediction results.
For this research, a dataset of the UK's 30-minute interval electricity demand from 2009 to 2024 was used. During the data preprocessing stage, missing values were handled, and useful derived features—such as year, month, day, and day of the week—were created based on the date and time information. Furthermore, Pearson correlation analysis and the Variance Inflation Factor (VIF) were employed to diagnose linear relationships and multicollinearity among variables, leading to the selection of final features for modeling. In the modeling phase, Random Forest, XGBoost, and LightGBM were used as individual models, and GridSearchCV was utilized for hyperparameter optimization to maximize their predictive performance. To enhance predictive stability and accuracy by combining the strengths of the individual models, a Stacking Ensemble model was also constructed. The models' performance was quantitatively evaluated and compared using the Coefficient of Determination (R2 score), Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE) metrics.
The performance evaluation results showed that XGBoost exhibited the highest predictive accuracy among the individual models with an R2 score of 0.9923. However, the Stacking Ensemble model, which integrates the predictions of the individual models for the final forecast, achieved the most outstanding performance with an R2 score of 0.9926. This suggests that the ensemble technique, which synthesizes predictions from multiple models, can compensate for the limitations of a single model and provide more robust forecasts. Finally, to interpret the prediction process of a machine learning model often considered a 'black box,' the SHAP (Shapley Additive Explanations) analysis, a technique from Explainable Artificial Intelligence (XAI), was applied to the LightGBM model. The SHAP analysis confirmed that settlement_period (representing the time of day), year (reflecting long-term trends), and embedded_wind_generation (denoting small-scale wind power output) are the most critical features significantly impacting electricity demand forecasting.
This study proves the possibility of highly accurate electricity demand forecasting through an optimized Stacking Ensemble model and provides concrete grounds for the model's predictions via SHAP analysis. This contributes to power system operators making rational, data-driven decisions, underscoring both its academic and practical significance.