# A Data-Driven Approach for Generating Synthetic Load Profiles with GANs
## 2 Materials and Methods
### Problem Definition  
As was already mentioned, this study aims to develop a GAN model capable of learning the statistical and temporal patterns of hourly electrical load profiles from various datasets comprising both residential and industrial buildings. Each sample in the dataset represents a 24-dimensional vector, corresponding to a single day's worth of hourly active power (kW) measurements at a one-hour temporal granularity. The trained GAN should generate synthetic load profiles that have the same dimensionality and distributionalcharacteristics as the original data. The output must preserve realistic daily variation, distinguish building types implicitly, and maintain temporal coherence within each day.  
The synthetic dataset must adhere to the following requirements:  
* Statistically similar to the real dataset in terms of distribution and variance;
* Temporally consistent, reflecting plausible daily behavior (e.g., peak hours);
* Unidentifiable, i.e., not replicating individual real profiles;
* Equal in shape, with the same number of samples and dimensions as the input dataset, to facilitate downstream modeling without reconfiguration.  
Furthermore, the proposed methodology should be applicable in the case where a limited amount of data are available.  
Let the original training dataset with a temporal resolution of \(1\) h (i.e., \(x_{i}^{t}\) is the load at hour \(t\in\{1,2,\ldots,24\}\)) be the following:  
\[\chi=\{x_{1},x_{2},\ldots,x_{N}\},x_{i}\in\mathbb{R}^{24}, \tag{1}\]  
where \(\chi\) is the dataset of real electrical load profiles, \(N\) is the number of daily profiles (i.e., the number of rows), and \(x_{i}\) is a 24-dimensional vector representing hourly power load for day \(i\).  
The GAN is trained by solving the following min-max optimization problem:  
\[\underset{G}{\text{min}}\;\underset{D}{\text{max}}=E_{x}[logD(x)+E_{z}[log(1- D(G(z)))]], \tag{2}\]  
where \(D(x)\) is the output of the discriminator, \(D\), when given a real sample \(x\), \(E_{x}\) is the expected operator applied to all real instances and represents the average value of the discriminator's output given a real sample, \(x\), as an input; \(G(z)\) is the output of the generator, \(G\), when given a random input \(z\) (usually noise); \(D(G(z))\) is the output of the discriminator when given the output of the generator (the discriminator's classification whether the generated sample is real or fake); and \(E_{z}\) is the expected value operator that is applied to all random inputs to the generator (i.e., the average value of the discriminator's output when given the generated sample \(z\) as input).  
The trained generator, \(G\), is then used to create a synthetic dataset, as follows:  
\[\hat{\chi}=\{G(z_{1}),G(z_{2}),\ldots,G(z_{N})\},\;z_{i}\sim p_{z}(z), \tag{3}\]  
where several important notes should be made, as follows: \(\hat{\chi}\in\mathbb{R}^{N\times 24}\) matches the shape of \(\chi\), the statistical distance \(D_{div}(x_{i},\hat{\chi}_{i})\) is minimized, and the temporal and behavioral properties of the real data are preserved in the generated profiles.