# A Comparative Analysis of the TDCGAN Model for Data Balancing and Intrusion Detection
## 3 Experiments Setup  
A simplified workflow for the work is outlined in Figure 1. The flowchart of our study illustrates the iterative process applied to four different datasets to evaluate the impact of data augmentation using the TDCGAN model on classification performance.  
The process is described below.  
Data Iteration: The model undergoes four iterations, each time processing a different dataset. In each iteration, a sample from the dataset is selected and subjected to a series of preprocessing steps to ensure data consistency.  
Data Preprocessing: This step includes a series of preprocessing operations such as:  
Error Elimination and Gap Filling: The selected dataset undergoes preprocessing to eliminate errors, fill gaps, remove outliers, and discard irrelevant data types. Simple linear interpolation is employed to fill in any missing values.  
Feature Encoding: To prepare the dataset for machine learning algorithms, categorical features are encoded using one-hot encoding.  
Figure 1: Flowchart of the study.  
Scaling: The dataset is scaled using the MinMaxScaler from Scikit-learn, normalizing the values to the range [0,1].  
Feature Selection (PCA): Principal Component Analysis (PCA) is applied to the dataset. PCA reduces the dimensionality of the data while retaining the most significant features, thereby enhancing computational efficiency and potentially improving model performance.  
Data Splitting: The dataset is split into two parts: 70% of the data are allocated to the training set, while the remaining 30% is used as the testing set. We divided the dataset into 70% for training and 30% for testing to ensure the reliability of our model's evaluation. This division allows us to train the model on a sufficient portion of the data while reserving a separate, unseen portion for testing. This approach helps prevent overfitting and ensures that the model's performance is assessed on data it has not encountered before, providing a more accurate measure of its generalization ability. The 70 and 30 split is a standard practice in machine learning, ensuring a robust and unbiased comparison of different models or techniques.  
TDCGAN Model Application: The TDCGAN model is trained using the training data of each dataset to generate synthetic samples. These samples are used to improve data balance within the training set.  
Classifier Training and Evaluation: First, the classifier is trained using only the original training data, without any TDCGAN-generated samples, and its performance is evaluated on the testing data. Then, the classifier is then trained using the original training data augmented with TDCGAN-generated samples, and its performance is again evaluated on the same testing dataset.  
Performance Comparison: The performance metrics (accuracy, precision, recall, and F1-score) from both scenarios--training without and with TDCGAN-generated samples--are compared. This comparison assesses the impact of TDCGAN-generated data augmentation on the classification performance for each dataset.  
Final Evaluation: The final step involves comparing the evaluation metrics across all classifiers and datasets. This comparison allows us to identify the best-performing classifier and evaluate the overall effectiveness of the TDCGAN model in enhancing classification performance.  
The pseudo code for the overall proposed approach is offered in Figure 2.  
Figure 2: The pseudo code of the proposed appraoch.  
The selection of the data sample and the data preparation process are described in Section 3.1. The feature selection for each dataset and the details about the experiment's setup are elaborated in the following sections, respectively.