Open Access iconOpen Access



Software Defect Prediction Method Based on Stable Learning

Xin Fan1,2,3, Jingen Mao2,3,*, Liangjue Lian2,3, Li Yu1, Wei Zheng2,3, Yun Ge2,3

1 College of Aerospace Engineering, Nanjing University of Aeronautics and Astronautics, Nanjing, 210012, China
2 School of Software, Nanchang Hangkong University, Nanchang, 330029, China
3 Software Testing and Evaluation Center, Nanchang Hangkong University, Nanchang, 330029, China

* Corresponding Author: Jingen Mao. Email: email

Computers, Materials & Continua 2024, 78(1), 65-84.


The purpose of software defect prediction is to identify defect-prone code modules to assist software quality assurance teams with the appropriate allocation of resources and labor. In previous software defect prediction studies, transfer learning was effective in solving the problem of inconsistent project data distribution. However, target projects often lack sufficient data, which affects the performance of the transfer learning model. In addition, the presence of uncorrelated features between projects can decrease the prediction accuracy of the transfer learning model. To address these problems, this article propose a software defect prediction method based on stable learning (SDP-SL) that combines code visualization techniques and residual networks. This method first transforms code files into code images using code visualization techniques and then constructs a defect prediction model based on these code images. During the model training process, target project data are not required as prior knowledge. Following the principles of stable learning, this paper dynamically adjusted the weights of source project samples to eliminate dependencies between features, thereby capturing the “invariance mechanism” within the data. This approach explores the genuine relationship between code defect features and labels, thereby enhancing defect prediction performance. To evaluate the performance of SDP-SL, this article conducted comparative experiments on 10 open-source projects in the PROMISE dataset. The experimental results demonstrated that in terms of the F-measure, the proposed SDP-SL method outperformed other within-project defect prediction methods by 2.11%–44.03%. In cross-project defect prediction, the SDP-SL method provided an improvement of 5.89%–25.46% in prediction performance compared to other cross-project defect prediction methods. Therefore, SDP-SL can effectively enhance within- and cross-project defect predictions.


Cite This Article

X. Fan, J. Mao, L. Lian, L. Yu, W. Zheng et al., "Software defect prediction method based on stable learning," Computers, Materials & Continua, vol. 78, no.1, pp. 65–84, 2024.

cc This work is licensed under a Creative Commons Attribution 4.0 International License , which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
  • 428


  • 147


  • 0


Share Link