Software Defect Prediction Using Machine Learning: A Comparative Analysis Of Classification Algorithms

21 Aug

Authors: Arjun Singh Tomar, Aashish Kumar Tiwari

Abstract: Identifying defect-prone modules before release is a central concern in software quality assurance, and machine-learning classifiers built on static code metrics have become a common way to prioritise testing effort. This paper presents a controlled comparison of six classification algorithms — Naive Bayes, Decision Tree, k-Nearest Neighbours, Logistic Regression, Support Vector Machine, and Random Forest — for software defect prediction on four datasets from the NASA/PROMISE repository (CM1, KC1, JM1, PC1). All models are trained and evaluated under an identical pipeline, including median imputation, feature standardisation, SMOTE-based resampling of the training folds, and stratified 10-fold cross-validation, and are compared using accuracy, precision, recall, F1-score, and ROC-AUC. Random Forest achieved the strongest overall performance (86.7% accuracy, 81.2% F1-score), followed by Support Vector Machine, while Naive Bayes and k-Nearest Neighbours lagged behind, particularly on precision. The results indicate that ensemble tree methods provide a robust default choice for defect prediction from static metrics, and that resampling strategy meaningfully narrows the performance gap between algorithms.

DOI: http://doi.org/10.5281/zenodo.22040921