A Cross-project Defect Prediction Model Using Feature Transfer and Ensemble Learning

Fuping Zeng, Wanting Lin, Ying Xing, Lu Sun, Bin YangTehnicki 2022

Abstract

Cross-project defect prediction (CPDP) trains prediction models with existing data from source projects to predict defects in target projects. To address the major challenges of variability in data distribution and class imbalance, this paper proposes a CPDP model combining feature transfer and ensemble learning. The methodology involves two stages: feature transfer based on the Pearson correlation coefficient to reduce feature space dimensionality and distribution differences, and a classification stage utilizing SMOTE and a Voting ensemble. Experimental results across 20 source-target project pairs demonstrate significant improvements in prediction performance.

Introduction

Software Defect Prediction (SDP) is a critical component of quality assurance, enabling development teams to prioritize testing for bug-prone modules. However, new projects often lack the historical data required to train effective local models. Cross-Project Defect Prediction (CPDP) addresses this by leveraging data from mature "source" projects.

Despite its potential, CPDP faces two significant hurdles:

  1. Distribution Variability: Statistical distributions of code features (e.g., complexity, lines of code) often vary drastically between projects.
  2. Class Imbalance: Defective modules are typically a small minority, leading standard models to become biased toward predicting "no defect."

Methodology

The proposed model implements a robust two-stage pipeline designed to mitigate these issues through feature alignment and hybrid ensemble learning.

Stage 1: Feature Transfer via Pearson Correlation

Rather than relying on standard Euclidean distance, which can falter in high-dimensional spaces, the model uses the Pearson correlation coefficient for feature selection. By merging source and target datasets (excluding labels), the system calculates correlations to identify and remove redundant features. This process selects features with lower internal correlation and similar distributions, effectively reducing the "noise" caused by project-specific variations.

Stage 2: Classification via Ensemble Learning

To handle class imbalance and improve stability, the model employs a dual-level strategy:

  • Data Level (SMOTE): The Synthetic Minority Over-sampling Technique (SMOTE) generates synthetic defective samples in the source project to balance the training set.
  • Algorithm Level (Voting): A Voting ensemble integrates four distinct classifiers: J48 (Decision Tree), Random Forest (RF), REPTree, and Naive Bayes (NB). This "wisdom of the crowd" approach reduces individual algorithmic bias.
Figure 1: Flowchart of the proposed CPDP model pipeline, illustrating the transition from source/target datasets through feature transfer to the final voting ensemble.

Experimental Setup

The study utilized the AEEEM dataset, a public benchmark featuring five major open-source projects: Equinox (EQ), Eclipse JDT Core (JDT), Apache Lucene (LC), Mylyn (ML), and Eclipse PDE UI (PDE). Researchers conducted experiments on 20 different source-target pairs to ensure the generalizability of the findings.

Results and Discussion

The proposed model was benchmarked against four classical CPDP methods (TCA, Peters filter, Burak filter, and ALTRA) and individual base classifiers.

Performance Metrics

  • F1-Measure: The proposed method achieved an average F1-measure 35.6% to 44.9% higher than classical baselines.
  • Ensemble Advantage: The Voting method consistently outperformed individual classifiers. As shown in the performance comparison, the ensemble approach provides superior stability and predictive power across F1-measure, MCC, and AUC metrics.
  • Predictive Power: The Area Under Curve (AUC) showed improvements ranging from 13.7% to over 80% compared to baseline methods.
Figure 4: Comparison of the Voting ensemble against individual classifiers (J48, RF, REPTree, NB) across F1-measure, MCC, and AUC.

Key Insights

  • Pearson Correlation Effectiveness: The use of Pearson correlation proved more effective than distance-based metrics for measuring feature relationships in high-dimensional defect data, leading to a more similar feature space between projects.
  • Stability through Diversity: While individual classifiers like Random Forest exhibited performance fluctuations across different project pairs, the Voting ensemble remained consistently high-performing, proving the value of algorithmic diversity.

Conclusion and Future Work

This research demonstrates that combining Pearson-based feature transfer with a SMOTE-Voting ensemble significantly enhances CPDP performance. Future work will focus on expanding the dataset to include closed-source industrial software, fine-tuning hyperparameters beyond default settings, and exploring more complex ensemble architectures such as AdaBoost or Gradient Boosting Decision Trees (GBDT).

Summary updated

BibTeX
@inproceedings{zeng2022cross,
  author = {Fuping Zeng and Wanting Lin and Ying Xing and Lu Sun and Bin Yang},
  title = {{A Cross-project Defect Prediction Model Using Feature Transfer and Ensemble Learning}},
  booktitle = {Tehnicki},
  year = {2022},
  doi = {10.17559/tv-20220421110027},
}
Figure