SDPERL: A Framework for Software Defect Prediction Using Ensemble Feature Extraction and Reinforcement Learning

Mohsen Hesamolhokama,Amirahmad Shafiee,Mohammadreza Ahmadi Teshnizi,Mohammadamin Fazli Jafar Habibi
2024-12-11
Abstract:Ensuring software quality remains a critical challenge in complex and dynamic development environments, where software defects can result in significant operational and financial risks. This paper proposes an innovative framework for software defect prediction that combines ensemble feature extraction with reinforcement learning (RL)--based feature selection. We claim that this work is among the first in recent efforts to address this challenge at the file-level granularity. The framework extracts diverse semantic and structural features from source code using five code-specific pre-trained models. Feature selection is enhanced through a custom-defined embedding space tailored to represent feature interactions, coupled with a pheromone table mechanism inspired by Ant Colony Optimization (ACO) to guide the RL agent effectively. Using the Proximal Policy Optimization (PPO) algorithm, the proposed method dynamically identifies the most predictive features for defect detection. Experimental evaluations conducted on the PROMISE dataset highlight the framework's superior performance on the F1-Score metric, achieving an average improvement of $6.25\%$ over traditional methods and baseline models across diverse datasets. This study underscores the potential for integrating ensemble learning and RL for adaptive and scalable defect prediction in modern software systems.
Software Engineering
What problem does this paper attempt to address?
The problem that this paper attempts to solve is the challenges faced by software defect prediction (SDP) in complex and dynamic development environments. Specifically, these problems include: 1. **Risks Caused by Software Defects**: Software defects may lead to significant operational and financial risks, so ensuring software quality is crucial. 2. **Limitations of Traditional Methods**: Traditional defect prediction models (such as statistics - based methods or conventional machine - learning techniques) usually rely on static datasets and predefined features and cannot fully capture the complexity in the ever - evolving software environment. These models are usually trained offline and lack the ability to continuously learn and adapt to new data. 3. **Dynamic and Adaptive Requirements**: As software projects evolve, the codebase is constantly changing, new features are introduced, and existing features are modified, and each change may introduce new defects. Traditional models have difficulty coping with such dynamic changes. To solve the above problems, this paper proposes an innovative framework SDPERL, which combines ensemble feature extraction and reinforcement learning (RL) for feature selection. The following are the main features of this framework: - **Ensemble Feature Extraction**: Use five pre - trained models for code (such as BERT, XLNet, CodeT5, etc.) to extract diverse semantic and structural features from the source code. - **Custom - made Embedding Space**: Represent feature interactions through a custom - made embedding space and combine the pheromone table mechanism inspired by ant colony optimization (ACO) to effectively guide RL agents. - **Proximal Policy Optimization (PPO) Algorithm**: Use the PPO algorithm to dynamically identify the most predictive features to improve the accuracy of defect detection. Experimental results show that this framework improves the F1 - Score metric by an average of 6.25% compared to traditional methods and benchmark models, demonstrating its potential for adaptive and scalable defect prediction in modern software systems. In summary, this paper aims to provide a more powerful, adaptive, and accurate software defect prediction method by combining ensemble learning and reinforcement learning to meet the ever - changing requirements in the software development process.