Feature selection and hyperparameter tuning in transformer-based deep learning models for photovoltaic power forecasting using the Swordfish Movement Optimization Algorithm (SMOA)
El-Sayed M. El-kenawy, Amel Ali Alhussan, Ebrahim Abdulla Mattar, Marwa Radwan
Abstract
Accurate photovoltaic (PV) power forecasting is essential for ensuring grid stability and efficient energy management in modern power systems. However, the nonlinear and intermittent nature of solar radiation limits the performance of traditional models. This study proposes a hybrid forecasting framework combining PatchTST with the Swordfish Movement Optimization Algorithm (SMOA) and its binary variant (bSMOA) to enhance prediction accuracy and model interpretability. The PatchTST captures complex temporal dependencies through self-attention and patch embedding, while bSMOA performs optimal feature selection and SMOA fine-tunes hyperparameters to improve convergence and generalization. Experimental results demonstrate that the proposed model achieved a Mean Squared Error ( 5 . 64 × 1 0 − 7 ), Root Mean Squared Error ( 9 . 46 × 1 0 − 7 ), and Mean Absolute Error ( 7 . 32 × 1 0 − 6 ), with a correlation coefficient ( r = 0 . 9598 ) and a coefficient of determination ( R 2 = 0 . 9660 ). The proposed framework achieved a Willmott Index ( W I = 0 . 9632 ) and a Nash–Sutcliffe Efficiency ( N S E = 0 . 9755 ). These results confirm the superior accuracy, robustness, and efficiency of the PatchTST–SMOA framework. The model provides a scalable and interpretable solution for short-term PV power forecasting, supporting predictive maintenance, energy dispatching, and the sustainable integration of renewable energy into intelligent grid systems. • PatchTST–SMOA framework enhances photovoltaic power forecasting accuracy. • Binary SMOA effectively selects optimal features in high-dimensional PV data. • Continuous SMOA automates PatchTST hyperparameter tuning for better convergence. • Integrated dual-stage optimization reduces error and boosts model generalization. • Model achieves 88% lower MSE and supports scalable renewable energy forecasting.