Abstract
Software defect prediction is a critical task for efficient resource allocation in software engineering. While most research focuses on binary classification, predicting the exact number of faults allows for better prioritization of maintenance efforts. This paper introduces FSCR (Feature Spectral Clustering and feature Ranking), a two-stage feature selection method designed to improve regression-based defect prediction. By combining spectral clustering for redundancy reduction with ReliefF for relevance ranking, FSCR identifies a compact, highly predictive subset of software metrics. Experimental results across 22 releases of 6 open-source projects demonstrate that FSCR consistently outperforms state-of-the-art feature selection methods in terms of prediction accuracy and model robustness.
Introduction
In software engineering, defect prediction traditionally identifies whether a module is "faulty" or "non-faulty." However, this binary approach is often insufficient for teams with limited resources who need to prioritize modules containing the highest density of bugs. Predicting the specific number of faults requires regression models, which are highly sensitive to the quality of input features. Software datasets typically contain numerous metrics (e.g., lines of code, cyclomatic complexity) that are often redundant or irrelevant, creating "noise" that degrades model performance. FSCR addresses this by filtering features to find a subset that is both unique and highly predictive of fault counts.
Methodology: The FSCR Pipeline
The proposed FSCR method consists of a two-stage pipeline designed to optimize feature subsets for regression tasks.
Stage 1: Feature Spectral Clustering (Redundancy Reduction)
Unlike standard clustering that groups data points, FSCR groups similar features. It constructs a similarity matrix using Pearson correlation coefficients between all metrics. Spectral clustering is then applied to partition these features into $k$ clusters. Because features within the same cluster are highly correlated, selecting only a few representatives from each cluster significantly reduces data redundancy.
Stage 2: Feature Ranking (Relevance Selection)
After clustering, the algorithm identifies the most relevant features within each group. It employs the ReliefF algorithm, specifically tuned to evaluate feature relevance regarding the continuous variable of fault counts.
Final Selection
The method selects the top $p$ most relevant features from each cluster. To maintain a compact model, the total subset size is targeted at $\lceil \log_2 n \rceil$, where $n$ is the original number of features.
Experimental Setup
The study evaluates FSCR using 22 releases from 6 prominent open-source projects in the PROMISE repository: Ant, Camel, Jedit, Synapse, Xalan, and Xerces. Each dataset includes 20 independent software metrics and the actual number of faults as the dependent variable. FSCR was compared against six baseline methods, including Information Gain (IG), Chi-Square (CS), and FECAR, across three regression models: Bayesian Ridge (BRR), Gradient Boosting (GBR), and Linear Regression (LR).
Results and Discussion
The experimental results indicate that FSCR provides a significant advantage in defect count prediction.
Key Findings
- Superior Accuracy: FSCR achieved the lowest average Root Mean Square Error (RMSE) across nearly all tested projects and models, indicating its predictions are closer to actual fault counts than baseline methods.
- Balanced Classification: When converted to binary metrics, FSCR maintained the best G-measure, effectively balancing precision and recall.
- Statistical Significance: Using Hedges’ $g$, the authors confirmed that FSCR’s improvements over other methods are statistically "large" (values > 1.0) in most scenarios.
Insights
The success of FSCR stems from its emphasis on diversity. While standard methods might pick multiple redundant features (e.g., different variations of "Lines of Code"), FSCR’s clustering stage ensures the model incorporates diverse types of data, such as complexity and history metrics. Furthermore, the use of spectral clustering allows the method to capture complex, non-linear relationships between features more effectively than simpler distance-based clustering like k-means.
Conclusion
FSCR offers a robust framework for improving software defect prediction by intelligently reducing feature redundancy and maximizing relevance. While the method currently relies on heuristics for parameter tuning, future work will focus on automating these optimizations and validating the approach across a broader range of software domains.
Summary updated