Skip to content
Open access

Applying Cost-Sensitive Learning to Mitigate the Effect of Class Imbalance for Deep Learning-based Fault Localization

Aug 2026 · International journal of software engineering and knowledge engineering · 0 citations

Abstract

Automated software fault localization has become a research focus with the growing software scale. Deep learning-based fault localization (DLFL) has been widely studied due to its excellent performance. Most existing DLFL methods use the execution traces of the test cases as features. However, the number of passing test cases is far more than that of failed test cases in the practical test suite. The severe class imbalance problem is ignored in existing DLFL methods. To alleviate the impact of the class imbalance on DLFL, we propose applying cost-sensitive learning to set different weights for each sample to optimize the performance of fault localization. We reduce the number of passing test cases and compute the weight for each sample. The sample weight is combined with a loss function to optimize the accuracy of the DLFL method. To evaluate our approach, we conduct within-project and cross-project fault localization experiments on the Defects4J benchmark. Experimental results show our approach outperforms the traditional DLFL and existing data augmentation methods in fault localization (e.g., localizing 133 faults within Top-5). The experimental results show that applying cost-sensitive learning can effectively alleviate the class imbalance problem in DLFL.

Read PDF