# Simulating Intraday Electricity Consumption with ForGAN
## 4 Results: ForGAN in Action
Next, the evolution of the discriminator's and the generator's objective functions, \(J_{D}\) and \(J_{G}\), is examined during the training process, as shown in Figures 12 and 13. Note that in the best-case scenario, the setup corresponds to a zero-sum game, and the equality  
\[J_{D}(\theta_{D}^{*};\theta_{G}^{*})+J_{G}(\theta_{G}^{*})=0 \tag{8}\]  
holds. Figure 11: Histograms of the probability distribution of one-step-ahead forecasts learned from ForGAN (in red) and of the one-step-ahead changes of the test data time series (in blue). Figure 12: Evolution of the discriminator’s objective function, which is dependent on the number of iterations in the training process. As the non-saturating GAN loss is used, i.e., the discriminator aims to maximize the (average) sum of the log probabilities for correctly classifying real data and rejecting fake data, meaning that \(\log D(x)+\log(1-D(G(z)))\), the generator strives to maximize the (average) \(\log(D(G(z)))\). To formalize the min-max game, the generator's loss is multiplied by \(-1\). The networks are trained with a non-saturating loss function for 1000 steps. After 200 iterations, the discriminator's objective function stabilizes, with values fluctuating mostly between 0.69 and 0.70. In contrast, the generator's loss exhibits larger fluctuations early on but begins to stabilize after 300 training steps, and Equation (8) is close to being satisfactory. This indicates that the found \(\theta\)-parameters are close to the optimal ones, at least with regard to the requirement of Equation (8). In the next step of the quality check, the auto-correlation plot of the test data series is compared with that of the generated data, i.e., the correlations between the elements \(X_{j}\) and \(X_{j+k}\) for \(k=0,\ldots,n\) are plotted to examine the influence of previous observations on subsequent ones. The auto-correlation can be seen as a description of the flow of information through a time series. To generate the auto-correlation plots in Figures 14 and 15, a random consecutive segment of 400 data points is selected from the test and generated data. Using the complete test dataset, which contains 56,096 data points in total, would result in a very fuzzy plot, as will become evident later when the cross-correlation plot of the full time series is considered in Figure 16.  
The two graphs show the impressive dependence between the consecutive variables in both time series. Additionally, the shapes of the plots are very similar. Only the lags around 40-50 in the test data seem to have no significant value (as they are inside the blue shadow around the \(x\)-axis), although they seem to be significantly correlated for generated data. Still, the difference in the values is small, and the global picture with regard to auto-correlation seems to be well learned by ForGAN. Figure 13: Evolution of the generator’s objective function during the training process. An auto-correlation plot for both the test series and a generated series over all possible lags in the test data is shown in Figure 16. It might look chaotic but it also shows that there are daily and weekly cycles in the auto-correlation that indeed can be observed by the (very many) peaks (keeping in mind that one day has 96 possible lags and a week has 672 lags) and that vanish slowly. These patterns appear to be well learned by ForGAN. Figure 14: Auto-correlation plot of the generated data (for a subset of 400 15 min slots). Figure 10:0 Auto-correlation plot of the real data (for a subset of 400 15 min slots). Finally, a test is conducted to determine whether the generated and real time series differ over time by examining their cross-correlation. That is, the analysis checks whether past values of one time series can be used to predict present values of the other. A cross-correlation plot represents frequencies, showing the similarity between signals as a function of the time lag.