# A Methodology for Controlling Bias and Fairness in Synthetic Data Generation
## 3 Methodology for Data Generation
### Comparison with Bayesian Networks  
Before analyzing the results achievable through the proposed methodology, it is interesting to compare the number of parameters required to generate a dataset by using this approach with respect to the number of parameters needed when using a Bayesian network.  
Unlike all data augmentation techniques, the proposed approach does not rely on existing data and therefore cannot be easily compared to these techniques. As a consequence, the data generation method is compared only with Bayesian networks whose conditional probability table (CPT) values are not derived from data, but set as tuning parameters.  
The network depicted in Figure 3 generates a dataset containing financial and personal information to be used for evaluating the possibility on whether to grant a loan or not by a machine learning algorithm. In this scenario, variables such as \"Economic Status\", \"Credit History\", \"Gender\", \"Ethnicity\" and \"Loan Status\" can take on two different categorical values, whereas the others can take on three. Note that, not to clutter the presentation, in what follows, each node represents both a latent variable as well as the corresponding categorical feature.  
The first step to build such a dataset using a Bayesian network consists of creating and populating the CPT, which is defined for a set of discrete and mutually dependent random variables to display conditional probabilities of a single variable with respect to the others (i.e., the probability of each possible value for a variable if the values taken on by the other variables are known) [21]. For example, to build from the ground the \"Education\" variable CPT, it would be necessary to set a value for all possible combinations \(p(\mathit{Education}|\mathit{Age},\mathit{LivingArea})\) such that \(\sum_{i}p(\mathit{Education}_{i}|\mathit{Age},\mathit{LivingArea})=1\) holds, where \(\mathit{Education}_{i}\) represents the \(i\)-th value of the correspondent variable. Variable \"Education\" is, in fact, conditionally dependent on variables \"Age\" and \"Living Area\". Since variables \"Education\", \"Age\" and \"Living Area\" can take on three values each, the total number of parameters needed to fully characterize the \"Education\" CPT would be 18. If this process is repeated for all variables, a total of 185 would be needed to fully characterize such a Bayesian network.  
In contrast to that, the proposed methodology only needs 29 parameters, one for each conditional variance (needed to initialize the latent Gaussian variables), for a total of 12, and 17 for each regression coefficient, that is, the weight of each edge occurring in the network (see Figure 3).  
In conclusion, this work highlighted how the proposed methodology drastically lowers the amount of parameters needed to generate synthetic datasets with respect to traditional Bayesian networks, while keeping the final dataset balanced in terms of equally distributed observations.  
Figure 3: Loan approval network: this structure could represent a real scenario that can be used to produce a synthetic dataset.