Abstract
Cross-Project Defect Prediction (CPDP) is a vital technique for software quality assurance in projects with limited historical data. However, the performance of CPDP pipelines—comprising transfer learning and classification stages—is often hindered by sub-optimal parameter settings. This empirical study, originally presented at ICSE 2020, investigates the impact of automated hyperparameter optimization (HPO) using the Tree-of-Parzen-Estimators (TPE) algorithm. By evaluating 62 CPDP techniques across 20 real-world datasets, the study reveals that HPO significantly improves performance in 77% of cases. Most importantly, the research identifies the transfer learning stage as the critical bottleneck, suggesting that tuning transfer parameters yields higher performance gains than tuning the classifier.
Introduction
Software defects represent a significant financial burden on the industry. Machine learning models offer a proactive solution by predicting defect-prone code modules, but these models typically require extensive local historical data for training. For new projects or smaller organizations, this data is often unavailable. Cross-Project Defect Prediction (CPDP) addresses this by leveraging knowledge from mature "source" projects to predict defects in a "target" project.
A standard CPDP pipeline involves two distinct stages:
- Transfer Learning: Transforming source and target data into a shared distribution to minimize domain discrepancy.
- Classification: Training a model on the transformed data to predict defects.
Despite the complexity of these stages, researchers frequently rely on default parameter settings. This study explores the performance potential left "on the table" and identifies which components of the pipeline benefit most from automated tuning.
Methodology
The researchers employed Hyperopt, an automated optimization toolkit, utilizing the Tree-of-Parzen-Estimators (TPE) algorithm to navigate the parameter search space. The optimization workflow, illustrated in Figure 1, integrates the raw dataset into a pipeline where transfer learning and defect prediction models are iteratively refined based on prediction performance.
To determine the most effective optimization approach, the study compared four distinct strategies:
- Type-I (Simultaneous): Optimizing both transfer and classification parameters at once.
- Type-II-1 (Transfer-only): Optimizing only transfer learning parameters while keeping the classifier at default settings.
- Type-II-2 (Classifier-only): Optimizing only classification parameters while keeping the transfer method at default settings.
- Type-III (Sequential): Tuning the transfer stage first, followed by the classifier.
Search Space and Parameters
The study considered a wide array of parameters for both stages. For instance, in the transfer learning stage, algorithms like TCA (Transfer Component Analysis) involve tuning the kernel type, output dimension, and lambda values. Other methods like Bruakfilter or DSBF require optimizing the number of neighbors (k).
Experimental Setup
The evaluation spanned 20 real-world open-source projects (totaling 10,952 instances) from the AEEEM, ReLink, and JURECZKO corpora. The authors curated the data to ensure high quality, excluding datasets with known noise or small sample sizes. In total, 62 CPDP techniques were tested, including 13 established methods and 49 novel combinations of transfer and classification algorithms.
Key Insights
1. Transfer Learning is the Determinant Factor
The study's most significant finding is that the transfer learning stage is the primary driver of CPDP success. Tuning the "knobs" of the transfer algorithm (e.g., the number of neighbors in filtering methods or the kernel bandwidth in TCA) consistently yielded higher performance gains than tuning the classifier.
2. The Search Space Challenge
While simultaneous optimization (Type-I) theoretically covers the entire search space, it often underperformed in practice. With a fixed budget of 1,000 evaluations, the optimizer struggled to find the global maximum within the massive combined search space of both stages. This highlights the importance of strategic optimization when computational resources are limited.
3. Limitations of Default Settings
The results demonstrate that "off-the-shelf" parameters are rarely optimal. Performance is highly sensitive to the specific characteristics of the source and target datasets, making automated tuning essential for practical CPDP deployment.
Key Results
- Performance Boost: 77% of the studied techniques experienced "huge" improvements in AUC (Area Under the Curve) following optimization, as measured by Cohen’s d effect size.
- Optimal Strategy: Type-II-1 (optimizing only transfer learning) emerged as the most cost-effective strategy, achieving top performance in 37.7% of the experimental runs.
- Superior Combinations: Newly created algorithm pairings often outperformed established State-of-the-Art (SOTA) models. Specifically, the combination of Dynamic Transfer Boosting (DTB) with a Random Forest (RF) classifier (DTB-RF) proved to be exceptionally robust.
Conclusion and Future Work
Automated parameter optimization is a transformative tool for CPDP, turning previously mediocre techniques into high performers. For practitioners, the clear takeaway is to prioritize the tuning of transfer learning parameters.
Future research should move toward "Portfolio Optimization," where tools not only tune parameters but also automatically select the optimal pair of transfer and classification algorithms for a given dataset. This would further reduce the manual effort required to build effective defect prediction models for new software projects.
Summary updated