Answers are grounded in this paper and cite their sources.
Software defect prediction (SDP) aims to identify potentially defective modules early in the development phase, thereby enhancing testing and improving the overall quality of software. Deep learning has advanced SDP by improving accuracy. However, its lack of interpretability remains a critical limitation. Although some existing methods offer explanations for SDP models, they typically focus on assigning feature importance within model decisions. However, these explanations often remain superficial, failing to clarify the specific roles that features play in the decision-making process. To address these challenges, this article presents counterfactual contrastive explanations for SDP (CCE-SDP), a novel framework that generates counterfactual contrastive explanations to enhance model transparency. Leveraging genetic algorithms, CCE-SDP constructs optimal counterfactual examples to reveal how specific changes in software metrics influence predictions, offering fine-grained, instance-level insights. The core of the CCE-SDP method is to offer counterfactual explanations that minimize the number of altered features while maximizing the counterfactual trust score. In addition, by incorporating synthetic counterfactual samples with defect labels into the training process, the ability to handle imbalanced data is also enhanced. Experiments on 36 benchmark software projects showed that the CCE-SDP model demonstrated to users how specific feature changes impact predictive outcomes, thereby allowing for a better understanding of the model’s decision-making. Furthermore, by embedding counterfactual analysis within the model training, we successfully boosted the predictive performance of the SDP models.
No takes yet. Share an insight, caveat, or question.
Zou et al. (2025) studied this question.
Synapse has enriched 10 related papers. Consider them for comparative context: