The Accuracy Paradox in Software Defect Prediction: A Comparative Empirical Evaluation of Random Forest and Multinomial Naive Bayes on the Defectors Just-In-Time Dataset

Authors

Popoola T

Department of Computer Science, Lead City University, Ibadan (Ibadan)

John-Dewole A.T

Department of Computer Science, Lead City University, Ibadan (Ibadan)

Oyekunle V.B.

Department of Computer Science, Lead City University, Ibadan (Ibadan)

Waheed A.A

Department of Computer and Mathematics, Lead City University, Ibadan (Ibadan)

Article Information

DOI: 10.51244/IJRSI.2026.1310000185

Subject Category: Software Engineering

Volume/Issue: 13/10 | Page No: 4800-4821

Publication Timeline

Submitted: 2026-10-21

Accepted: 2026-10-26

Published: 2026-11-12

Abstract

Global accuracy is widely used to evaluate software defect predictors, but its value depends on the class distribution of the evaluation data. This study examines how that dependence affects model assessment on the Defectors Just-In-Time dataset, whose training split is near-balanced (1.23:1) while its time-wise test split keeps the natural 7:1 clean-to-defective ratio. Random Forest and Multinomial Naive Bayes classifiers with TF-IDF features were trained on 185,369 file-level change instances and evaluated on 10,000 later instances. Random Forest reached 63.52% accuracy but recovered only 47.75% of defective changes; Naive Bayes recovered 59.07% at 48.48% accuracy, while a classifier flagging nothing would score 87.54%. Balanced accuracy (56.76%, 53.02%) and MCC (0.093, 0.040) were close to chance, and Precision-Recall AUC (0.172, 0.142) was only modestly above the 0.125 no-skill level. Paired McNemar tests showed significant differences in recall and specificity between the classifiers (p < 0.0001). Recomputing metrics at the training prevalence showed that precision falls by 34 to 37 points from prevalence alone and that F1-score reverses the classifiers’ ranking, whereas recall, specificity, and balanced accuracy do not change. A validation split with the test split’s prevalence showed higher recall, consistent with temporal drift, and tuning on that split did not improve test balanced accuracy. A cost-ratio analysis that treats the impact cost as a parameter showed that each classifier is cheaper than reviewing nothing or everything only within a narrow range of relative costs.

Keywords

Accuracy Paradox, Class Imbalance, Prevalence Shift, Just-In-Time (JIT) Defect Prediction

Downloads

References

1. E. De Bono, Six Thinking Hats: An Essential Approach to Business Management, Little, Brown and Company, 1985. [Google Scholar] [Crossref]

2. D. Chappell, "The Three Aspects of Software Quality: Functional, Structural and Process," Microsoft White Paper Series, 2012. http://www.davidchappell.com/writing/white_papers/The_Three_Aspects_of_Software_Quality_v1.0-Chappell.pdf [Google Scholar] [Crossref]

3. G. Giray, "A Software Engineering Perspective on Engineering Machine Learning Systems: State of the Art and Challenges," Journal of Systems and Software, vol. 180, p. 111031, 2021. DOI: 10.1016/j.jss.2021.111031 [Google Scholar] [Crossref]

4. S. K. Pandey and A. K. Tripathi, "An Empirical Study Toward Dealing with Noise and Class Imbalance Issues in Software Defect Prediction," Soft Computing, vol. 25, no. 21, pp. 13465–13492, 2021. DOI: 10.1007/s00500-021-06096-3. [Google Scholar] [Crossref]

5. S. Pandey and K. Kumar, "Software Fault Prediction for Imbalanced Data: A Survey on Recent Developments," Procedia Computer Science, vol. 218, pp. 1815–1824, 2022. DOI: 10.1016/j.procs.2023.01.159. [Google Scholar] [Crossref]

6. N. V. Chawla, K. W. Bowyer, L. O. Hall, and W. P. Kegelmeyer, "SMOTE: Synthetic Minority Over-sampling Technique," Journal of Artificial Intelligence Research, vol. 16, pp. 321–357, 2002. DOI: 10.1613/jair.953. [Google Scholar] [Crossref]

7. R. Malhotra and J. Jain, "Predicting Defects in Imbalanced Data Using Resampling Methods: An Empirical Investigation," PeerJ Computer Science, vol. 8, e573, 2022. DOI: 10.7717/peerj-cs.573. [Google Scholar] [Crossref]

8. T. M. Khoshgoftaar and E. B. Allen, "Logistic Regression Modeling of Software Quality," International Journal of Reliability, Quality and Safety Engineering, vol. 6, no. 4, pp. 303–317, 1999. DOI: 10.1142/S0218539399000292. [Google Scholar] [Crossref]

9. B. Freimut, S. Hartkopf, P. Kaiser, J. Kontio, and W. Kobitzsch, "An Industrial Case Study of Implementing Software Risk Management," in Proc. ESEC/FSE-9, 2001, pp. 277–287. DOI: 10.1145/503271.503247. [Google Scholar] [Crossref]

10. J. Kontio, "The Riskit Method for Software Risk Management, Version 1.00," Univ. of Maryland, Technical Report CS-TR-3782/UMIACS-TR-97-38, 1997. [Google Scholar] [Crossref]

11. S. Singh, G. Madaan, A. Singh, K. Sood, S. Grima, and R. Rupeika-Apoga, "The AGP Model for Risk Management in Agile I.T. Projects," Journal of Risk and Financial Management, vol. 16, no. 2, article 129, 2023. DOI: 10.3390/jrfm16020129. [Google Scholar] [Crossref]

12. S. Goyal, "Handling Class-Imbalance with KNN (Neighbourhood) Under-Sampling for Software Defect Prediction," Artificial Intelligence Review, vol. 55, no. 3, pp. 2023–2064, 2022. DOI: 10.1007/s10462-021-10044-w. [Google Scholar] [Crossref]

13. Y. Zhao, K. Damevski, and H. Chen, "A Systematic Survey of Just-in-Time Software Defect Prediction," ACM Computing Surveys, vol. 55, no. 10, article 201, 2023. DOI: 10.1145/3567550. [Google Scholar] [Crossref]

14. T. Hoang, H. K. Dam, Y. Kamei, D. Lo, and N. Ubayashi, "DeepJIT: An End-to-End Deep Learning Framework for Just-In-Time Defect Prediction," in Proc. MSR, 2019, pp. 34–45. doi: 10.1109/MSR.2019.00016. [Google Scholar] [Crossref]

15. Y. Zhao and H. Chen, "Deep Incremental Learning of Imbalanced Data for Just-in-Time Software Defect Prediction," arXiv:2310.12289, 2023. DOI: 10.48550/arXiv.2310.12289. [Google Scholar] [Crossref]

16. A. M. Ismail, S. H. Ab Hamid, A. Abdul Sani, and N. N. Mohd Daud, "KCO: Balancing Class Distribution in Just-in-Time Software Defect Prediction Using Kernel Crossover Oversampling," PLOS ONE, vol. 19, no. 4, e0299585, 2024. DOI: 10.1371/journal.pone.0299585. [Google Scholar] [Crossref]

17. G. Giray, K. E. Bennin, Ö. Köksal, Ö. Babur, and B. Tekinerdogan, "On the Use of Deep Learning in Software Defect Prediction," Journal of Systems and Software, vol. 195, p. 111537, 2023. DOI: 10.1016/j.jss.2022.111537. [Google Scholar] [Crossref]

18. M. Shepperd, Q. Song, Z. Sun, and C. Mair, "Data Quality: Some Comments on the NASA Software Defect Datasets," IEEE Transactions on Software Engineering, vol. 39, no. 9, pp. 1208–1215, 2013. DOI: 10.1109/TSE.2013.11. [Google Scholar] [Crossref]

19. P. Mahbub, O. Shuvo, and M. M. Rahman, "Defectors: A Large Scale Python Dataset for Defect Prediction," Zenodo, 2023. DOI: 10.5281/zenodo.7708984. [Google Scholar] [Crossref]

20. Y. Kamei, E. Shihab, B. Adams, A. E. Hassan, A. Mockus, A. Sinha, and N. Ubayashi, "A Large-Scale Empirical Study of Just-in-Time Quality Assurance," IEEE Transactions on Software Engineering, vol. 39, no. 6, pp. 757–773, 2013. DOI: 10.1109/TSE.2012.70. [Google Scholar] [Crossref]

21. G. Salton and C. Buckley, "Term-Weighting Approaches in Automatic Text Retrieval," Information Processing & Management, vol. 24, no. 5, pp. 513–523, 1988. DOI: 10.1016/0306-4573(88)90021-0. [Google Scholar] [Crossref]

22. A. McCallum and K. Nigam, "A Comparison of Event Models for Naive Bayes Text Classification," in AAAI-98 Workshop on Learning for Text Categorization, 1998, pp. 41–48. [Google Scholar] [Crossref]

23. L. Breiman, "Random Forests," Machine Learning, vol. 45, no. 1, pp. 5–32, 2001. DOI: 10.1023/A:1010933404324. [Google Scholar] [Crossref]

24. W. Ajayi, Y. A. Adekunle, O. Awodele, A. O. Akinsanya, M. O. Eze, and Seun Ebiesuwa, "Software Development Top Models, Risks Control and Effect on Product Quality," Global Journal of Computer Science and Technology: C, vol. 17, no. 3, pp. 35–46, 2017. https://computerresearch.org/index.php/computer/article/view/1614 [Google Scholar] [Crossref]

25. J. Davis and M. Goadrich, "The Relationship Between Precision-Recall and ROC Curves," in Proc. ICML, 2006, pp. 233–240. DOI: 10.1145/1143844.114 [Google Scholar] [Crossref]

26. K. H. Brodersen, C. S. Ong, K. E. Stephan, and J. M. Buhmann, “The Balanced Accuracy and Its Posterior Distribution,” in Proc. 20th Int. Conf. Pattern Recognition (ICPR), 2010, pp. 3121–3124. DOI: 10.1109/ICPR.2010.764. [Google Scholar] [Crossref]

27. B. W. Matthews, “Comparison of the Predicted and Observed Secondary Structure of T4 Phage Lysozyme,” Biochimica et Biophysica Acta (BBA) – Protein Structure, vol. 405, no. 2, pp. 442–451, 1975. DOI: 10.1016/0005-2795(75)90109-9. [Google Scholar] [Crossref]

28. J. Yao and M. Shepperd, “Assessing Software Defection Prediction Performance: Why Using the Matthews Correlation Coefficient Matters,” in Proc. 24th Int. Conf. Evaluation and Assessment in Software Engineering (EASE), 2020, pp. 120–129. DOI: 10.1145/3383219.3383232. [Google Scholar] [Crossref]

29. D. Chicco, N. Tötsch, and G. Jurman, “The Matthews Correlation Coefficient (MCC) Is More Reliable Than Balanced Accuracy, Bookmaker Informedness, and Markedness in Two-Class Confusion Matrix Evaluation,” BioData Mining, vol. 14, article 13, 2021. DOI: 10.1186/s13040-021-00244-z. [Google Scholar] [Crossref]

30. E. B. Wilson, "Probable Inference, the Law of Succession, and Statistical Inference," Journal of the American Statistical Association, vol. 22, no. 158, pp. 209–212, 1927. DOI: 10.1080/01621459.1927.10502953. [Google Scholar] [Crossref]

31. Q. McNemar, "Note on the Sampling Error of the Difference Between Correlated Proportions or Percentages," Psychometrika, vol. 12, no. 2, pp. 153–157, 1947. DOI: 10.1007/BF02295996. [Google Scholar] [Crossref]

32. M. Saerens, P. Latinne, and C. Decaestecker, “Adjusting the Outputs of a Classifier to New a Priori Probabilities: A Simple Procedure,” Neural Computation, vol. 14, no. 1, pp. 21–41, 2002. DOI: 10.1162/089976602753284446. [Google Scholar] [Crossref]

33. J. G. Moreno-Torres, T. Raeder, R. Alaiz-Rodríguez, N. V. Chawla, and F. Herrera, “A Unifying View on Dataset Shift in Classification,” Pattern Recognition, vol. 45, no. 1, pp. 521–530, 2012. DOI: 10.1016/j.patcog.2011.06.019. [Google Scholar] [Crossref]

34. C. Pan, M. Lu, and B. Xu, "An Empirical Study on Software Defect Prediction Using CodeBERT Model," Applied Sciences, vol. 11, no. 11, article 4793, 2021. DOI: 10.3390/app11114793. [Google Scholar] [Crossref]

35. C. Elkan, "The Foundations of Cost-Sensitive Learning," in Proc. IJCAI, 2001, pp. 973–978. [Google Scholar] [Crossref]

Metrics

Views & Downloads

Similar Articles