Cross Project Software Defect Prediction Using Machine Learning with Optimized Feature Selection
Abstract
In smart city software systems, where interconnected services demand high reliability, Software Defect Prediction (SDP) plays a vital role and reducing maintenance costs by identifying defect-prone modules early in the Software Development Life Cycle (SDLC). Cross-Project Defect Prediction (CPDP) enables defect data from source projects to predict defects in target projects with scarce labels; However, its effectiveness is hindered by feature redundancy, heterogeneous data distributions, and severe class imbalance. To address these challenges, this study proposes an integrated CPDP framework that combines Particle Swarm Optimization with Domain Knowledge (PSO+DK) for feature selection and Adaptive Synthetic Sampling (ADASYN) for class imbalance handling. Experiments were conducted on five widely used NASA datasets; CM1, PC1,PC2, PC3, and PC4 —using Random Forest (RF), Support Vector Machine (SVM), and Extreme Gradient Boosting (XGBoost) classifiers. Results show that PSO+DK enhanced the discriminative power of the models, with the framework achieving the highest accuracy of 0.9785 on PC2 dataset. Furthermore, ADASYN show minimal differences over SMOTE in improving classifier robustness. Highlights promising directions for deploying reliable cross-project prediction in smart city software development