# Smart Grid Data Management in a Heterogeneous Environment with a Hybrid Load Forecasting Model
## 6 Results and Discussion (Case Study 2)
### Case Study 2: Data Analytics (Load Forecasting)
#### 6.1.1 The Proposed Model  
In this research, we proposed a novel approach for the load forecasting of the Baghdad Governate using a hybrid model encompassing a fuzzy C-means clustering (FCM), the Auto Regressive Integrated Moving Average (ARIMA) model, and Gradient-Boosted Tree Learner (GBTL). The proposed method consists of five stages, as shown in Figure 13. \begin{table}
\begin{tabular}{c c} \hline
**Language** & **English** \\ \hline Privacy & Private \\ Source and Ownership & Iraqi Ministry of Electricity (MOELC). \\ Sampling & One Year for Baghdad Governate \\  & (24 H*365 D) \\ Data Collection Period & 1 January 2019 to 31 December 2019 \\ Database Type & CSV \\ Parameters & (Load value Per Hour, Max, Min, AV Degree \\  & Per days) \\ Disc Size & Around 65 KB \\ \hline \end{tabular}
\end{table} 
Table 6: Power Load Dataset Profile Information. Figure 13: The Proposed Model. First Stage (Data Reading and Preparation): data can be imported directly or linked to different databases through the internal API of our system and integrated and connected with the Knime platform. The next step is to un-pivot data from a 365/24 matrix to an hourly data form, 365*24. Figure 14 shows the daily Baghdad governorate load distribution (kW) for 2019, while Figure 15a,b show the hourly Baghdad governorate load distribution (kW) for 2019; in addition, we are checking missing values and normalization the load value between 0 and 0.5. Moreover, to handle rapid or irregular fluctuations and outliers (irregular patterns). Additionally, we applied outlier detection to smooth our data for the next stage process. * Second Stage (Data Clustering with FCM): our novel approach includes clustering data of an entire period, i.e., for 365*24 (8760 H) of 2019. The clustering analysis is an unsupervised method that behaves as a keystone in data analysis developments, which is especially helpful in an irregular patterns dataset. For that, FCM clustering was used to discover a set of homogeneous patterns in a heterogeneous load dataset [30]. The number of eight cluster groups that share the same characteristics in load was appropriate for the entire period, where each data input (value) is assigned, a likelihood score appropriate to that cluster. The formula of FCM is given in Equation (1) [30]. Figure 16 shows the cluster group membership. \[J(U,\ V)=\sum_{i=1}^{N}\sum_{k=1}^{C}U(i,k)^{m}\ D(i,k)^{2}\] (1) where: \(\bullet\)\(\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
a certain day or a certain period must be considered along with selecting the right cluster that they belong to. An ARIMA consists of two parts: an autoregressive (AR) model where the variable depends only on its lags, and a moving (MA) model [34] that combines the dependence between observation and residual of the forecast errors. ARIMA is written with the notation ARIMA (p,d,q), where 'p' represents the number of lag observations, 'd' represent the number of differences necessary to make the dataset stationary, and 'q' represents the size of the moving average window. The formula of ARIMA is given in Equation (3). \[Y_{t}=c+\varnothing_{1}Y_{t-1}\ +\cdots+\varnothing_{p}Y_{t-p}\ +\theta_{1}\ e_{t-1}+\cdots+\theta_{q}\ e_{t-q}+e_{t} \tag{3}\]  
where:  
\(p\) = is the order of the autoregressive part. \(q\) = is the order of the moving average part. \(c\) = constant. \(e_{t}\) = residuals (error in time \(t\)). The process of choosing the appropriate values for the ARIMA model (p,d,q) parameters is very important since all the prediction values will depend on these values. To find the best ARIMA (p,d,q) parameters for this dataset, we fit different ARIMA models using auto function and select the model with the minimum Akaike Information Criteria (AIC) value. The AIC is an estimator of the relation quality of statistical models for a given dataset. Table 7 shows the parameters (p,d,q) of the best fit model for each cluster training dataset, where it was calculated using the auto.arima function in a Python programming language. A lower AIC value indicates a better fit model.