# Improving Electric Energy Consumption Prediction Using CNN and Bi-LSTM
## 4 Experiments  
In this section, the experiments were conducted to compare four common performance metrics for time series prediction including MSE, RMSE, MAE and MAPE as well as the processing time of the experimental methods. Since the IHEPC is recorded in 5 five years so that we took the first 3 years as the training and the rest 2 years for the testing. The experimental methods were implemented in Keras library and performed in the server with 4 GPU cards of GTX 1080 Ti. Our model ([[https://github.com/vmthanh/electric_enegery_comsumpsion](https://github.com/vmthanh/electric_enegery_comsumpsion)]([https://github.com/vmthanh/electric_enegery_comsumpsion](https://github.com/vmthanh/electric_enegery_comsumpsion))) is trained in 100 epochs, batch size 30 using Adam optimization with initial learning rate as 0.001. The first metric is MSE that measures the average of the squares of the errors. In other words, it is the average squared difference between the predicted values and the actual values. The equation of MSE is as follows. \[MSE=\frac{1}{n}\sum_{1}^{n}\left(y-\hat{y}\right)^{2} \tag{10}\]  
Meanwhile, RMSE is the standard deviation of prediction errors. Firstly, let's consider residuals which are a measure of how far from the regression line data points are. Therefore, RMSE is a measure \begin{table}
\begin{tabular}{c c c c} \hline \hline
**\#No** & **Layer Type** & **Neurons** & **Parameters** \\ \hline
1 & Convolution1D & (None, None, 6, 64) & 192 \\
2 & MaxPooling1D & (None, None, 3, 64) & 0 \\
3 & Convolution1D & (None, None, 2, 64) & 8256 \\
4 & MaxPooling1D & (None, None, 1, 64) & 0 \\
5 & Flatten & (None, None, 64) & 0 \\
6 & Bi-LSTM & (None, None, 128) & 66,048 \\
7 & Bi-LSTM & (None, 128) & 98,816 \\
8 & Fully connected layer & (None, 128) & 16,512 \\
9 & Dropout & (None, 128) & 0 \\
10 & Fully connected layer & (None, 1) & 129 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The structure and configuration details of the proposed model. of how spread out these residuals are. This metric is commonly used in climatology, forecasting, and regression analysis to verify the experimental models and are determined as follows. \[RMSE=\sqrt{\frac{1}{n}\sum_{1}^{n}{(y-\hat{y})^{2}}} \tag{11}\]  
In addition, MAE measures the average magnitude of the prediction errors and ignores their directions. In more detail, it's the average the absolute differences between prediction and actual values for all instances in the testing set. Note that this measurement considers all individual differences are the same weight. MAE is determined as the following equation. \[MAE=\frac{1}{n}\sum_{1}^{n}\left|y-\hat{y}\right| \tag{12}\]  
The last metric namely MAPE is a measure of prediction accuracy of a forecasting method such as time series prediction. This metric expresses accuracy in percentage the following equation:  
\[MAPE=\frac{100\%}{n}\sum_{1}^{n}\left|\frac{y-\hat{y}}{y}\right| \tag{13}\]  
To show the effectiveness of EECP-CBL model, this section compares four above performance metrics such as MSE, RMSE, MAE and MAPE computed by Equations (10)-(13) respectively of Linear Regression, LSTM and CNN-LSTM [31] and the proposed model for minutely, hourly, daily and weekly datasets derived from the IHEPC dataset. Table 3 presents the results of experimental methods for minutely dataset. The proposed model reaches the best values of MSE, RMSE, MAE and MAPE at 0.051, 0.225, 0.098 and 11.66 respectively while the second approach, CNN-LSTM, obtains 0.374, 0.611, 0.349 and 34.84 of MSE, RMSE, MAE and MAPE respectively. Meanwhile, LSTM and Linear Regression did not achieve good results for this dataset. The gaps between the results in terms of the predictive performance of our approach and others are very large. Therefore, the proposed model explicitly outperforms other approaches including Linear Regression, LSTM and CNN-LSTM for minutely dataset.