[Paper Review] The impact of using biased performance metrics on software defect prediction research
This study investigates the impact of using the biased F1 metric in software defect prediction research by comparing it with the unbiased Matthews correlation coefficient (MCC) across 38 primary studies containing 12,471 pairwise comparisons. It finds that 21.95% of results change direction when using MCC instead of F1, highlighting a significant risk of erroneous conclusions due to metric bias.
Context: Software engineering researchers have undertaken many experiments investigating the potential of software defect prediction algorithms. Unfortunately, some widely used performance metrics are known to be problematic, most notably F1, but nevertheless F1 is widely used. Objective: To investigate the potential impact of using F1 on the validity of this large body of research. Method: We undertook a systematic review to locate relevant experiments and then extract all pairwise comparisons of defect prediction performance using F1 and the un-biased Matthews correlation coefficient (MCC). Results: We found a total of 38 primary studies. These contain 12,471 pairs of results. Of these, 21.95% changed direction when the MCC metric is used instead of the biased F1 metric. Unfortunately, we also found evidence suggesting that F1 remains widely used in software defect prediction research. Conclusions: We reiterate the concerns of statisticians that the F1 is a problematic metric outside of an information retrieval context, since we are concerned about both classes (defect-prone and not defect-prone units). This inappropriate usage has led to a substantial number (more than one fifth) of erroneous (in terms of direction) results. Therefore we urge researchers to (i) use an unbiased metric and (ii) publish detailed results including confusion matrices such that alternative analyses become possible.
Motivation & Objective
- To assess the impact of using the biased F1 metric on the validity of software defect prediction research.
- To identify how frequently F1 is used in defect prediction studies despite known statistical limitations.
- To determine under what conditions F1 is most misleading, particularly in imbalanced datasets.
- To compare F1 results with those from the unbiased Matthews correlation coefficient (MCC) across a large body of empirical studies.
- To advocate for the adoption of unbiased metrics and transparent reporting of confusion matrices in future research.
Proposed method
- Conducted a systematic review to identify primary studies reporting both F1 and MCC scores for software defect prediction experiments.
- Extracted 12,471 pairwise comparisons of model performance from 38 primary studies that reported both F1 and MCC.
- Performed a meta-analysis to assess whether the direction of comparison (e.g., Model A better than Model B) changed when switching from F1 to MCC.
- Analyzed the role of class imbalance in exacerbating F1's bias, using theoretical and empirical analysis of confusion matrix permutations.
- Used statistical and machine learning literature to critique F1’s limitations in two-class classification beyond information retrieval contexts.
- Made raw data and analysis code publicly available via Zenodo (DOI: 10.5281/zenodo.4899090) for reproducibility and further analysis.
Experimental results
Research questions
- RQ1How often does the choice of F1 versus MCC lead to a reversal in the direction of performance comparison in software defect prediction studies?
- RQ2What is the prevalence of F1 usage in recent software defect prediction research despite known statistical issues?
- RQ3In what conditions—particularly class imbalance—is F1 most likely to produce misleading results?
- RQ4To what extent do F1-based conclusions in the literature risk being invalid due to metric bias?
- RQ5What improvements in research transparency and validity can be achieved by replacing F1 with MCC and publishing full confusion matrices?
Key findings
- Of the 12,471 pairwise comparisons analyzed, 21.95% changed direction when switching from F1 to MCC, indicating a substantial risk of erroneous conclusions due to metric bias.
- F1 remains widely used in software defect prediction research, with over a third of studies from 2015–2020 still relying on it despite known statistical flaws.
- The F1 metric is particularly problematic in imbalanced datasets, where it systematically favors models with high precision or recall at the expense of overall balance.
- The Matthews correlation coefficient (MCC) is a more robust and unbiased alternative to F1 for two-class classification tasks in software defect prediction.
- The study demonstrates that F1 can mislead researchers into selecting suboptimal models due to its sensitivity to class distribution and asymmetric handling of false positives and false negatives.
- The authors provide evidence that publishing full confusion matrices enables alternative metric analysis, enhancing reproducibility and validity of defect prediction research.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.