Abstract
In this paper, we discuss a proposed precision formula for imbalanced class distributions that provides a true reflection of a defect predictor's performance. Our formula, Precision(AR), yields values closer to overall accuracy for both balanced and imbalanced distributions, ensuring consistent high values for high-performing predictors regardless of target class rarity.
Introduction
In domains such as software defect prediction, the target class (defective modules) is frequently rare, often comprising less than 1% of the total dataset. This extreme class imbalance poses a significant challenge for standard performance metrics. Specifically, the standard precision metric—defined as $TP / (TP + FP)$—often yields misleadingly low scores even for high-performing classifiers. This occurs because a low False Positive Rate (FPR) can still result in a large absolute number of False Positives when the majority class is vast, dragging down the precision score and masking the model's actual effectiveness. This paper proposes an adjusted metric to rectify this bias.
Methodology: The Precision(AR) Formula
To address this mathematical trap, we introduce an adjusted precision formula, Precision(AR). This approach stabilizes the metric by incorporating the True Positive Rate (TPR) and False Positive Rate (FPR) as exponents. The standard components of these rates are derived from the confusion matrix:
The proposed formula is defined as:
$$Precision(AR) = \left( \frac{TP^{(TPR)}}{TP^{(TPR)} + FP^{(FPR)}} \right) \times 100\%$$
By using rates as exponents, the formula "suppresses" the overwhelming influence of the majority class, making the metric less sensitive to the specific class ratio and more sensitive to the classifier's inherent ability to distinguish between classes. The authors also derived adjusted versions of Recall and the F-Measure based on this same logic to ensure consistency across the performance suite.
Experimental Evaluation
The study evaluates the proposed formula using 13 datasets from the NASA Metrics Data Program (including PC2, MC1, and PC5). These datasets feature varying degrees of class imbalance, with the minority class ranging from as low as 0.4% (PC2) to nearly balanced at 48.8% (KC4). Total data points across these sets range from 125 to over 17,000 instances.
Results and Discussion
Our analysis demonstrates that Precision(AR) consistently provides a more accurate reflection of model performance compared to the original precision metric. Across all 13 NASA datasets, the adjusted precision values remain high and stable, aligning more closely with overall accuracy scores.
For example, in the PC2 dataset (0.4% defects), a classifier with a 1% FPR resulted in an original precision of only 29.1%. In contrast, Precision(AR) yielded 95.7%. Even when the classifier's noise increased (5% FPR), Precision(AR) remained robust at 94.5%, while the original precision plummeted to a dismal 7.6%. This stability suggests that Precision(AR) provides a truer reflection of a classifier that successfully identifies rare defects with minimal errors on non-defects.
Conclusion
The Precision(AR) formula offers a robust alternative for evaluating classifiers on imbalanced datasets. By aligning more closely with accuracy and providing consistent values for effective predictors, it prevents researchers from underestimating the value of high-performing models in critical domains like software engineering, medical diagnosis, or fraud detection.
Summary updated