A three-stage cross-project defect prediction framework based on feature representation and knowledge transfer
摘要
Software defect prediction is a critical process for enhancing software quality by identifying potential defects early in the development lifecycle. Cross-Project Defect Prediction (CPDP) broadens traditional defect prediction methods by leveraging data from source projects to predict defects in target projects. However, existing CPDP methods face two key issues: insufficient feature representation and inadequate alignment of data distributions between source and target projects. To address these challenges, this study introduces TriStage-CPDP, a novel three-stage framework. In the first stage, TriStage-CPDP harnesses the capabilities of CodeT5+ to extract nuanced semantic and syntactic features, combines GraphSAGE for software dependency representation, and incorporates traditional metrics to construct a comprehensive feature set, enabling a more nuanced representation of software features. The second stage employs an integrated feature selection strategy that combines Last Absolute Shrinkage and Selection Operator (LASSO) regression with Recursive Feature Elimination (RFE) to refine feature relevance and eliminate redundancy effectively. Finally, a domain adaptation mechanism based on Locality Preserving Projection (LPP) aligns data distributions between source and target projects in a shared subspace, ensuring practical knowledge transfer. Experiments on the PROMISE dataset demonstrate that TriStage-CPDP significantly outperforms state-of-the-art methods, improving F-measure, AUC, and MCC. These results highlight its effectiveness in enhancing defect prediction effectiveness for data-scarce or new projects, offering a robust solution for CPDP and valuable insights for future research.