## 6 Results and Discussion
### Comparison between Gan and Traditional Methods  
To compare the performance of GAN-based methods against traditional methods, we used the Scott-Knott ESD statistical test. Figure 2 presents the Scott-Knott rankings of GAN-based methods and traditional methods on each defect dataset based on the MCC values. GAN was first-ranked on 20% of the defect datasets (CM1 and MC2) and second-ranked on 20% of the datasets (MC1 and Lucene). GAN outperformed SMOTE on 50% of the defect datasets, and also outperformed both ROS and RUS on 50% of the defect datasets. Furthermore, it achieved a comparable performance to ROS on 20% of the defect datasets and a comparable performance to RUS on 30% of the defect datasets.  
CWGANGP method was the best-performing model on 50% of the defect datasets and was the second-ranked model on 40% of the defect datasets (CM1, JM1, Tomcat, and Eclipse-2.0). CWGANGP outperformed SMOTE on 50% of the defect datasets and achieved comparable performance to SMOTE on 40% of the defect datasets. In addition, it performed better than ROS on 70% of the defect datasets and had comparable performance to ROS on 20% of the defect datasets. Furthermore, it outperformed RUS on 60% of the defect datasets and attained a comparable performance to RUS on one defect dataset. We observed that the CWGANGP method outperformed all other methods on highly imbalanced datasets (MC1, PC2, and prop-43).  
The CTGAN method was the first-ranked method on 50% of the defect datasets (CM1, JM1, Lucene, MC2, and Tomcat) and the second-ranked method on Eclipse-2.0, PC2 and Zxing datasets. CTGAN outperformed SMOTE on 80% of the defect datasets and performed better than ROS on 70% of the defect datasets while attaining comparable results to ROS on 20% of the defect datasets. Furthermore, CTGAN yielded a better performance than RUS on 70% of the defect datasets and achieved comparable performance to RUS on 30% of the defect datasets.  
Figure 2: Ranking of the GAN-based and traditional methods.  
SMOTE, along with ROS, were the best-performing methods on one defect dataset only (Eclipse-2.0). Moreover, both SMOTE and ROS methods were the second-ranked methods on 50% and 40% of the defect datasets, respectively. RUS was first-ranked on CM1 and JM1 datasets due to the fact that the imbalance ratios of these datasets are small; thus, losing important information is less likely. On the other hand, we observe that RUS was the last ranked model on the highly imbalanced datasets (MC1, PC2, and prop-43) due to the information loss caused by the RUS method.  
The Double Scott-Knott ESD statistical test was used to rank all methods across all defect datasets and provide a summary rank. Figure 3 presents the double Scott-Knott rankings of all methods. Clearly, we can observe that the CWGANGP and CTGAN methods were the best-performing methods. GAN and SMOTE methods achieved comparable performance and were the second-ranked methods. Overall, we can observe the GAN-based method's ability to generate realistic and diverse data samples using the minority class distribution in comparison to other traditional methods. We can summarize the answer to the second research question, \"_RQ2. Will utilizing GAN-based methods yield enhanced defect prediction performance over traditional undersampling and oversampling techniques?_\", as follows:  
**RQ2 answer. Empirical evidence proved the superiority of GAN-based methods in handling defect imbalance problems compared to traditional methods: SMOTE, ROS, and RUS. Among GAN methods, CWGANGP and CTGAN methods outperformed all other methods on most of the defect datasets. In addition, GAN outperformed ROS and RUS on most of the defect datasets and achieved a comparable performance to SMOTE.**