## 2 Materials and Methods
### Module Development
#### 2.2.3 The Learning Algorithm
```
1 Input: Traffic data
2 Output: The minimized objective function
3 Data preparation
4 Split Data (training set/validation set)
5 Defining min-max scaler
6 Fitting with min-max scaler
7 Reshaping data
8 EPOCH:120
9 Create the LSTM network
10 For number layers from 1 to 4 do
11 For Optimizer = [Adam, RMSProp, Nadam]do
12 For the Batch size in the range [32, 512,32]do
13 For Linite in the range [8,256,8]do
14 For dropout in the range [0.1,0.3,0.1]do
15 Fit the LSTM network
16 Make predictions with train and Validation datasets
17 Calculate the root mean square error and quantify the energy consumed
18 Calculate the objective function
19 End
20 End
21 End
22 End
23 End
24 Choice of hypermeters for which the objective function is minimal

### Evaluation Module

The proposed framework was evaluated using different hardware and software environments. Table 2 shows the equipment used to assess the proposed method. To evaluate the performance of the proposed model, the Root Mean Square Error (_RMSE_) was used to estimate the prediction accuracy, and the PyRAPL tool was used within this study to quantify the energy consumption as a function of the hyperparameter combination. Each time we tested different hyperparameters, the model needed to be trained on the training data, predictions made on the validation data, and the model needed to be evaluated. #### 2.3.1 Evaluation Metrics with RMSE

We opted for the _RMSE_ metric, which measures the average error between the predicted values and the real values, taking into account the square root of the deviations. This metric is particularly useful for evaluating the performance of regression models with outliers, as it further penalizes large errors. _RMSE_ is a measure often used to evaluate the accuracy of the prediction obtained by the model. The formula for calculating _RMSE_ is as follows:

\[RMSE=\sqrt{\frac{1}{N}{\sum(y_{i}-\hat{y_{i}})}^{2}} \tag{9}\]

_RMSE_ measures the square root of the mean of the deviation squares, which quantifies the difference between the predicted values and the actual ones. Where \(y_{i}\) is the actual value, \(\hat{y_{i}}\) is the predicted value, and \(N\) represents the total number of predicted traffic data. #### 2.3.2 Measurement of Energy Consumption

To measure the impact of hyperparameters on the energy consumption of the model, the energy consumption of the algorithm during its execution needs to be measured. This experiment used PyRAPL, which provides a Python interface to Intel \"Running Average Power Limit\" (RAPL) technology. RAPL estimates the power consumption of a CPU and has been available on Intel CPUs since the Sandy Bridge generation. RAPL provides measurements for the energy consumption of the whole CPU socket package [34]. All experiments were performed on a PC with an Intel(R) Core (TM) i5-1035G1 processor, running at a speed of 1.00 GHz 1.19 GHz, with 8 GB of RAM, and running on the Windows 10 operating system. The deep learning model was implemented using the Tensorflow 2.4.1 library and the Python programming language. The complete model was trained on a single CPU for 120 epochs, which took approximately 520 h.

#### 2.3.3 Objective Function Minimization

Our problem addresses the tradeoffs involved in a two-objective optimization problem, minimization of energy consumption and prediction error. For this, we defined the objective function (\(OF_{min}\)) as follows:

\[OF_{min}=\left[W_{1}^{2}\left[\frac{E_{c}-E_{c,\mu}}{E_{c,max}}\right]^{2}+W_{2 }^{2}\left[\frac{RMSE-RMSE_{,\mu}}{RMSE_{,max}}\right]^{2}\right]^{1/2} \tag{10}\] \begin{table}
\begin{tabular}{l l l l l l} \hline \hline
**Weights** & **Layers** & **Batch Size** & **Number of Units** & **Optimizer** & **Dropout** & **OF\({}_{min}\)** \\ \hline W1 = W2 = 0.5 & 3 & 64 & 184 & RMSprop & 0.1 & 0.39397401 \\ \hline W1 = 0.7 & 3 & 64 & 184 & Nadam & 0.1 & 0.24012428 \\ W2 = 0.3 & 3 & 32 & 72 & Nadam & 0.1 & 0.54496929 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Optimization result.