Employing Partial Least Squares Regression with Discriminant Analysis for Bug Prediction
Rudolf Ferenc, István Siket, Péter Hegedűs, Róbert Rajkó
TL;DR
This paper introduces Partial Least Squares Discriminant Analysis (PLS-DA) as a novel, fast, and interpretable approach for predicting bug-prone Java Classes using static source-code metrics. Trained and evaluated on the Public Unified Bug Dataset for Java, the method achieves a robust F-measure around $0.44$–$0.47$ at a $0.90$ confidence level without resampling and demonstrates strong completeness, identifying $69.3 ext{–}79.4 ext{%}$ of total bugs depending on resampling, while remaining significantly faster to train than many baselines. The work includes thorough statistical validation via bootstrap and permutation testing, a MAD-based normalization to harmonize diverse metrics, and an open-source Data4PLSDA release, underscoring open science. Overall, PLS-DA offers competitive predictive performance, strong explainability, and practical portability, making it a valuable tool for defect prediction, especially in contexts where rapid parameter tuning and interpretability are important.
Abstract
Forecasting defect proneness of source code has long been a major research concern. Having an estimation of those parts of a software system that most likely contain bugs may help focus testing efforts, reduce costs, and improve product quality. Many prediction models and approaches have been introduced during the past decades that try to forecast bugged code elements based on static source code metrics, change and history metrics, or both. However, there is still no universal best solution to this problem, as most suitable features and models vary from dataset to dataset and depend on the context in which we use them. Therefore, novel approaches and further studies on this topic are highly necessary. In this paper, we employ a chemometric approach - Partial Least Squares with Discriminant Analysis (PLS-DA) - for predicting bug prone Classes in Java programs using static source code metrics. To our best knowledge, PLS-DA has never been used before as a statistical approach in the software maintenance domain for predicting software errors. In addition, we have used rigorous statistical treatments including bootstrap resampling and randomization (permutation) test, and evaluation for representing the software engineering results. We show that our PLS-DA based prediction model achieves superior performances compared to the state-of-the-art approaches (i.e. F-measure of 0.44-0.47 at 90% confidence level) when no data re-sampling applied and comparable to others when applying up-sampling on the largest open bug dataset, while training the model is significantly faster, thus finding optimal parameters is much easier. In terms of completeness, which measures the amount of bugs contained in the Java Classes predicted to be defective, PLS-DA outperforms every other algorithm: it found 69.3% and 79.4% of the total bugs with no re-sampling and up-sampling, respectively.
