Exploring the relationship between performance metrics and cost saving potential of defect prediction models

Steffen Tunkel, Steffen Herbold

Introduction

Software defect prediction (SDP) models are designed to identify error-prone components, allowing teams to allocate quality assurance (QA) resources more effectively. However, a significant gap exists between academic performance metrics and industrial business value. This study, published in Empirical Software Engineering, investigates whether standard metrics like F-measure and Area Under the Curve (AUC) actually correlate with cost-saving potential.

The Problem: Metrics vs. Money

For decades, researchers have evaluated SDP models using precision, recall, and F-measure. These metrics assume that every file or "instance" in a dataset is of equal importance. In reality, software systems are dominated by a few "super instances"—massive files that account for a disproportionate amount of QA effort and defect risk.

If a model performs well on small files but misses defects in these large components, its economic value is negligible, regardless of its F-measure. This paper asks a fundamental question: Is there any stable relationship between these standard metrics and the actual cost-saving potential of a model?

Methodology

The authors conducted an extensive empirical analysis using 398 releases from 38 Apache Java projects. The study utilized a comprehensive dataset from Herbold et al. (2022), which includes detailed mapping of bugs to specific files—essential for calculating the actual cost of "missing" a bug in a specific artifact.

The study followed a three-phase execution plan:

  1. Metric Modeling: 20 performance metrics (including MCC and G-measure) and 10 confounding variables were analyzed as predictors.
  2. Cost Modeling: Cost-saving potential was defined based on the difference between the effort required for QA and the costs incurred by missed defects. Savings were categorized into four ordinal bins: none, medium, large, and extra large.
  3. Statistical Analysis: Multinomial logit models, decision trees, and random forests were used to capture both linear and complex non-linear relationships between metrics and cost outcomes.

Key Insights and Results

The "Super Instance" Effect

Software file sizes (Lines of Code) follow an exponential distribution. A tiny fraction of files are massive. Because standard metrics treat every file as an equal data point, they fail to account for the fact that these "super instances" are the primary drivers of cost. A model that misses one large, mission-critical file while catching ten tiny ones might look good on paper but results in an economic disaster.

The Generalization Trap

While the researchers could train a Random Forest to "predict" cost savings based on performance metrics within a specific experiment, these models failed completely when applied to new projects (cross-project and cross-version scenarios). This suggests that any observed correlation between a metric like Recall and Cost-Savings is often a result of overfitting to a specific dataset's structure rather than a universal law.

Defect Prediction as a Coin Flip

In realistic settings, the chance of a defect prediction model being cost-saving at all is roughly 46% (median). Even "good" models from prior benchmarks often failed to provide economic benefits in more than a third of the cases studied.

Conclusion and Recommendations

The study concludes that there is no stable, generalizable relationship between performance metrics and cost savings. A model with a high MCC or AUC in one context might save money, while a similar model in another context might lose money.

To ensure industrial relevance, the authors argue that researchers must include cost-related metrics in their evaluations. Claims about economic benefits cannot be extrapolated from traditional performance metrics. When cost data is unavailable, the authors recommend using the Matthews Correlation Coefficient (MCC), as it is a more robust statistical alternative to the F-measure, which was found to be particularly unreliable in the presence of class imbalance.

Summary updated

BibTeX
@article{tunkel2022exploring,
  author = {Steffen Tunkel and Steffen Herbold},
  title = {{Exploring the relationship between performance metrics and cost saving potential of defect prediction models}},
  journal = {Empir. Softw. eng},
  year = {2022},
  doi = {10.1007/s10664-022-10224-4},
}
Figure