Short-term load forecasting using a two-stage CPO-PSO hyperparameter optimization of LSSVM Authors: XinHao Zhang Published: 2026 ABSTRACT Accurate short-term electricity load forecasting is critical for ensuring reliable power system operation, particularly in the face of increasing grid complexity and the nonlinear, time-varying nature of load data. This study proposes a novel hybrid model that integrates Crested Porcupine Optimization (CPO), Particle Swarm Optimization (PSO), and Least Squares Support Vector Machine (LSSVM). Initially, CPO is employed to perform global hyperparameter optimization, effectively exploring the parameter space and preventing premature convergence. Subsequently, PSO performs local refinement of the parameters to enhance the model’s predictive accuracy and generalization capability. Finally, the optimized LSSVM model captures complex nonlinear relationships between load and external factors such as temperature, date, and holidays. To evaluate the effectiveness of the proposed CPO-PSO-LSSVM model, comparative experiments were conducted against baseline LSSVM, PSO-LSSVM, and CPO-LSSVM models using two real-world datasets. On the Jiangsu dataset (hourly resolution), the proposed model achieved reductions in MAE and RMSE of 40.2% and 50.3%, respectively, compared to LSSVM, while improving NSE from 0.604 to 0.902. On the Australian dataset (half-hourly resolution), it achieved reductions in MAE and RMSE of 25.3% and 50.8%, with an NSE increase from 0.985 to 0.996. These results confirm that the CPO-PSO-LSSVM model offers superior forecasting accuracy, robustness across regions and time granularities, and practical applicability for modern power system management. Introduction Load forecasting plays a crucial role in maintaining the balance between electricity supply and demand since the emergence of modern power grids. In particular, short-term load forecasting (STLF) is vital for the reliable operation of power systems and meeting market requirements1. With the increasing penetration of renewable energy sources, demand-side management, and market liberalization, the complexity and importance of accurate load forecasting have grown significantly2–4. Accurate STLF not only improves power system reliability and economic dispatch efficiency, but also supports renewable energy integration and intelligent grid management under increasingly uncertain operating conditions. Short-term load forecasting methods are generally divided into mathematical-statistical approaches and machine learning techniques5. Traditional methods, such as multiple linear regression6, Kalman filters7, and autoregressive integrated moving average (ARIMA) models8, are theoretically sound and easy to implement, with interpretable parameters. They consider historical loads, relevant factors, and temporal dependencies9. However, these approaches generally rely on linear assumptions and often struggle to capture the highly nonlinear, nonstationary, and dynamic characteristics of modern electricity load data. In addition, model complexity and parameter instability tend to increase significantly with higher model orders and complex operating conditions. These limitations have motivated the adoption of machine learning methods to improve forecasting performance. Artificial intelligence-based load forecasting methods leverage machine learning and deep learning techniques to automatically extract features and patterns from large-scale historical electricity data, enabling accurate prediction of future power loads. Common approaches include Support Vector Regression (SVR)10, Radial Basis Function (RBF) neural networks11, and Extreme Learning Machines (ELM)12, which enhance the ability to model nonlinear relationships. With the advancement of deep learning, architectures such as Long Short-Term Memory (LSTM) networks13, and Least Squares Support Vector Machine (LSSVM)14 have been widely applied to load forecasting, significantly improving temporal modeling capabilities and predictive accuracy. Despite these advancements, existing machine learning and deep learning methods still face several limitations in practical applications. Recent studies have increasingly focused on hybrid forecasting frameworks that integrate decomposition techniques, intelligent optimization algorithms, and machine learning models to improve forecasting accuracy and robustness. Zhang and Hong15 proposed a CEEMDAN-SVR framework optimized by a quantum-based dragonfly algorithm, demonstrating that decomposition and metaheuristic optimization can effectively improve electric load forecasting performance. Zhang et al.16 further developed a VMD-SR-SVR model combined with an improved cuckoo search strategy to alleviate premature convergence and enhance forecasting stability. More recently, Zhang et al.17 proposed a BiGRU-enhanced twin support vector regression model with seasonal mechanisms, which improved the capability of capturing nonlinear and seasonal load patterns. Peng et al.18 introduced a multimodal fusion forecasting framework integrating optimization algorithms and deep learning techniques to further enhance feature extraction and forecasting performance. Although these hybrid approaches have achieved promising forecasting results, several limitations still remain. Many existing methods rely on single-stage optimization strategies, which may suffer from insufficient balance between global exploration and local exploitation during hyperparameter tuning. Consequently, optimization stability, convergence quality, and generalization capability may deteriorate when handling highly nonlinear and time-varying STLF tasks. As an extension of Support Vector Machine (SVM), the LSSVM replaces the inequality constraints and quadratic programming of standard SVM with equality constraints and a linear system, significantly reducing computational complexity19. This reformulation retains the strong nonlinear modeling capability of SVM while improving convergence speed and scalability. LSSVM has demonstrated excellent performance in STLF, offering high accuracy, robustness to small datasets, and efficient computation20,21. However, the predictive performance of LSSVM is highly sensitive to its hyperparameters, including the regularization parameter and kernel parameters, which directly influence generalization and accuracy. Conventional optimization methods, such as grid search and metaheuristic algorithms like Particle Swarm Optimization (PSO) and Genetic Algorithms (GA), have been widely adopted to tune these parameters. Recent studies have demonstrated the potential of PSO-LSSVM models in various applications: Ge et al. proposed a reinforcement learning and PSO-LSSVM hybrid method for industrial power load forecasting, achieving high accuracy across diverse production patterns22; Xu et al. applied PSO-LSSVM to air-conditioning load forecasting in GSHP systems, realizing up to 11.76% energy savings23; and Ji et al. developed a dynamic PSO-LSSVM model that reduced mean absolute percentage error (MAPE) to 1.91%, significantly outperforming other models in short-term power load forecasting24. Nevertheless, existing PSO-LSSVM frameworks still exhibit certain limitations when applied to STLF tasks. The standard PSO algorithm often suffers from premature convergence and insufficient exploration in high-dimensional parameter spaces, leading to suboptimal hyperparameter tuning of LSSVM. Moreover, the dynamic and highly nonlinear characteristics of short-term power load data further exacerbate these challenges. Compared with conventional single-stage optimization methods, a two-stage optimization framework can better balance global exploration and local exploitation during hyperparameter tuning. The Crested Porcupine Optimizer (CPO) exhibits strong exploration capability and population diversity, which helps avoid premature convergence in the early optimization stage. Meanwhile, PSO demonstrates fast convergence and efficient local refinement ability during later-stage optimization. By integrating the complementary strengths of CPO and PSO, the proposed framework aims to achieve more stable and accurate hyperparameter optimization for LSSVM in STLF applications. To address these challenges of nonlinearity, dynamic patterns, and hyperparameter sensitivity in short-term load forecasting, this paper proposes a CPO-PSO-LSSVM hybrid model. The main contributions of this work are as follows:This paper proposes and implements a two-stage hybrid optimization framework combining Crested Porcupine Optimization (CPO)25 and PSO, which enhances global exploration and local exploitation for LSSVM hyperparameter tuningThis study develops a hybrid approach that significantly improves LSSVM’s prediction accuracy and robustness in handling highly nonlinear, time-varying load data.The proposed approach is validated on datasets with varying temporal resolutions, regions, and volumes, demonstrating its strong generalizability and robustness. This paper proposes and implements a two-stage hybrid optimization framework combining Crested Porcupine Optimization (CPO)25 and PSO, which enhances global exploration and local exploitation for LSSVM hyperparameter tuning This paper proposes and implements a two-stage hybrid optimization framework combining Crested Porcupine Optimization (CPO)25 and PSO, which enhances global exploration and local exploitation for LSSVM hyperparameter tuning This study develops a hybrid approach that significantly improves LSSVM’s prediction accuracy and robustness in handling highly nonlinear, time-varying load data. This study develops a hybrid approach that significantly improves LSSVM’s prediction accuracy and robustness in handling highly nonlinear, time-varying load data. The proposed approach is validated on datasets with varying temporal resolutions, regions, and volumes, demonstrating its strong generalizability and robustness. The proposed approach is validated on datasets with varying temporal resolutions, regions, and volumes, demonstrating its strong generalizability and robustness. Materials and methods Figure 1 illustrates the modeling process of the proposed CPO-PSO-LSSVM framework for short-term power load forecasting. Initially, the historical load data are preprocessed and divided into training and testing sets. The CPO algorithm performs global optimization to explore the LSSVM hyperparameter space and avoid local optima. Next, the PSO algorithm refines these parameters through local exploitation, ensuring fine-tuned LSSVM configuration. Finally, the optimized LSSVM model is trained and applied to generate forecasting results on the testing dataset.Fig. 1Modeling workflow for short-term electric load forecasting based on CPO-PSO-LSSVM. Modeling workflow for short-term electric load forecasting based on CPO-PSO-LSSVM. Crested Porcupine Optimizer (CPO) The Crested Porcupine Optimizer (CPO), introduced by Abdel-Basset et al.25, is among the latest and most competitive metaheuristic algorithms. Inspired by the adaptive strategies of crested porcupines in foraging, predator evasion, and survival, CPO incorporates four defense mechanisms: visual, auditory, olfactory, and physical attack. The first two (visual and auditory) drive global exploration, while the latter two (olfactory and physical attack) enhance local exploitation. To address optimization problems across multiple dimensions (d), CPO initializes candidate solutions randomly within the search space using the following formula:1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{X_{i} }} = \overrightarrow {L} + \overrightarrow {r} \cdot (\overrightarrow {U} - \overrightarrow {L} )\left| {i = 1,2, \ldots N^{n} } \right.$$\end{document}where, Nn represents the number of individuals, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\dot{\vec{x}}_{{\overline{i}}}$$\end{document} is the i-th candidate solution in the search space, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\dot{L}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\dot{u}$$\end{document} are the lower and upper bounds of the search range, respectively, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overline{\dot{r}}$$\end{document} is a vector randomly initialized between 0 and 1. The CPO introduces the Cyclic Population Reduction (CPR) technique to balance population diversity and convergence speed. Inspired by crested porcupines (CPs) that selectively activate defense mechanisms under threat, CPR temporarily removes part of the population to accelerate convergence and later reintroduces it to maintain diversity, thus mitigating local optima entrapment:2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$N = N_{\min } + (N_{n} - N_{\min } ) \cdot \left( {1 - \frac{{t\% \frac{{T_{\max } }}{T}}}{{\frac{{T_{\max } }}{T}}}} \right)$$\end{document}where, T is the number of cycles, t is the current function evaluation count, Tmax is the maximum evaluations, and Nmin is the minimum population size. In the exploration phase, CPs employ visual and auditory strategies to investigate diverse regions. The visual strategy moves individuals toward randomly selected neighbors, while the auditory strategy intensifies search near promising areas:3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{x_{i}^{t + 1} }} = \overrightarrow {{x_{i}^{t} }} + \tau_{1} \cdot \left| {2 \cdot \tau_{2} \cdot \overrightarrow {{x_{CP}^{t} }} - \overrightarrow {{y_{i}^{t} }} } \right|$$\end{document}where, xcp represents the position of the best CP, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{y_{i}^{t} }}$$\end{document} is the vector generated between the current CP and a randomly selected CP.4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{y_{i}^{t} }} = \frac{{\overrightarrow {{x_{i}^{t} }} + \overrightarrow {{y_{r}^{t} }} }}{2}$$\end{document} The CP uses the auditory method to create noise and threaten the predator. When the predator approaches, the CP’s sound becomes louder.5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{x_{i}^{t + 1} }} = (1 - \overrightarrow {{U_{1} }} ) \cdot \overrightarrow {{x_{i}^{t} }} + \overrightarrow {{U_{1} }} \cdot (\overrightarrow {y} + \tau_{3} \cdot (\overrightarrow {{x_{r1}^{t} }} - \overrightarrow {{x_{r2}^{t} }} ))$$\end{document}where, r1 and r2 are two random integers within the range [1, N], and is a randomly generated value between 0 and 1. In the exploitation phase, the third defense strategy is initiated first. In this strategy, the CP secretes a foul odor and disperses it within its surrounding area to deter predators from approaching. To mathematically model this behavior, the following formula is proposed:6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{x_{i}^{t + 1} }} = (1 - \overrightarrow {{U_{1} }} ) \cdot \overrightarrow {{x_{i}^{t} }} + \overrightarrow {{U_{1} }} \cdot (\overrightarrow {{x_{r1}^{t} }} + S_{i}^{t} \cdot (\overrightarrow {{x_{r2}^{t} }} - \overrightarrow {{x_{r3}^{t} }} )) - \tau_{3} \cdot \overrightarrow {\delta } \cdot \gamma_{t} \cdot S_{i}^{t}$$\end{document}where, r3 is a random number within the range [1, N], δ is the parameter used to control the search direction and is defined using Eq. (18). xti is the position of the i-th individual at iteration t, γt is the defense factor defined using Eq. (19). τ3 is a random value within the interval [0, 1], and Sti is the odor dispersion factor defined using Eq. (20). These are expressed as follows:7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {\delta } = \left\{ {\begin{array}{*{20}l} { + 1,} \hfill & {if\;\overrightarrow {rand} \le 0.5} \hfill \\ { - 1,} \hfill & {Else} \hfill \\ \end{array} } \right.$$\end{document}8\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\gamma_{t} = 2 \cdot rand \cdot \left( {1 - \frac{t}{{t_{\max } }}} \right)^{{\frac{t}{{t_{\max } }}}}$$\end{document}9\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$S_{t}^{i} = \exp \left( {\frac{{f(x_{t}^{i} )}}{{\sum\nolimits_{k = 1}^{N} {f(x_{t}^{i} ) + \varepsilon } }}} \right)$$\end{document}where f(xti) represents the objective function value of the i-th individual at iteration t, ε is a small value to avoid division by zero, rand is a vector containing randomly generated values between 0 and 1, rand is a variable including randomly generated numbers between 1 and 0, N is the population size, t is the number of the current iteration, and tmax is the maximum number of iterations. The vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} is used to simulate three possible scenarios in this strategy:When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} equals 0, the CP will stop odor dispersion because the predator halts its movement due to fear of the CP, thus maintaining a constant distance between the predator and the CP;When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} equals 1, the CP significantly disperses odor due to the predator being nearby;When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} is a combination of 0 and 1, the predator maintains a safe distance from the CP, so there is no need for the CP to extensively release its odor. When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} equals 0, the CP will stop odor dispersion because the predator halts its movement due to fear of the CP, thus maintaining a constant distance between the predator and the CP; When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} equals 0, the CP will stop odor dispersion because the predator halts its movement due to fear of the CP, thus maintaining a constant distance between the predator and the CP; When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} equals 1, the CP significantly disperses odor due to the predator being nearby; When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} equals 1, the CP significantly disperses odor due to the predator being nearby; When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} is a combination of 0 and 1, the predator maintains a safe distance from the CP, so there is no need for the CP to extensively release its odor. When \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{U_{1} }}$$\end{document} is a combination of 0 and 1, the predator maintains a safe distance from the CP, so there is no need for the CP to extensively release its odor. The final strategy is the physical attack. When the predator comes very close and attacks it with short, thick quills, the CP resorts to physical confrontation. During this physical attack, the two entities strongly interact, representing a one-dimensional inelastic collision. To mathematically model this physical attack behavior, the following formula is proposed:10\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{x_{i}^{t + 1} }} = \overrightarrow {{x_{CP}^{t} }} + (\alpha (1 - \tau_{4} ) + \tau_{4} ) \cdot (\delta \cdot \overrightarrow {{x_{CP}^{t} }} - \overrightarrow {{x_{i}^{t} }} ) - \tau_{5} \cdot \delta \cdot \gamma_{t} \cdot \overrightarrow {{F_{i}^{t} }}$$\end{document}where α is the convergence speed factor, τ4 and τ5 are random numbers, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overrightarrow {{F_{i}^{t} }}$$\end{document} is a fitness-based factor. Particle Swarm Optimization (PSO) Particle Swarm Optimization (PSO) mimics the collective behavior of animals during migration and foraging26. A swarm of particles, each with a position x and velocity v, iteratively searches for the optimal solution. Each particle adjusts its trajectory based on its own best-found position pbest and the global best position gbest identified by the swarm27. The velocity and position updates are defined as:11\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$v_{i + 1} = w \cdot v_{i} + c_{1} \cdot rand_{1} \cdot (pbest_{i} - x_{i} ) + c_{2} \cdot rand_{2} \cdot (gbest_{i} - x_{i} )$$\end{document}12\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x_{i + 1} = x_{i} + v_{i + 1}$$\end{document}where w is the inertia weight controlling exploration–exploitation balance; c1 and c2 are cognitive and social coefficients; rand1 and rand2 are random numbers between zero and one; vi and xi represent the velocity and position of the ith dimension of a particle, respectively; pbesti and gbesti are the local and global optimal solutions of the ith dimension of the optimal particle position, respectively. Hybrid CPO-PSO optimization of LSSVM for load prediction In STLF, the relationship between power load and key influencing factors (e.g., temperature, humidity, day type, time of day, and historical load patterns) is highly complex and nonlinear, making it difficult to represent with explicit mathematical formulations. This nonlinear relationship is modeled using LSSVM.13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\left\{ {\begin{array}{*{20}l} {LSSVM(X):R^{n} \to R} \hfill \\ {Y = LSSVM(X)} \hfill \\ {X = (x_{1} ,x_{2} , \ldots ,x_{n} )} \hfill \\ \end{array} } \right.$$\end{document}where, X = (x1, x2, …, xn) represents input features affecting the load, temperature, humidity, and historical load patterns, and Y denotes the predicted short-term load. LSSVM is trained on actual historical datasets to capture this nonlinear mapping. The process of CPO-PSO-LSSVM model is as follows:Input and Preprocess DataInitialize the CPO-PSO-LSSVM framework by setting the particle dimension (corresponding to LS-SVM hyperparameters), population size (for both CPO and PSO), and maximum iterations. Randomly initialize the positions and velocities of the particles within the defined search space.Utilize the CPO algorithm to perform a global search for the optimal LSSVM hyperparameters by minimizing the mean squared error (MSE) obtained from tenfold cross-validation on the training dataset.Apply the PSO algorithm to locally refine the hyperparameters obtained from the CPO optimization, further reducing the average MSE of tenfold cross-validation. Ensure that the updated particle positions remain within the search space bounds, and update the personal and global best solutions accordingly.Initialize the LSSVM model with optimized hyperparameters, select the RBF kernel, train the model on the training data, and predict the short-term power load for the testing dataset. Input and Preprocess Data Input and Preprocess Data Initialize the CPO-PSO-LSSVM framework by setting the particle dimension (corresponding to LS-SVM hyperparameters), population size (for both CPO and PSO), and maximum iterations. Randomly initialize the positions and velocities of the particles within the defined search space. Initialize the CPO-PSO-LSSVM framework by setting the particle dimension (corresponding to LS-SVM hyperparameters), population size (for both CPO and PSO), and maximum iterations. Randomly initialize the positions and velocities of the particles within the defined search space. Utilize the CPO algorithm to perform a global search for the optimal LSSVM hyperparameters by minimizing the mean squared error (MSE) obtained from tenfold cross-validation on the training dataset. Utilize the CPO algorithm to perform a global search for the optimal LSSVM hyperparameters by minimizing the mean squared error (MSE) obtained from tenfold cross-validation on the training dataset. Apply the PSO algorithm to locally refine the hyperparameters obtained from the CPO optimization, further reducing the average MSE of tenfold cross-validation. Ensure that the updated particle positions remain within the search space bounds, and update the personal and global best solutions accordingly. Apply the PSO algorithm to locally refine the hyperparameters obtained from the CPO optimization, further reducing the average MSE of tenfold cross-validation. Ensure that the updated particle positions remain within the search space bounds, and update the personal and global best solutions accordingly. Initialize the LSSVM model with optimized hyperparameters, select the RBF kernel, train the model on the training data, and predict the short-term power load for the testing dataset. Initialize the LSSVM model with optimized hyperparameters, select the RBF kernel, train the model on the training data, and predict the short-term power load for the testing dataset. Results To validate the accuracy of the model proposed in this paper, electricity load data from a specific city in Jiangsu, China, were used as the case study dataset. The simulation was conducted using hourly load data from February 3, 2003, to March 16, 2003, which totals 1000 h. In addition to load information, this dataset also includes details on dates, times, holidays, and temperature. Performance metrics The Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and the Nash–Sutcliffe Efficiency coefficient (NSE) are adopted as performance indicators. Their respective calculation formulas are as follows:14\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$E_{MAE} = \frac{1}{n}\sum\limits_{i = 1}^{n} {\left| {P_{i}^{\prime } - P_{i} } \right|}$$\end{document}15\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$E_{RMSE} = \sqrt {\frac{1}{n}\sum\limits_{i = 1}^{n} {(P_{i}^{\prime } - P_{i} )^{2} } }$$\end{document}16\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$E_{NSE} = 1 - \frac{{\sum\nolimits_{i = 1}^{n} {(P_{i} - P_{i}^{\prime } )^{2} } }}{{\sum\nolimits_{i = 1}^{n} {(P_{i} - \overline{{P_{i} }} )^{2} } }}$$\end{document} In these formulas, pi' and pi represent the predicted and actual electricity load values at time 'i' respectively; \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\overline{{p_{i} }}$$\end{document} is the overall average of the actual load values, and n stands for the quantity of samples in the set. Short-term electricity load forecasting Of the 1000 hourly electricity load samples collected from a city in Jiangsu, China, 70% were utilized for training and the remaining 30% for testing. The testing dataset was strictly reserved for final performance evaluation and was not involved in the hyperparameter optimization process. The proposed CPO-PSO-LSSVM model first preprocesses the dataset by normalizing input features (load, temperature, date, and holiday indicators) and the target variable. The primary parameter settings for the CPO-PSO-LSSVM short-term electricity load forecasting model are summarized in Table 1. To fully leverage the strengths of metaheuristic optimization, a two-stage optimization process was adopted: the Crested Porcupine Optimizer (CPO) was used for global exploration of the LSSVM hyperparameter space, followed by Particle Swarm Optimization (PSO) for local refinement.Table 1Core parameter settings for the proposed CPO-PSO-LSSVM model.ModelModel parameterValueCPO (Global Search)Population size20Maximum iterations10Search space (γ, σ2)[0.01, 200]Convergence rate (α)0.2CPR minimum population size16 (80% of N)PSO (Local Refinement)Population size20Maximum iterations50Search space (γ, σ2)[0.1, 100]LSSVMLearning factors (c1, c2)2.0, 2.0Kernel functionRBFCross-validation folds10 Table 1Core parameter settings for the proposed CPO-PSO-LSSVM model.ModelModel parameterValueCPO (Global Search)Population size20Maximum iterations10Search space (γ, σ2)[0.01, 200]Convergence rate (α)0.2CPR minimum population size16 (80% of N)PSO (Local Refinement)Population size20Maximum iterations50Search space (γ, σ2)[0.1, 100]LSSVMLearning factors (c1, c2)2.0, 2.0Kernel functionRBFCross-validation folds10 Core parameter settings for the proposed CPO-PSO-LSSVM model. CPO global search and PSO local refinement In the proposed two-stage optimization framework, the Crested Porcupine Optimizer (CPO) and Particle Swarm Optimization (PSO) are integrated to achieve robust and efficient hyperparameter tuning of LSSVM for short-term electricity load forecasting. In the first stage, CPO was deployed to perform a global search over the LSSVM hyperparameter space. The population size was set to 20, and the maximum iteration count to 10, as determined empirically for a balance between exploration capability and computational efficiency. The search targeted two key hyperparameters of LSSVM: the regularization parameter γ (gamma) and the kernel parameter σ2 (sig2). The fitness function was defined as the average mean squared error (MSE) obtained from tenfold cross-validation on the training dataset, enabling CPO to explore a broad solution space and avoid premature convergence. The convergence rate α was set to 0.2 to balance exploration and exploitation, and the CPR minimum population size was defined as 80% of N (i.e., 16) to maintain adequate population diversity during late-stage iterations. In the second stage, the Particle Swarm Optimization (PSO) algorithm was used to perform local refinement of the hyperparameters obtained from CPO. PSO was configured with a smaller population size of 20 and a maximum of 50 iterations, focusing on fine-tuning to minimize overfitting and enhance generalization. Unlike the first stage, the PSO fitness function evaluated the average MSE across tenfold cross-validation, ensuring stability and robustness of the optimized hyperparameters under varying data subsets. As summarized in Table 2, the process resulted in a clear parameter convergence: from initial random settings (γ: 67, σ2: 150, RMSE: 14.45) to CPO optimization (γ: 135, σ2: 88, RMSE: 11.732), and finally PSO refinement (γ: 142, σ2: 92, RMSE: 9.537). This trend demonstrates the framework’s ability to iteratively improve model performance.Table 2Parameter convergence and model performance in CPO global search and PSO local refinement.Stageγ (gamma)σ2 (sig2)Fitness (RMSE)Initial (Random)6715014.45After CPO Search1358811.732After PSO Refinement142929.537 Table 2Parameter convergence and model performance in CPO global search and PSO local refinement.Stageγ (gamma)σ2 (sig2)Fitness (RMSE)Initial (Random)6715014.45After CPO Search1358811.732After PSO Refinement142929.537 Parameter convergence and model performance in CPO global search and PSO local refinement. The simulation results are presented in Fig. 2, while the comparison of the load forecasting performance indicators of the CPO-PSO-LSSVM model with the other three models is shown in Table 3.Fig. 2Multi-model electricity load forecasting results of a city in Jiangsu.Table 3Comparison of performance metrics for multi-model electricity load forecasting a city in Jiangsu.ModelEMAEERMSEENSELSSVM11.95719.1920.604PSO-LSSVM9.97514.5470.772CPO-LSSVM8.41911.8720.848CPO-PSO-LSSVM7.1489.5370.902 Multi-model electricity load forecasting results of a city in Jiangsu. Table 3Comparison of performance metrics for multi-model electricity load forecasting a city in Jiangsu.ModelEMAEERMSEENSELSSVM11.95719.1920.604PSO-LSSVM9.97514.5470.772CPO-LSSVM8.41911.8720.848CPO-PSO-LSSVM7.1489.5370.902 Comparison of performance metrics for multi-model electricity load forecasting a city in Jiangsu. Auxiliary validation To further assess the generalization ability of the proposed CPO-PSO-LSSVM model, an auxiliary validation was conducted using electricity load data from various regions in Australia. This dataset spans from July 29, 2006, to September 8, 2006, with half-hourly records totaling 2,000 samples. As with the Jiangsu dataset, the data was preprocessed by normalizing input features (load, temperature, date, and holiday indicators) and splitting 70% for training and 30% for testing. The CPO-PSO-LSSVM model, configured with the optimal parameters identified from the Jiangsu dataset, was applied directly to the Australian dataset without further hyperparameter tuning. The forecasting results are presented in Fig. 3, and a comparison of the performance metrics across different models is provided in Table 4.Fig. 3Multi-model electricity load forecasting results of Australia.Table 4Comparison of performance metrics for multi-model electricity load forecasting of Australia.ModelEMAEERMSEENSELSSVM10.85921.5440.985PSO-LSSVM9.31515.3840.992CPO-LSSVM8.89713.1260.994CPO-PSO-LSSVM8.11710.6050.996 Multi-model electricity load forecasting results of Australia. Table 4Comparison of performance metrics for multi-model electricity load forecasting of Australia.ModelEMAEERMSEENSELSSVM10.85921.5440.985PSO-LSSVM9.31515.3840.992CPO-LSSVM8.89713.1260.994CPO-PSO-LSSVM8.11710.6050.996 Comparison of performance metrics for multi-model electricity load forecasting of Australia. Discussion Comparison with other methods From Table 3, it can be observed that the proposed CPO-PSO-LSSVM model exhibits significant improvements across all evaluation metrics when compared to the baseline LSSVM, PSO-LSSVM, and CPO-LSSVM models. Specifically, its MAE of 7.148 represents a reduction of 40.2% compared to LSSVM, and decreases of 28.4% and 15.1% compared to PSO-LSSVM and CPO-LSSVM, respectively. Similarly, its RMSE of 9.537 reflects a reduction of 50.3% relative to LSSVM, and improvements of 34.5% and 19.7% compared to PSO-LSSVM and CPO-LSSVM. Moreover, its NSE of 0.902 indicates an improvement in predictive efficiency relative to the other methods, being closer to the ideal value of 1 and reflecting enhanced predictive reliability. These results indicate that the CPO-PSO-LSSVM model successfully leverages the complementary strengths of CPO and PSO. The superior forecasting performance of the proposed framework can be attributed to the complementary optimization characteristics of CPO and PSO. Specifically, CPO enhances population diversity and broadens the exploration of the hyperparameter space during the early optimization stage, thereby alleviating premature convergence. Subsequently, PSO performs efficient local refinement within promising parameter regions, improving convergence precision and model generalization capability. This collaborative optimization mechanism enables the LSSVM model to better capture nonlinear and dynamic load variations under different operating conditions. The two-stage optimization strategy significantly enhances both model precision and stability. Previous studies have also demonstrated that optimization-based neural network training algorithms, including LM, BR, and SCG, can significantly improve forecasting performance, further supporting the effectiveness of optimization-enhanced forecasting frameworks24. From Fig. 3 and Table 4, it is further evident that the CPO-PSO-LSSVM model maintains excellent performance on the auxiliary Australian dataset. Here, its MAE of 8.117 demonstrates reductions of 25.3%, 12.9%, and 8.8% compared to LSSVM, PSO-LSSVM, and CPO-LSSVM, respectively. Its RMSE of 10.605 reflects a reduction of 50.8% relative to LSSVM, and improvements of 31.0% and 19.2% compared to PSO-LSSVM and CPO-LSSVM. The NSE of 0.996, approaching the ideal value, highlights its strong generalization ability across datasets with different temporal resolutions and geographical characteristics. In summary, the CPO-PSO-LSSVM model consistently surpasses the other three models across all performance indicators, particularly excelling in reducing MAE and RMSE. The auxiliary validation with Australian electricity load data reaffirms its exceptional performance and adaptability. Across different time intervals (1 h and 0.5 h) and regions, the CPO-PSO-LSSVM model demonstrates robust stability and high predictive accuracy, confirming its effectiveness for short-term electricity load forecasting. The improved forecasting accuracy of the proposed model may contribute to more reliable power dispatching, reduced operational uncertainty, and enhanced energy management efficiency in modern smart grid systems. Critical analysis Synergistic effects of global–local optimization The experimental results clearly demonstrate that the proposed CPO-PSO-LSSVM model achieves superior forecasting performance compared to LSSVM, PSO-LSSVM, and CPO-LSSVM across all evaluation metrics. This improvement is primarily attributed to the synergistic integration of CPO’s global search and PSO’s local refinement. The CPO algorithm effectively explores the broader hyperparameter space, avoiding premature convergence, while PSO fine-tunes within a narrowed parameter region, enhancing the model’s ability to generalize across unseen data. This global–local optimization strategy not only improves predictive accuracy but also reduces the computational burden compared to exhaustive grid searches or single-stage metaheuristic optimization. Compared with deep learning-based forecasting frameworks, the proposed LSSVM-based model requires fewer training samples and lower computational resources while still maintaining competitive forecasting accuracy. This characteristic makes the proposed framework more suitable for practical STLF scenarios with limited data availability and computational constraints. Model robustness across datasets The CPO-PSO-LSSVM model maintains robust performance across different datasets and time granularities (hourly in Jiangsu and half-hourly in Australia). In both cases, it consistently outperforms the baseline models in MAE, RMSE, and NSE metrics. The relatively smaller improvement observed on the Australian dataset may be associated with its higher baseline forecasting stability and lower fluctuation intensity compared with the Jiangsu dataset. Since the Australian dataset already exhibits relatively smooth load patterns and high baseline NSE values, the optimization space for further performance enhancement becomes comparatively limited. Nevertheless, the minimal degradation in performance on the auxiliary dataset highlights the framework’s adaptability to different grid conditions and data resolutions, which is crucial for practical deployment in diverse energy systems. Limitations and future perspectives Although the model has been validated using datasets from Jiangsu (China) and Australia, both regions have relatively stable power grids and moderate climatic variability. The generalizability of the CPO-PSO-LSSVM model to regions with more volatile electricity demand, such as grids with high renewable energy integration (e.g., solar or wind-dominated systems) or developing areas with frequent power outages, remains to be established. The current model includes basic external factors such as temperature and holiday indicators. However, other influential variables—such as real-time weather conditions (e.g., humidity, wind speed), electricity market dynamics (e.g., demand response events, price spikes), and socioeconomic factors—are not incorporated. The absence of these features may limit forecasting accuracy under atypical load patterns or extreme events. In addition, although the proposed two-stage optimization framework improves forecasting accuracy and optimization stability, the hybrid optimization process inevitably increases computational complexity compared with single-stage optimization methods. This may limit real-time deployment efficiency in extremely large-scale forecasting scenarios or resource-constrained environments. Future research should focus on validating the model in diverse geographical contexts and integrating additional external features to enhance predictive performance under complex real-world scenarios. Moreover, exploring hybridization with deep learning architectures could further improve the model’s ability to capture nonlinear temporal dependencies in highly dynamic power systems. Conclusion This study proposes a novel CPO-PSO-LSSVM hybrid model for short-term electricity load forecasting, which effectively addresses the challenges of hyperparameter sensitivity and nonlinearity in complex load datasets. The major contributions and findings are summarized as follows:Performance Enhancement: The integration of CPO’s global exploration and PSO’s local refinement significantly improved the predictive accuracy and robustness of the LSSVM model. Specifically, the CPO-PSO-LSSVM model achieved reductions in RMSE of 50.3% and 50.8% on the Jiangsu and Australian datasets, respectively, compared to the baseline LSSVM model. This demonstrates its superior capability in capturing nonlinear and dynamic load patterns.Innovative Optimization Framework: The proposed two-stage metaheuristic optimization framework combines the strong global search ability of CPO with the efficient local exploitation of PSO. This hybridization overcomes the premature convergence and limited exploration issues commonly encountered in single-stage metaheuristic algorithms, providing a highly effective solution for LSSVM hyperparameter tuning.Generalizability and Robustness: The model was validated on two datasets with different temporal resolutions (hourly and half-hourly) and geographical regions (China and Australia). It consistently outperformed other models across all performance metrics (MAE, RMSE, NSE), demonstrating its strong adaptability and reliability for diverse power grid scenarios.Practical Implications: By delivering more accurate short-term load forecasts, the CPO-PSO-LSSVM model provides valuable support for power system operations. It can facilitate optimal energy dispatch, enhance grid stability, and enable more effective integration of renewable energy sources into smart grids. Performance Enhancement: The integration of CPO’s global exploration and PSO’s local refinement significantly improved the predictive accuracy and robustness of the LSSVM model. Specifically, the CPO-PSO-LSSVM model achieved reductions in RMSE of 50.3% and 50.8% on the Jiangsu and Australian datasets, respectively, compared to the baseline LSSVM model. This demonstrates its superior capability in capturing nonlinear and dynamic load patterns. Performance Enhancement: The integration of CPO’s global exploration and PSO’s local refinement significantly improved the predictive accuracy and robustness of the LSSVM model. Specifically, the CPO-PSO-LSSVM model achieved reductions in RMSE of 50.3% and 50.8% on the Jiangsu and Australian datasets, respectively, compared to the baseline LSSVM model. This demonstrates its superior capability in capturing nonlinear and dynamic load patterns. Innovative Optimization Framework: The proposed two-stage metaheuristic optimization framework combines the strong global search ability of CPO with the efficient local exploitation of PSO. This hybridization overcomes the premature convergence and limited exploration issues commonly encountered in single-stage metaheuristic algorithms, providing a highly effective solution for LSSVM hyperparameter tuning. Innovative Optimization Framework: The proposed two-stage metaheuristic optimization framework combines the strong global search ability of CPO with the efficient local exploitation of PSO. This hybridization overcomes the premature convergence and limited exploration issues commonly encountered in single-stage metaheuristic algorithms, providing a highly effective solution for LSSVM hyperparameter tuning. Generalizability and Robustness: The model was validated on two datasets with different temporal resolutions (hourly and half-hourly) and geographical regions (China and Australia). It consistently outperformed other models across all performance metrics (MAE, RMSE, NSE), demonstrating its strong adaptability and reliability for diverse power grid scenarios. Generalizability and Robustness: The model was validated on two datasets with different temporal resolutions (hourly and half-hourly) and geographical regions (China and Australia). It consistently outperformed other models across all performance metrics (MAE, RMSE, NSE), demonstrating its strong adaptability and reliability for diverse power grid scenarios. Practical Implications: By delivering more accurate short-term load forecasts, the CPO-PSO-LSSVM model provides valuable support for power system operations. It can facilitate optimal energy dispatch, enhance grid stability, and enable more effective integration of renewable energy sources into smart grids. Practical Implications: By delivering more accurate short-term load forecasts, the CPO-PSO-LSSVM model provides valuable support for power system operations. It can facilitate optimal energy dispatch, enhance grid stability, and enable more effective integration of renewable energy sources into smart grids.