{'fraction_non_alphanumeric': 0.03263165065740173, 'fraction_numerical': 0.010354928809864432, 'mean_word_length': 4.727662895044869, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Causal-TGAN: Generating Tabular Data Using Causal Generative Adversarial Networks

Synthetic data generation becomes prevalent as a solution to privacy leakage and data shortage. Generative models are designed to generate a realistic synthetic dataset, which can precisely express the data distribution for the real dataset. The generative adversarial networks (GAN), which gain great success in the computer vision fields, are doubtlessly used for synthetic data generation. Though there are prior works that have demonstrated great progress, most of them learn the correlations in the data distributions rather than the true processes in which the datasets are naturally generated. Correlation is not reliable for it is a statistical technique that only tells linear dependencies and is easily affected by the dataset's bias. Causality, which encodes all underlying factors of how the real data be naturally generated, is more reliable than correlation. In this work, we propose a causal model named Causal Tabular Generative Neural Network (Causal-TGAN) to generate synthetic tabular data using the tabular data's causal information. Extensive experiments on both simulated datasets and real datasets demonstrate the better performance of our method when given the true causal graph and a comparable performance when using the estimated causal graph.


INTRODUCTION & RELATED WORK
Over the last few years, there has been an increase in the work done around GANs (Goodfellow et al. (2014)). This architecture has been used to generate realistic images with great success in the field of computer vision. More recently, these generative models have been used for tabular data generation, demonstrating better performance than traditional generative models based on statistical techniques. GANs offer more flexibility in modeling real data distributions and provide higher quality results.
Prior to this work, Camino et al. (2018) propose to generate tabular data using GANs by introducing a multi-categorical setting. Park et al. (2018) present TableGAN, which can synthesize data containing categorical, continuous, and discrete values. The model adopts DCGAN architecture and guides the generator to generate synthetic samples with a reasonable label by adding an auxiliary classifier. Motivated by the urge to keep the data's privacy, Jordon et al. (2019) propose PATE-GAN to generate differentially private synthetic data, especially suitable for sensitive data such as Electronic Health Records (EHR). With the same motivations, Torfi et al. (2020) present CorGAN, which uses a one-dimension convolutional GAN architecture for both generator and discriminator. Moreover, Torfi et al. (2020) employ an autoencoder to transform the continuous outputs into discrete values. CTGAN (Xu et al. (2019)) addresses class imbalance by introducing a conditional generator, which provides the model with the capacity to evenly re-sampling all categories from discrete columns during the training process. In addition, CTGAN employs the Gaussian Mixture Models to encode the continuous columns to adapt the multimodal distributions for these columns better. This paper also introduces a new benchmark, looking to establish an accurate comparison between the different models that use GANs for generating synthetic tabular data.
However, all the GANs mentioned above learn the target distribution by capturing the inter-variants correlations. Excessive reliance on the inter-variants correlations may limit the performance of 1 arXiv:2104.10680v1 [cs.LG] 21 Apr 2021 using GANs to generate tabular data. It is a fact that the all the real dataset is created from the underlying inter-variants causal relations rather than the correlations. Using GANs to simulate how the real dataset is created in nature is supposed to be more efficient than simply learning the data distributions. We hence propose Causal Tabular Generative Adversarial Network (Causal-TGAN) to take advantage of inter-variants causal relations. We use adversarial learning to train a structural causal model (SCM) (Pearl (2009)). Similar methods have been used for causal discovery (Goudet et al. (2018)) and intervened image attributes generation (Kocaoglu et al. (2017)) in previous works. To our best knowledge, we are the first to use the adversarially trained SCM for synthetic data generation. Moreover, compared with the aforementioned methods, which are designed only to generate continuous variables (Goudet et al. (2018)) or binary variables (Kocaoglu et al. (2017)), our Causal-TGAN can generate more types of variables such as categorical and ordinal.
We use two kinds of metrics to evaluate Causal-TGAN on both the simulated dataset and real dataset. The experimental results demonstrate the advantage of Causal-TGAN compared with other GANs when given the true causal relations. When the true causal relations are absent, our Causal-TGAN still shows comparative performance using the estimated causal relations. In this section, we briefly introduce the concepts of causal models, specifically, the structural causal models (SCM) (Pearl (2009)). Let A be the set of features on a dataset D. D can be regarded as a joint distribution over A's domain. A causal model on A is a way to compactly describe this joint distribution by specifying the causal relations among the certain features in A. Specifically, an SCM is a directed acyclic graph (DAG) in which each feature of A is represented as a node, and the causal relations are represented by the causal mechanisms.

PRELIMINARY
Formally, a SCM, M, can be represented by a triplet M = X, F, U that contains a set of endogenous variables X = {X 1 , X 2 , ..., X d }, a set of causal mechanisms F = {F 1 , F 2 , ..., F d }, and a set of exogenous variables U = {U 1 , U 2 , ..., U d }, where each U i is independently drawn after distribution U. In our case, each endogenous variable X represents a feature in A. Under the causal sufficiency assumption (i.e., no confounder), the causal relation of "X i causes X j " can be represented by: X j = F j (X i , U j ). X i is called parent node or direct cause of X j and the exogenous variable U j can be seen as the sum of all unobserved causes of X j . The causal graph G M is a path diagram that encodes all of these causal relations for M. Figure  1 illustrate an example of SCM.

METHOD
Causal-TGAN is an SCM that employs multiple neural networks to fit the causal mechanisms for a causal graph using adversarial learning. Causal-TGAN runs in two steps: (i) obtain the causal graph that encodes the underlying inter-variant's causal relations of the target dataset. (ii) Using the obtained causal graph to construct Causal-TGAN and then adversarially training the Causal-TGAN to generate realistic samples. We discuss in details the above steps in this section. In Section 3.1, we introduce the method we use for discovering a causal graph from the tabular data when the ground causal graph is absent. In Section 3.2, we introduce the construction of Causal-TGAN as an SCM given a causal graph and introduce the training objective.

CAUSAL DISCOVERY
We use PC algorithm (Spirtes et al. (2000)) to discover the causal relations for our Causal-TGAN. Specifically, we use the package pcalg 1 to implement causal discovery. In pcalg, it needs a correlation matrix as input for testing conditional independence among variables. However, for tabular data, it is impossible to obtain correlation matrix between continuous and categorical columns. We hence employ the kernel-based approach introduced by Handhayani & Cussens (2019) to get a surrogate correlation matrix of which the correlation between two columns is represented by the distance of the two columns in feature space. It is worthy noting that, we do not claim any novelty in causal discovery. We encourage readers to try different causal discovery methods since accurate causal graphs can reduce the discrepancy between the learned and the target distribution (Goudet et al. (2018)).

MODELING SCMS WITH CAUSAL-TGAN
In this section, we introduce the construction of Causal-TGAN as an SCM by linking the components of Causal-TGAN with the concepts of SCM introduced in Section 2. For the triplet representation of an SCM, M = X, F, U , Causal-TGAN employs the Multiple Layer Perceptron (MLP) for all causal mechanisms in F. For the dataset with the feature set A, each endogenous variable X i represents a feature in A. The exogenous variables U for every node X are identically and independently sampled from the distribution U, which is the Gaussian Distribution in our experiment. Given a randomly sampled exogenous variable set U and the causal graph, Causal-TGAN can hence generate a sample S as: (1) where d is the number of features and P A i ∈ X \ X i denotes the parents nodes of the i th node. Causal-TGAN generates each endogenous variable in the topological order of the causal graph (i.e., from the top nodes to the bottom nodes). Note that, since our causal graph is acyclic, P A i must be a null set if the i th node is the top node. Consequently, like other GANs, our Causal-TGAN can generate a sample with only noises that sampled from the Gaussian Distribution.
The Causal-TGAN is trained adversarially to approximate the target distribution. We follow the GAN training procedure proposed by Gulrajani et al. (2017). We use F θ to denote the data generator, where θ is the set of parameters for each causal mechanism F θi i : θ = {θ 1 , θ 2 , ..., θ d }. Let D φ denotes the discriminator which is parameterized by φ. We train Causal-TGAN by solving the following optimization problem: (2) 4 EXPERIMENT

DATASET & METRICS
We use both simulated (causal graph is known) and real datasets (causal graph is unknown) in our experiment. For the simulated dataset, we use four popular Bayesian Networks, which are asia, child, alarm, and insurance 2 , to randomly sample 10,000 data points for each network. For the real dataset, we use adult, census, and news datasets from the UCI machine learning repository (Dua & Graff (2017)). In the following section, we use target dataset to denote the dataset used for training.
Generally, we evaluate the quality of the synthetic data by measuring the reality and the machine learning efficacy for the synthetic data. Reality measures how real the synthetic data compared with the target data. We use different methods to measure the reality for the simulated dataset and real dataset. We regard the Bayesian Networks used for generating the simulated dataset as oracle model. For the simulated dataset, we take advantage of the oracle model to calculate the likelihood of the synthetic data on oracle model. As for the real dataset, we use Kolmogorov-Smirnov (KS) Test (for continuous columns) and Chi-Squared (CS) test (for discrete columns) to compare the distribution between the real and synthetic columns. The scores returned by the CS and KS tests indicate the distribution difference. We use 1 to subtract the returned score so that a value closer to 1 represents a higher degree of similarity. To measure the Machine learning efficacy, we train machine learning models on the synthetic data and then evaluate the trained models on the target dataset. We use classification accuracy for classification tasks and R 2 for the regression task to denote the machine learning efficacy score. The used machine learning models for classification are the MLP classifier, AdaBoost, and Decision Tree. For regression, we use Linear regressor and MLP regressor. We use implementations provided by SDV package 3 for all the metrics above.  Table 1: Log-Likelihood of Synthetic Simulated Data on the Oracle Models. Higher value indicates higher likelihood the synthetic data is generated from the same origin as the target data.

RESULTS
We compare our Causal-TGAN with PrivBN (Zhang et al. (2017)), MedGAN (Choi et al. (2017)), TableGAN (Park et al. (2018)) and CTGAN (Xu et al. (2019)). We train each model for 300 epochs with batch size of 500. We follow the method proposed in Xu et al. (2019) to encode the variables. Specifically, we use Gaussian Mixture Model to encode continuous columns and one-hot to encode discrete columns. For the below tables, we consistently highlight the best performance with bold and underline the second best performance. Moreover, we denote Identity as the method that generate target dataset.   Table 3: Machine Learning Efficacy Score The reportd score are average accuracy for classification tasks and average R 2 score for regression task.
For the simulated data, we report the log-likelihood of synthetic data on the oracle Bayesian Network in Table  1. Causal-TGAN achieves the best overall performance as well as the best for three datasets except for the child dataset. Moreover, our Causal-TGAN outperforms other GAN models by an average of 29%. In this experiment, we use the structure of the Bayesian Network as the causal graph for Causal-TGAN. This result demonstrates an ideal case: when the true underlying causal relations are presented, causality-based GAN models can outperform those that capture correlation.
For the real dataset, we first measure the distribution similarity between the columns of the real and synthetic dataset, see Table 2. The scores vary for different models across the different datasets. We hence compare by the average scores over all the dataset. It shows that both CTGAN and Causal-TGAN achieve the best average column similarity. All columns of the news dataset (binary and continuous) are considered continuous columns in our experiment. As a result, there is no CS Test score reported for the news dataset. As for the machine learning efficacy, Table 3 reports the accuracy and R 2 scores for classification and regression tasks, respectively. For adult and news data, CTGAN keeps achieving the best performance for all datasets, and Causal-TGAN consistently achieves the second-best performance. For census, MedGAN and PrivBN achieve the first two best scores.

CONCLUSION
We propose a novel generative model named Causal-TGAN to generate tabular data by taking advantage of inter-variants causal relations. We evaluate Causal-TGAN with metrics of distribution similarity and machine learning efficacy. The experimental results show that our Causal-TGAN with the presence of true causal relations can outperform all other generative models in generating realistic synthetic data. When the true causal relations are absent, Causal-TGAN can still achieve comparative results by using the estimated causal relations. In future work, we will discover more advantages of using causal relations for generating tasks.