## 2 The Proposed Prediction Method
To ensure a robust evaluation and minimize the risk of overfitting in our electricity demand forecasting model, we implemented a 5-fold cross-validation strategy using TimeSeriesSplit from the scikit-learn library [18]. This time-based cross-validation method preserves the chronological order of the data, ensuring that training sets consistently preceded validation sets temporally. Step 3: Benchmark Deep Learning Models:  
The proposed energy prediction model was compared with many benchmark deep learning models such as DNNs and CNNs. Integrating various deep learning algorithms significantly improved the accuracy of energy demand prediction. The configuration details of the benchmark deep learning models are presented in Table 1.  
Step 4: CNN-LSTM with Attention Mechanism for Prediction:  
The proposed energy prediction model architecture, which is based on CNN-LSTM with a self-attention model, is used to predict energy demand based on HDDs and CDDs. Figure 1 depicts the structure of the proposed model. The proposed model integrates CNN and LSTM algorithms with an attention mechanism. The soft attention technique is expressed as follows:  
\[O=softmax\big{(}\frac{QK^{T}}{\sqrt{d_{k}}}\big{)}V \tag{2}\]  
where \(O\) is the output of the attention mechanism, \(Q\) is the query matrix, \(K\) is the key matrix, \(V\) is the value matrix, and \(d_{k}\) is the dimension of the key vectors. The CNN algorithm plays a vital role in feature extraction from the input features. The CNN consists of twenty convolution layers with another twenty pooling layers; each  
Figure 1: Flowchart of electricity demand prediction using a hybrid model. \begin{table}
\begin{tabular}{l l} \hline \hline
**Hyper Parameter** & **Setting** \\ \hline Layers—DNN—(Fully Connected) & Dense—64 \\ Layers—CNN & Conv1D—128 \\ Layers—LSTM & MaxPooling1D—128 \\ Batch Size & 128 \\ Dropout & 0.25 \\ Epochs & 500 \\ Activation Function & ReLU \\ Optimizer & Adam \\ Loss & MAE, MAPE \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Configuration of the benchmark models. layer consists of 128 neurons. To avoid the risk of overfitting, a dropout layer with a 20% rate was incorporated. The outputs of the CNN algorithms were then fed into a two-layer LSTM, each layer comprising 64 neurons, to enable sequence prediction. The output of the first LSTM layer was passed to a self-attention layer, which focuses on specific network features by assigning weights to relevant temporal dependencies. The second LSTM layer, integrated with an attention mechanism and a dropout layer, employed the same number of neurons (64) and dropout rate (20%) as the first LSTM layer. Nonlinearity was introduced via the Rectified Linear Unit (ReLU) activation function across the proposed CNN-LSTM-Attention model. Finally, a dense layer with a ReLU activation function processes the output to generate the model's predictions. To systematically identify the optimal hyperparameter values and enhance model robustness, grid search was applied during the training phase. A comprehensive experimental evaluation was conducted to analyze the effects of various hyperparameters, including the number of LSTM units, filters, and learning rate, on model performance. Table 2 presents the impact of different hyperparameter settings, such as the number of filters, LSTM units, and learning rates on MAPE. For instance, the first row shows a configuration with 32 filters and 50 LSTM units, yielding MAPE values of 15.24, 1.88, and 1.95 for learning rates of 0.1, 0.01, and 0.001, respectively. A visual representation of the hyperparameter analysis is provided in Figure 2, which illustrates the relationship between LSTM units, CNN filters, learning rate, and MAPE across all tested configurations.