Abstract
Software defect prediction ranks modules according to the fault risks faced by the module, to ensure limited time is spent in the maximum risk parts of the software. This paper conducts a comparison of the performance of nine machine learning classifiers (logistic regression, naive Bayes, k-NN, SVM, decision tree, random forest, histogram gradient boosting, XGBoost and a multilayer perceptron), which are trained with static code metrics for the prediction of defective modules. Experiments are conducted on 8 de-duplicated NASA MDP data sets, using each with 2 sets of 5-fold cross-validation (with and without SMOTE to train the folds only), and report accuracy, precision, recall, F1, AUC and MCC (1,440 model fits). Logistic regression, XGBoost and random forest have the highest mean AUC (0.790, 0.786 and 0.784) and are not significantly different under a Friedman-Nemenyi analysis, and are also not particularly high in terms of recall (not over 0.6 for the most part). After applying SMOTE to the data, each of the models improves recall by 0.311, F1 by 0.140, MCC by 0.084 and reduces precision by 0.058 and accuracy for each model, and afterwards, XGBoost achieves highest AUC at 0.793, highest MCC at 0.330 while lowering accuracy at 0.942. The sizes and Halstead measures are found to contain the majority of the signal using random-forest importance. According to the results, there is no single best classifier for every dataset, and certain evaluation metrics should be used with different resampling. Choice of an evaluation metric should be based on the relative cost of missed defects and false alarms, and resampling should be done accordingly.