DOI: 10.3390/software5030035 ISSN: 2674-113X

Enhancing Cross-Project Defect Prediction via Transfer Component Analysis and Hybrid Ensembles

Bassey Isong

In cross-project defect prediction (CPDP), divergence in feature distribution between the source and target often fails when predicting defects across unrelated projects. Such a mismatch is typical rather than exceptional in real deployment scenarios. To address this, the Transfer Component Analysis (TCA) technique projects the source and target into a shared subspace, where Maximum Mean Discrepancy is minimized. However, combining fixed ensemble classifiers with TCA on NASA datasets is yet to be explored. Previous studies either searched ensemble compositions adaptively or conflated alignment with source selection. In this study, we trained a two-layer hybrid ensemble of Bagging and AdaBoost classifiers, alongside a Logistic Regression meta-learner, on TCA-aligned features across 20 directed source–target pairs. We used five PROMISE datasets, each having 21 McCabe and Halstead features. Experiments were conducted, and the findings show that, against an unaligned baseline using the same ensemble, TCA alignment increased mean AUC by 0.131 (0.625 to 0.755), mean F1 by 0.155, and mean MCC by 0.125. Wilcoxon signed-rank tests confirmed significance across all three metrics (p < 0.003, rank-biserial r = 0.714, Cliff’s Delta d ≥ 0.545). A full ablation showed that alignment was the dominant contributor to performance, with TCA improving AUC by +0.131 over the unaligned baseline. In contrast, SMOTE traded a small AUC reduction (−0.014) for substantial F1 gains (+0.134), while the stacking layer provided modest improvements in F1 and MCC. TCA reduced MMD across all 20 source–target pairs by a mean of 83.3%. Sensitivity analysis further showed that the TCA subspace dimensionality parameter, k, exhibited non-monotone, pair-specific AUC sensitivity, with optimal values ranging from 5 to 30. These findings indicate that alignment parameter selection substantially influences CPDP performance and that a fixed global default is inadequate.

More from our Archive