## 3 Case Study--The ANN Models for Load Forecasting
### Data Preprocessing  
It is very important to clean, preprocess, and prepare appropriately for the required formatted data for ANNs models. First, the data can consist of outliers, noises, and Nan values that have undesirable effects on the study. Outliers can be due to the variability in the data, data extraction, data exchange errors, recording, and human errors among many other reasons. Therefore, the recordings that do not fall within three standard divisions (SD) are considered outliers in this study based on the method suggested in reference [66]. Boxplot of monthly power load before the removal of outliers (a) and after the removal of outliers (b) can be seen from the boxplot in Figure 10. In total, there are only 122 records removed from 121,004; hourly electric power consumption records are removed as outliers from the dataset.  
Electric power load data has daily, seasonality, and yearly periodicities. To capture these periodicities, the sine and cosine of the days and years are used to capture periodicity in the days and seasonality in the years. These features with the temperatures are used for multivariable ANN modeling in prediction tasks. There is a correlation between these features; for example, electric consumption is affected by temperatures. As can be seen from Figure 11, there is a strong negative correlation between electric consumption, \(-0.789\), and as the temperature goes up, the energy consumption decreases.  
Figure 10: Boxplot of power load before the removal of outliers (**a**) and after removal of outliers (**b**).  
Figure 9: Norway’s hourly electricity consumption in megawatts (MW) and temperatures in Celsius (\({}^{\circ}\)C) from 1 January 2009 to 21 October 2022.  
Normalization of data has many benefits, such as reducing prediction errors, reducing computational costs, and reducing the risk of overfitting the neural networks during the training [67, 68]. In this study, Z-score normalization is used (Equation (20)) to normalize the data, as can be seen in Figure 12.  
\[Z=\sum_{i=1}^{n}\frac{x_{i}-\mu}{\delta} \tag{20}\]  
where Z is the standardized value (Z-score) of the \(i\)th data point \(x_{i}\), and \(\mu\) and \(\delta\) are the mean and the standard deviation of the dataset, respectively.  
Finally, the dataset is split into training validation and test, 70%, 15%, and 15% respectively. The training data set is used for training the ANN models to learn hidden relationships, features, and patterns in the dataset. The validation set is used for validating the ANNs models' performance during the training, and the test set is an unseen data set that provides an unbiased metric to evaluate the performance of the models after the training.  
The previous 24 h are used as the sequences for training the ANN models. In the multivariable models, all the features are fed into the model, while in the univariable model, the variable of interest, which here is electric consumption, is fed into the model. Figures 13 and 14 show some examples of the univariable and multivariable input sequences for training ANN models.  
Figure 11: The electric consumption and temperature correlation, colored based on temperature.  
Figure 12: Z-score normalization of features in dataset.  
Moreover, to evaluate the effect of the number of input data on the performance of different ANN models, the data are divided into three parts (100%, 50% and 25% of the dataset, Table 3).