Software Engineering
New Two-Stage Approach Improves Defect Prediction Across Software Projects
Researchers propose a dynamic classifier selection framework that adapts to individual code modules, outperforming traditional cross-project defect prediction methods.
Predicting software defects by training models on external projects remains a persistent challenge in software engineering, largely because code patterns and quality issues vary significantly between different projects. A new research paper from arXiv introduces a framework designed to overcome this distribution shift problem through intelligent classifier selection.
The Core Problem#
Cross-project defect prediction (CPDP) allows teams to leverage historical bug data from other projects to forecast defects in new codebases. However, the inherent differences in architecture, coding standards, and development practices across projects—what researchers call distribution shift—consistently undermines model accuracy. Existing approaches typically train a single set of models and apply them uniformly across an entire target project, which fails to account for variations in code complexity and structure within that project.
A Two-Stage Selection Solution#
The proposed framework tackles this challenge through a two-stage multiple classifier system (MCS) that makes decisions at both the project and module levels. During the first stage, the system evaluates various MCS configurations to identify one that generalizes well across multiple training projects while maintaining diversity among individual classifiers. Each classifier becomes specialized in recognizing defects in modules with particular characteristics.
The second stage operates during testing, where the system dynamically selects which classifiers are best suited for each individual code module in the target project—rather than applying the same classifiers to every module. This module-dependent selection enables the framework to adapt to local variations in code patterns and design.
Validation and Results#
The research team evaluated their approach using 82 projects across four different CPDP benchmark datasets. According to their findings, the dynamic selection framework outperformed existing state-of-the-art CPDP methods in most test scenarios. The implementation and supporting materials have been made publicly available for further study and replication.
This work suggests that treating cross-project defect prediction as a problem requiring tailored, module-specific solutions—rather than one-size-fits-all approaches—can yield significant improvements in prediction accuracy.