Skip to content
Open access

X‐GNN for Interpretable Class‐Level Software Defect Prediction: An Empirical Study on Defects4J

Oct 2026 · Journal of Software: Evolution and Process · 0 citations · 21 references

Abstract

Software defect prediction supports targeted quality assurance by identifying modules that warrant early testing and maintenance attention. This study presents an Explainable Graph Neural Network (X‐GNN) framework for class‐level defect prediction, in which software versions are modeled as directed dependency graphs. Each class is represented by a hybrid feature vector combining code metrics with graph‐derived structural metrics. A Graph Convolutional Network (GCN) propagates information through class dependencies, while an attention mechanism assigns nonuniform importance to neighboring classes. SHapley Additive exPlanations (SHAP) are applied only after model training to interpret the resulting predictions. The empirical study is deliberately bounded to Defects4J v3.0.1, which contains 854 active reproducible defects across 17 Java projects. Under the adopted within‐project stratified train/validation/test protocol, X‐GNN achieved an accuracy of 0.85, F1‐score of 0.83, precision of 0.82, recall of 0.84, and ROC‐AUC of 0.88, outperforming random forest (RF), logistic regression (LR), and standard GCN. On the closure project, X‐GNN attained a ROC‐AUC of 0.94, compared with 0.90 for standard GCN and 0.87 for RF. SHAP‐based evaluation on the Lang project yielded a fidelity of 0.94, coverage of 0.91, and node importance agreement (NIA) of 0.87. The project‐level F1‐score comparison between X‐GNN and Standard sCN produced p  = 0.003 with Cohen's d  = 0.75. The results provide benchmark‐specific evidence that attention‐enhanced graph learning improves class‐level defect prediction, while post hoc attribution provides model‐centric interpretive information. The empirical claims are restricted to Defects4J and do not imply cross‐benchmark generalization or cross‐method explanation agreement.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.