FSSFO-based computationally efficient wrapper feature selection for software defect prediction using NASA/PROMISE datasets and multiple classifiers. README.md
A computationally efficient wrapper-based feature selection framework based on the Swift Flight Optimizer (SFO) for software defect prediction.
This repository contains the implementation of FSSFO, the experimental pipeline, benchmark optimizers, machine-learning classifiers, NASA/PROMISE datasets, result-processing scripts, and convergence-analysis tools used in the study:
Computationally Efficient Wrapper-Based Feature Selection Model for Software Defect Prediction Using the Swift Flight Optimization Algorithm
Software defect prediction aims to identify fault-prone software modules before deployment so that testing and maintenance resources can be allocated more effectively. However, software defect datasets frequently contain redundant software metrics and strongly imbalanced class distributions.
FSSFO adapts the continuous Swift Flight Optimizer to the binary feature-selection problem. Each candidate solution is transformed into a binary feature mask using a sigmoid transfer function and a deterministic threshold. The selected feature subset is then evaluated using a wrapper classifier.
The repository supports experiments with:
- 12 NASA/PROMISE software defect datasets
- 4 machine-learning classifiers
- 14 feature-selection optimizers
- 10 independent runs
- A population size of 10
- 200 optimization iterations
- Accuracy, defective-class precision, recall, F1-score, RMSE, selected-feature count, computational time, ranking, and convergence analysis
The proposed method is called FSSFO, where:
- FS denotes feature selection.
- SFO denotes the Swift Flight Optimizer.
The original SFO operates in a continuous search space. In FSSFO, each continuous position is converted into a binary decision vector:
1indicates that the corresponding software metric is selected.0indicates that the corresponding software metric is excluded.
A sigmoid transfer function followed by a threshold of 0.5 is used to generate the binary feature mask.
The wrapper fitness function is defined as:
Fitness = 1 - Validation Accuracy
Lower fitness values indicate better candidate feature subsets.
FSSFO is compared with 13 population-based metaheuristic optimizers:
| Abbreviation | Algorithm |
|---|---|
| FSSFO | Swift Flight Optimizer |
| FSPSO | Particle Swarm Optimization |
| FSGWO | Grey Wolf Optimizer |
| FSDE | Differential Evolution |
| FSGA | Genetic Algorithm |
| FSACOR | Ant Colony Optimization for Continuous Domains |
| FSWOA | Whale Optimization Algorithm |
| FSHHO | Harris Hawks Optimization |
| FSHBA | Honey Badger Algorithm |
| FSAGTO | Artificial Gorilla Troops Optimizer |
| FSMGO | Mountain Gazelle Optimizer |
| FSSeaHO | Sea-Horse Optimizer |
| FSCoatiOA | Coati Optimization Algorithm |
| FSSCSO | Sand Cat Swarm Optimization |
All algorithms are evaluated under the same population size, iteration budget, data partitions, preprocessing procedure, and random seeds.
The wrapper evaluation uses four machine-learning classifiers:
- Gaussian Naive Bayes
- K-Nearest Neighbors
- Decision Tree
- Linear Discriminant Analysis
The defective class is treated as the positive class when computing precision, recall, and F1-score.
The experiments use the following NASA/PROMISE software defect datasets:
| Dataset | Modules | Predictors | Defective Modules | Defect Ratio |
|---|---|---|---|---|
| CM1 | 344 | 37 | 42 | 12.21% |
| JM1 | 9,593 | 21 | 1,759 | 18.34% |
| KC1 | 2,096 | 21 | 325 | 15.51% |
| KC3 | 200 | 39 | 36 | 18.00% |
| KC4 | 125 | 40 | 61 | 48.80% |
| MC1 | 9,277 | 38 | 68 | 0.73% |
| MC2 | 127 | 39 | 44 | 34.65% |
| PC1 | 759 | 37 | 61 | 8.04% |
| PC2 | 1,585 | 36 | 16 | 1.01% |
| PC3 | 1,125 | 37 | 140 | 12.44% |
| PC4 | 1,399 | 37 | 178 | 12.72% |
| PC5 | 17,186 | 39 | 516 | 3.00% |
The datasets are publicly available through the NASA/PROMISE software engineering repositories. Users should cite the original dataset sources when using them.
FSSFO-Software-Defect-Prediction/
│
├── algorithms/
│ ├── base_optimizer.py
│ ├── fitness.py
│ ├── registry.py
│ ├── sfo.py
│ └── transfer.py
│
├── classifiers/
│ └── models.py
│
├── datasets/
│ ├── CM1.csv
│ ├── JM1.csv
│ ├── KC1.csv
│ ├── KC3.csv
│ ├── KC4.csv
│ ├── MC1.csv
│ ├── MC2.csv
│ ├── PC1.csv
│ ├── PC2.csv
│ ├── PC3.csv
│ ├── PC4.csv
│ └── PC5.csv
│
├── experiments/
│ ├── run_all.py
│ ├── run_single_dataset.py
│ └── generate_convergence_plots.py
│
├── results/
│ ├── convergence/
│ ├── plots/
│ ├── Accuracy.csv
│ ├── Metrics.csv
│ ├── Friedman.csv
│ └── selected_features.csv
│
├── README.md
└── requirements.txt
The exact file names may be adjusted according to the final repository organization.
git clone https://github.com/USERNAME/FSSFO-Software-Defect-Prediction.git
cd FSSFO-Software-Defect-PredictionUsing venv:
python -m venv .venvActivate it on Windows:
.venv\Scripts\activateActivate it on Linux or macOS:
source .venv/bin/activatepip install --upgrade pip
pip install -r requirements.txtThe experiments were developed using Python 3.11 and MEALPY 3.0.3.
python experiments/run_all.pyThis command runs all combinations of:
- 12 datasets
- 4 classifiers
- 14 feature-selection algorithms
- 10 independent runs
The complete benchmark may require substantial computational time.
python experiments/run_single_dataset.py --dataset PC2python experiments/run_single_dataset.py --dataset PC2 --classifier KNNpython experiments/run_single_dataset.py --dataset PC2 --classifier KNN --algorithm SFOThe command-line options above should be adjusted if the final scripts use different argument names.
The main experimental settings are:
| Parameter | Value |
|---|---|
| Population size | 10 |
| Maximum iterations | 200 |
| Independent runs | 10 |
| Search bounds | [-6, 6] |
| Transfer function | Sigmoid |
| Binary threshold | 0.5 |
| Outer split | 70% training / 30% testing |
| Inner split | 80% optimization training / 20% validation |
| Stratified splitting | Yes |
| Optimization objective | Minimize validation error |
The test partition is not used during feature selection. After the best feature subset is selected, the classifier is retrained using the complete outer-training partition and evaluated on the held-out test partition.
The repository reports:
- Classification accuracy
- Defective-class precision
- Defective-class recall
- Defective-class F1-score
- Root Mean Square Error
- Number of selected features
- Computational time
- Accuracy-based ranking
- Mean best-so-far convergence
Because several datasets are highly imbalanced, accuracy should not be interpreted alone. Defective-class recall and F1-score are especially important for evaluating the ability to identify fault-prone modules.
Across all 48 dataset-classifier combinations, FSSFO obtained:
| Metric | FSSFO Result |
|---|---|
| Average accuracy | 84.66% |
| Defective-class precision | 43.98% |
| Defective-class recall | 31.40% |
| Defective-class F1-score | 34.23% |
| RMSE | 36.05% |
| Average selected features | 16.51 |
| Average computational time | 10.17 s |
| Mean accuracy rank | 8.08 |
FSSFO was:
- Second-fastest among the 14 evaluated methods
- Third in defective-class recall
- Fourth in defective-class F1-score
- Within 0.61 percentage points of the highest aggregate accuracy
The results indicate that FSSFO provides a competitive balance between predictive performance, minority-class recognition, feature reduction, and computational efficiency.
The convergence scripts calculate the mean best-so-far fitness over the 10 independent runs for each:
Dataset + Classifier + Algorithm + Iteration
To generate the convergence figures:
python experiments/generate_convergence_plots.pyThe generated figures are saved in:
results/plots/
Lower fitness values indicate better feature subsets.
To reproduce the reported results:
- Use the same dataset files.
- Use Python 3.11.
- Install the package versions listed in
requirements.txt. - Use the experimental parameters reported above.
- Preserve the random seeds used for the 10 independent runs.
- Use stratified training, validation, and test splits.
- Apply preprocessing using training data only.
- Do not use the held-out test set during feature selection.
Generated result files should be retained so that the reported tables and convergence figures can be reconstructed without rerunning all experiments.
Abbas Aqeel Kareem
Department of Cybersecurity Engineering Techniques
Technical Engineering College of Artificial Intelligence
Middle Technical University
Baghdad, Iraq
The software release used in this study is permanently archived on Zenodo:
Kareem, A. A. (2026). FSSFO: Wrapper-Based Feature Selection for Software Defect Prediction (Version 1.0.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.21481165
@software{kareem2026fssfo,
author = {Kareem, Abbas Aqeel},
title = {FSSFO: Wrapper-Based Feature Selection for Software Defect Prediction},
version = {1.0.1},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.21481165},
url = {https://doi.org/10.5281/zenodo.21481165}
}GitHub can generate citation formats automatically from the CITATION.cff file. Select Cite this repository from the repository sidebar to obtain APA and BibTeX formats.
The corresponding research-paper citation will be added after publication.