Feature selection method based on improved firefly algorithm and software defect prediction system
By improving the multi-group strategy initialization and adaptive step length adjustment of the Firefly algorithm, combined with simulated annealing algorithm and fitness function optimization, the search efficiency and model generalization problems of the Firefly algorithm under high-dimensional data are solved, and efficient feature selection and software defect prediction are improved.
Patent Information
- Application Number
- CN202510598501.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-08-15
AI Technical Summary
The existing firefly algorithm has insufficient initial population diversity in feature selection, and the search process is prone to local optimality, and the step size and search area are statically fixed, resulting in low search efficiency. Especially when processing high-dimensional data, high computational complexity and slow convergence speed, and the fitness function fails to take into account the scale control of feature subsets, which limits the generalization ability of the model.
Multi-group strategy is used to initialize populations, combine adaptive step size adjustment and dynamic neighborhood updates, and enhance global search capabilities through simulated annealing algorithm, and introduce the fitness function fusion classification accuracy and feature subset scale to achieve efficient feature subset extraction.
The performance of the Firefly algorithm under high-dimensional and category imbalanced data has been improved, the efficiency and accuracy of the software defect prediction model has been significantly improved, and the interpretability and generalization capabilities of the model have been enhanced.
Smart Images

Figure CN120493980A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to but is not limited to the field of feature selection technology, and in particular relates to a feature selection method based on an improved firefly algorithm and a software defect prediction system. Background Art
[0002] Chen et al. (2018) demonstrated that software defect prediction (SDP) is an important technique in software development, guiding engineers to focus limited resources on potentially defect-prone areas. Based on historical data and machine learning algorithms, SDP models can probabilistically classify new software modules as normal or abnormal. However, the rapid growth in data volume in recent years, one of the 5V characteristics of data, has posed a challenge to data-based machine learning algorithms. In other words, redundant and irrelevant features can lead to degraded SDP model performance and should be reduced through feature selection methods. Consequently, many engineers and researchers are dedicated to designing and developing feature selection algorithms to reduce redundant and irrelevant features, thereby improving the performance of SDP models.
[0003] Closest Existing Technology: Current mainstream feature selection methods mainly include three types of algorithms: filter, wrapper, and embedded. Among them, feature selection strategies based on metaheuristic algorithms, such as the traditional Firefly Algorithm (FA), are widely used due to their global search capabilities. However, the initial population used in traditional FA feature selection is often randomly generated, resulting in insufficient population diversity and prone to falling into local optimality. Furthermore, the step size and search area are statically fixed, resulting in low search efficiency. This is particularly problematic when dealing with high-dimensional data feature selection tasks, which exhibits drawbacks such as high computational complexity and slow convergence.
[0004] Existing technical problems: First, the existing FA feature selection methods have a single initialization method and lack in-depth utilization of the information structure between features, making it difficult to provide high-quality initial individuals. Second, the traditional FA update strategy fails to dynamically adjust the step size and neighborhood range according to the search state, resulting in premature convergence or search stagnation during the search process. In addition, the fitness function design often only focuses on classification accuracy without considering the control of the feature subset size, which limits the interpretability of the results and the generalization ability of the model. Therefore, there is an urgent need for an improved feature selection method with improved initial population diversity, search mechanism adaptability, and multi-dimensional fusion of evaluation indicators. Summary of the Invention
[0005] In response to the problems existing in the prior art, the present invention provides a feature selection method and a software defect prediction system based on an improved firefly algorithm.
[0006] The present invention is implemented as follows: a feature selection method based on an improved firefly algorithm, the method comprising:
[0007] S1. Multi-group strategy initialization: The initial population is initialized using multiple heterogeneous strategies, including information entropy drive, mutual information screening, and orthogonal experimental design, to generate diverse feature selection individuals;
[0008] S2. Algorithm complexity optimization: Improve the traditional firefly algorithm by adopting an adaptive step-size adjustment mechanism and a dynamic neighborhood update strategy to reduce search redundancy and improve feature search efficiency;
[0009] S3. Feature selection based on MSAFA: The individual firefly position vector is encoded into a binary representation of feature selection. A fitness function that integrates classification accuracy and feature subset size is used to guide the search. The local and global updates are controlled by the light intensity mechanism to achieve efficient feature subset extraction.
[0010] Furthermore, the S1 specifically includes:
[0011] In the firefly algorithm (FA), there is attraction between any two fireflies, which may lead to some wrong directions and redundant attraction, causing the algorithm to converge prematurely;
[0012] In order to reduce the redundant attraction of the firefly algorithm, a multi-group strategy based on the position information of fireflies is proposed. In the multi-group mechanism, for a firefly, the fireflies with better fitness and located in a circle with the firefly as the center and the distance from the firefly to the best firefly as the radius form a group. Taking fireflies i and j as an example, fireflies a, b, c and d form one group, and fireflies e, f and d form another group. Each group effectively performs local search in its circular space, while all groups perform global search in the entire space. In particular, firefly d is a common member of the two groups and plays the role of an information exchange center, thereby enhancing the global search capability. When performing global search in the multi-group mechanism, the number of migrations plays a key role, but this number cannot be determined in advance. Therefore, a control parameter times is proposed to determine the number of migrations. The maximum value of times is set to 8, that is, each firefly can be a member of up to 8 groups at the same time.
[0013] In order to increase the diversity of the population, Cauchy jump is used to update the position of the best firefly, as shown in the following formula;
[0014] in, represents the position of the current best firefly in the dth dimension in each iteration, Cauchy is a random value of the standard Cauchy distribution, α represents the control parameter, β represents the attraction rate, γ represents the Euler distance between fireflies, Distance represents the Euler distance between the current firefly and the best firefly, and ε represents a random number value [0,1];
[0015] distance i =||x i -x best ||
[0016] x i (t+1)=x i (t)+β(x j (t)-x i (t))+α(t)ε
[0017]
[0018]
[0019] Furthermore, the S2 specifically includes:
[0020] In order to clearly study and evaluate the complexity of the proposed algorithm, it is compared with the complexity of some improved Firefly algorithm variants, including MFA, RaFA, and LiFA;
[0021] First, we analyze the complexity of these advanced firefly algorithm variants. We assume that each competitor uses the same settings, the termination condition is Max, the population size is N, and the dimension of the problem is D. In RaFA, the execution time to evaluate a solution is t1. Therefore, the time complexity of RaFA is O(MaxND(t1)), which can be simplified to O(N).
[0022] In MFA, the execution time to evaluate a solution is t2; therefore, the time complexity of MFA is O(MaxNND(t2)), which, like FA, can be expressed as O(N 2 ); In LiFA, the execution time of evaluating a solution is t3, and the time of selecting a group G is t4; therefore, the time complexity of LiFA is O(MaxNGD(t3+t4)), which can be expressed as O(NG); the time complexity of LiFA depends on the size of the adaptive group G; then, the time complexity of the proposed algorithm is analyzed. The time of updating the new position of the entire population is t5, the time of calculating the distance between the current firefly and other fireflies is t6, the time of evaluating the generated group M consisting of k individuals is t7, and the time of performing Cauchy jump on the current best firefly is t8;
[0023] Therefore, DSFA can be expressed as O(NK 2 ); Theoretically, the value of k is between [0,19]; through preliminary experiments, the distribution of parameter k is between [0,11]; in other words, the time complexity of MSAFA is O(N 2 ) and O(N 3 ); From the above analysis, it can be seen that RaFA performs the best in time complexity, followed by MFA, LiFA and MSAFA; although the time complexity of MSAFA is worse than these firefly algorithm variants, the increased computational cost is worthwhile for the proposed method; one of the reasons is that the proposed simulated annealing SA is used to help the firefly algorithm increase the probability of escaping from the local trap; another reason is that the multi-group mechanism can enhance the global search ability of the firefly algorithm.
[0024] Furthermore, the S3 specifically includes:
[0025] After data normalization, data sample A has five eigenvalues distributed in the interval [0, 1]: {0.2, 0.6, 0.9, 0.3, 0.7}. Each eigenvalue is indexed by {a, b, c, d, e}. Using MSAFA, we search for {a, b, c, d, e} in the continuous space [0, 1]. When the value of a is greater than the threshold Ω, the feature corresponding to 0.2 is selected; otherwise, it is not selected. When the values of {a, b, c, d, e} are {0.4, 0.49, 0.6, 0.2, 0.7} and Ω is set to 0.5, the features corresponding to 0.9 and 0.7 are selected. Once a selected feature is determined, it is retained for all data samples and the SDP model is constructed. The SDP model performance evaluation results are saved. After multiple iterations of searching, the constructed SDP model meets the required performance.
[0026] Another object of the present invention is to provide a software defect prediction system, which specifically includes:
[0027] Feature correlation analysis module, using mutual information-Pearson mixing coefficient;
[0028] M-SAFA optimization engine, including dual-mode annealing and multi-group collaboration mechanism:
[0029] An adaptive prediction model integration framework that integrates three gradient boosting tree models: XGBoost, LightGBM, and CatBoost.
[0030] Furthermore, the feature correlation analysis module adopts a hybrid correlation measurement method, combining the mutual information coefficient MIC and the Pearson correlation coefficient PCC, where:
[0031] MIC is used to capture nonlinear feature associations;
[0032] PCC is used to quantify the degree of linear correlation;
[0033] Dynamically construct feature correlation matrix, matrix element C ij Defined as:
[0034] C ij =α·MIC(f i , f j )+(1-α)·|PCC(f i , f j )∣.
[0035] Furthermore, the M-SAFA optimization engine specifically includes:
[0036] Dual-mode annealing mechanism:
[0037] Global annealing: using exponential cooling function to control the search range;
[0038] Local jump: When the optimal solution is not improved after 5 consecutive iterations, the jump Perform a Gaussian perturbation:
[0039] It includes three sub-groups: the exploratory group, which focuses on global search; the development group, which focuses on local optimization; and the balanced group, which regularly exchanges the best individuals between groups.
[0040] Furthermore, the adaptive prediction model integration framework specifically includes:
[0041] Model dynamic selection mechanism:
[0042] Automatically select the optimal base learner based on the characteristics of the current feature subset;
[0043] The selection criterion is based on the Information Gain Ratio (IGR) of the feature subset:
[0044]
[0045] After each feature selection iteration, the model weights are re-evaluated.
[0046] Another object of the present invention is to provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the feature selection method based on the improved firefly algorithm.
[0047] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the feature selection method based on the improved firefly algorithm.
[0048] Another object of the present invention is to provide an information data processing terminal, which is used to implement the software defect prediction system.
[0049] In combination with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are as follows:
[0050] First, this paper proposes an improved Firefly algorithm variant that employs the simulated annealing (SA) algorithm to escape local traps and leverages multiple group strategies to enhance the Firefly algorithm's global search capabilities. Spatial software defect prediction (SDP) models constructed using basic classification algorithms perform poorly when the database suffers from class imbalance and high dimensionality. The proposed Firefly algorithm variant significantly improves the performance of the Firefly algorithm and is applied to the SDP model to reduce redundant features and improve its efficiency. Two sets of experiments were conducted to test the performance of the proposed method. The first set of experiments evaluated the efficiency of the proposed Firefly algorithm variant using 28 optimization problems; the second set of experiments employed six datasets with class imbalance and high dimensionality to test the proposed method's feature selection capabilities in SDP. In comparisons with seven state-of-the-art swarm intelligence algorithms, the Multi-Strategy Adaptive Firefly Algorithm (MSAFA) significantly outperformed its competitors in solving continuous optimization problems. In future work, we will utilize the proposed algorithm to optimize multi-objective solutions to SDP problems.
[0051] Second, in practical industrial production, there are single-peak, multi-peak, and composite optimization problems. However, most existing optimization solutions demonstrate good performance on one or two types of optimization problems, and finding an optimization solution that can simultaneously address all three types of optimization problems remains a technical challenge. Compared with existing advanced optimization solutions, the multi-strategy optimization proposed in this solution has been shown to significantly outperform existing solutions on all three types of optimization problems. Therefore, the application of this solution can maximize the improvement of industrial production efficiency by ignoring the influence of the optimization problem's inherent properties.
[0052] In existing software defect prediction schemes, the quality of the learner is the key factor in their performance, often overlooking the importance of software feature attributes. In this scheme, through correlation analysis and optimization of software features, experimental results show that the selection of software defect feature sets determines the accuracy of software defect prediction to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 This is a flow chart of a feature selection method based on an improved firefly algorithm provided by an embodiment of the present invention;
[0054] Figure 2is a framework diagram of a distance guidance mechanism provided by an embodiment of the present invention;
[0055] Figure 3 These are the first 10 selected features provided by the embodiment of the present invention. Figure 4 This is a feature selection flowchart based on MSAFA provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0057] like Figure 1 As shown, an embodiment of the present invention provides a feature selection method based on an improved firefly algorithm, the method comprising:
[0058] S1: multiple group strategies;
[0059] S2: Complexity analysis of MSAFA.
[0060] The proposed feature selection method, based on the Modified Simplified Artificial Firefly Algorithm (MSAFA), first introduces a multi-group search strategy mechanism in step S1. By using heterogeneous initialization methods for the initial population, each group of fireflies has a different search bias in the feature space, thereby improving global search capabilities. Specific strategies include information entropy-driven initialization, mutual information screening preprocessing, and orthogonal experimental design distribution to ensure a diverse and discriminative population distribution at the initial search stage.
[0061] In step S2, the complexity of the MSAFA algorithm is quantitatively analyzed. An adaptive step-size adjustment mechanism and a dynamic neighborhood update strategy are introduced to reduce redundant searches and local oscillations, thereby improving search efficiency. Theoretically, the algorithm's computational complexity per generation is O(n·d·k), where n is the population size, d is the feature dimension, and k is the number of fitness evaluations. By streamlining update operators and introducing a lazy update mechanism, redundant operations can be reduced to approximately 65% of those in the original SAFA.
[0062] In step S3, feature selection is performed based on MSAFA. The position vectors of individual fireflies are mapped into a binary representation of the selected features, with each dimension corresponding to the selected state of a feature. The fitness function is a weighted scoring function that combines classification accuracy with the size of the feature subset. The weights are dynamically adjusted to accommodate different dataset sizes and the proportion of noise features. Iterative convergence of the feature subspace is achieved through a combination of local optimal search driven by light intensity (i.e., fitness) and global induced updates.
[0063] The resulting feature subset not only maintains high classification performance but also achieves a high degree of dimensionality reduction and model generalization. Experiments have shown that this method, compared to traditional genetic algorithms and ant colony algorithms, has superior convergence speed, feature selection stability, and ability to obtain optimal objective function values on multiple high-dimensional datasets, validating its applicability and robustness in practical feature dimensionality reduction and model training scenarios.
[0064] Said S1 specifically includes:
[0065] In the firefly algorithm (FA), there is attraction between any two fireflies, which may lead to some wrong directions and redundant attraction, causing the algorithm to converge prematurely;
[0066] In order to reduce the redundant attraction of the firefly algorithm, a multi-group strategy based on the position information of fireflies is proposed. In the multi-group mechanism, for a firefly, the fireflies with better fitness and located in a circle with the firefly as the center and the distance from the firefly to the best firefly as the radius form a group. Taking fireflies i and j as an example, fireflies a, b, c and d form one group, and fireflies e, f and d form another group. Each group effectively performs local search in its circular space, while all groups perform global search in the entire space. In particular, firefly d is a common member of the two groups and plays the role of an information exchange center, thereby enhancing the global search capability. When performing global search in the multi-group mechanism, the number of migrations plays a key role, but this number cannot be determined in advance. Therefore, a control parameter times is proposed to determine the number of migrations. The maximum value of times is set to 8, that is, each firefly can be a member of up to 8 groups at the same time.
[0067] In order to increase the diversity of the population, Cauchy jump is used to update the position of the best firefly, as shown in the following formula;
[0068] in, represents the position of the current best firefly in the dth dimension in each iteration, Cauchy is a random value of the standard Cauchy distribution, α represents the control parameter, β represents the attraction rate, γ represents the Euler distance between fireflies, Distance represents the Euler distance between the current firefly and the best firefly, and ε represents a random number value [0,1];
[0069] distance i =||x i -x best ||
[0070] x i (t+1)=x i (t)+β(x j (t)-x i (t))+α(t)ε
[0071]
[0072]
[0073] The S2 specifically includes:
[0074] The proposed multiple groups of mechanisms such as Figure 2 As shown, in order to clearly study and evaluate the complexity of the proposed algorithm, it is compared with the complexity of some improved firefly algorithm variants, including MFA, RaFA and LiFA;
[0075] First, we analyze the complexity of these advanced firefly algorithm variants. We assume that each competitor uses the same settings, the termination condition is Max, the population size is N, and the dimension of the problem is D. In RaFA, the execution time to evaluate a solution is t1. Therefore, the time complexity of RaFA is O(MaxND(t1)), which can be simplified to O(N).
[0076] In MFA, the execution time to evaluate a solution is t2; therefore, the time complexity of MFA is O(MaxNND(t2)), which, like FA, can be expressed as O(N 2 ); In LiFA, the execution time of evaluating a solution is t3, and the time of selecting a group G is t4; therefore, the time complexity of LiFA is O(MaxNGD(t3+t4)), which can be expressed as O(NG); the time complexity of LiFA depends on the size of the adaptive group G; then, the time complexity of the proposed algorithm is analyzed. The time of updating the new position of the entire population is t5, the time of calculating the distance between the current firefly and other fireflies is t6, the time of evaluating the generated group M consisting of k individuals is t7, and the time of performing Cauchy jump on the current best firefly is t8;
[0077] Therefore, DSFA can be expressed as O(NK 2 ); Theoretically, the value of k is between [0,19]; through preliminary experiments, the distribution of parameter k is between [0,11]; in other words, the time complexity of MSAFA is O(N 2) and O(N 3 ); From the above analysis, it can be seen that RaFA performs the best in time complexity, followed by MFA, LiFA and MSAFA; although the time complexity of MSAFA is worse than these firefly algorithm variants, the increased computational cost is worthwhile for the proposed method; one of the reasons is that the proposed simulated annealing SA is used to help the firefly algorithm increase the probability of escaping from the local trap; another reason is that the multi-group mechanism can enhance the global search ability of the firefly algorithm.
[0078] An embodiment of the present invention provides a software defect prediction system, which specifically includes:
[0079] Feature correlation analysis module, using mutual information-Pearson mixing coefficient;
[0080] M-SAFA optimization engine, including dual-mode annealing and multi-group collaboration mechanism:
[0081] An adaptive prediction model integration framework that integrates three gradient boosting tree models: XGBoost, LightGBM, and CatBoost.
[0082] The feature correlation analysis module adopts a hybrid correlation measurement method, combining the mutual information coefficient MIC and the Pearson correlation coefficient PCC, where:
[0083] MIC is used to capture nonlinear feature associations;
[0084] PCC is used to quantify the degree of linear correlation;
[0085] Dynamically construct feature correlation matrix, matrix element C ij Defined as:
[0086] C ij =α·MIC(f i , f j )+(1-α)·|PCC(f i , f j )∣.
[0087] The M-SAFA optimization engine specifically includes:
[0088] Dual-mode annealing mechanism:
[0089] Global annealing: using exponential cooling function to control the search range;
[0090] Local jump: When the optimal solution is not improved after 5 consecutive iterations, the jump Perform a Gaussian perturbation:
[0091] It includes three sub-groups: the exploratory group, which focuses on global search; the development group, which focuses on local optimization; and the balanced group, which regularly exchanges the best individuals between groups.
[0092] The adaptive prediction model integration framework specifically includes:
[0093] Model dynamic selection mechanism:
[0094] Automatically select the optimal base learner based on the characteristics of the current feature subset;
[0095] The selection criterion is based on the Information Gain Ratio (IGR) of the feature subset:
[0096]
[0097] After each feature selection iteration, the model weights are re-evaluated.
[0098] An embodiment of the present invention provides a computer device, which includes a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor performs the steps of the feature selection method based on the improved firefly algorithm.
[0099] An embodiment of the present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the feature selection method based on the improved firefly algorithm.
[0100] An embodiment of the present invention provides an information data processing terminal, which is used to implement the software defect prediction system.
[0101] Relevant evidence of the technical effects achieved by the embodiments of the present invention.
[0102] 1. Evaluation using CEC2013 benchmark functions
[0103] The CEC2013 benchmark consists of 28 optimization problems proposed by Liang et al. (2013). These problems are widely used to evaluate the performance of optimization algorithms, including unimodal functions (f1-f6), basic multimodal functions (f7-f20), and composite functions (f21-f28). In comparisons with the original Firefly Algorithm (FA) and four state-of-the-art Firefly Algorithm variants, all algorithms were run 30 times on these optimization problems in 30 and 50 dimensions, respectively. The parameters of each algorithm were set according to the original settings. The maximum number of iterations and population size of each algorithm were set to 5E5 and 20, respectively. The mean (mean) and standard deviation (SD) of the best solution for each problem were recorded, and their efficiency was analyzed using the Wilcoxon rank sum test and Friedman test. Detailed experimental results are shown in Tables 1 and 2. The best solution for each problem is marked in bold. The results of the Wilcoxon rank sum test are indicated by "+ / ≈ / -" with a significance level of 0.05, and the results of the Friedman test are presented as ranking scores. “+ / ≈ / -” means better than, equivalent to, and worse than, respectively.
[0104] Table 1 Comparative experimental results with FA, MFA, NaFA, DFA and LiFA on the 30-dimensional CEC2013 problem
[0105]
[0106] In Table 1, MSAFA achieved optimal solutions on 16 problems, while other algorithms achieved optimal solutions on the remaining 12. The Wilcoxon rank sum test results at the bottom of the table show that, out of 28 functions, MSAFA outperformed FA on 24, MFA on 22, NaFA on 19, DFA on 21, and LiFA on 14. Among the 28 problems, MSAFA was inferior to these algorithms on 4, 3, 6, 4, and 4 problems, respectively. The Friedman test results show that MSAFA achieved the best ranking score of 1.875. The remaining ranking order is LiFA, MFA, NaFA, DFA, and FA. It can be concluded that the proposed algorithm outperforms other algorithms on most 30-dimensional CEC2013 problems.
[0107] Table 2 Comparative experimental results with FA, MFA, NaFA, DFA and LiFA on the 50-dimensional CEC2013 problem
[0108]
[0109] In Table 2, MSAFA achieved optimal solutions on 16 of the 28 problems. In the "+ / ≈ / -" notation, MSAFA outperformed FA on 24 of the 28 functions, MFA on 22, NaFA on 19, DFA on 21, and LiFA on 15. Among the 28 problems, MSAFA was inferior to them in 3, 3, 5, 4, and 3 problems, respectively. According to the Friedman test results, MSAFA achieved the best ranking score of 1.9821. The remaining ranking order was LiFA, MFA, NaFA, DFA, and FA. It can be concluded that the proposed algorithm still significantly outperforms other algorithms on most 50-dimensional CEC2013 problems.
[0110] Table 3. Running time of the algorithm on 30-dimensional and 50-dimensional CEC2013 problems (seconds)
[0111]
[0112] Table 4 As the problem dimension increases from 30 to 50, the ratio of computational cost also increases
[0113]
[0114] The computational cost of each algorithm and the ratio of the increase in computational cost as the problem dimension increases from 30 to 50 are shown in Tables 3 and 4. Although MSAFA performs slightly worse than other algorithms on the 30- and 50-dimensional CEC2013 problems, its computational cost ratio outperforms most other algorithms, achieving a second-place ranking score of 2.18 using the Friedman test tool. In other words, taking computational cost into account, MSAFA is likely to outperform most algorithms as the dimension of the optimization problem increases.
[0115] 2. Using Feature Selection Problems for Evaluation
[0116] NASA, a well-known database for evaluating the quality of SDP models, is available on Shepperd et al. (2013). It contains 13 projects characterized by class imbalance and high dimensionality. To validate the performance of the proposed feature selection method, six datasets were selected from the NASA repository, including MW1, KC3, PC1, KC1, PC2, and MC1. The sizes of these datasets range from 403 to 9466 modules, as shown in Table 5. Furthermore, three classification algorithms were employed to construct the SDP model: support vector machine (SVM), K-nearest neighbor (KNN), and random forest (RF). Regarding feature selection, MSAFA was compared with particle swarm optimization (PSO), artificial bee colony algorithm (ABC), and the five aforementioned firefly algorithm (FA) variants to improve the performance of the SDP model. The area under the curve (AUC, Fawcett, 2006) was used to evaluate the SDP model for each selected feature subset. This metric provides a comprehensive measure of performance across all possible classification thresholds. The maximum number of iterations was set to 1000, and the population size was set to 20. All algorithms were run 10 times to search for the optimal feature subset to improve the performance of the SDP model. Figure 3 The top 10 occurrences of the selected features are shown.
[0117] Table 5. Software defect prediction results of feature selection optimization scheme applied to NASA dataset
[0118]
[0119] In Table 5, three learners were used to predict the performance of six datasets. MSAFA performed best on the vast majority of datasets, and its score was significantly higher than other advanced optimization schemes in the Friedman test. These experimental results confirm that the feature selection optimization scheme is sometimes more important than the type of learner.
[0120] It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware portion can be implemented using dedicated logic; the software portion can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. Those skilled in the art will appreciate that the above-mentioned devices and methods can be implemented using computer-executable instructions and / or contained in processor control code, for example, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. The devices and modules of the present invention can be implemented by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., can also be implemented by software executed by various types of processors, or can be implemented by a combination of the above-mentioned hardware circuits and software, such as firmware.
[0121] The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with this technical field within the technical scope disclosed by the present invention and within the spirit and principles of the present invention should be covered by the scope of protection of the present invention.
Claims
1. A feature selection method based on an improved firefly algorithm, characterized in that: The method includes: Step 1: constructing the initial population using multiple initialization strategies, including a feature evaluation method based on information entropy, a feature screening method based on mutual information, and a feature combination method based on orthogonal experimental design; Step 2: Update the firefly individuals by building a dynamic neighborhood and adjusting the search step size based on the current fitness value; Step 3: Encode the current position of each firefly into a binary vector for feature selection, and construct a fitness function by fusing classification accuracy and number of features; Step 4: Guide each firefly to perform local or jump updates based on the global optimal position, and set up an information sharing mechanism to achieve collaborative search among multiple groups.
2. The method according to claim 1, characterized in that A variety of feature evaluation mechanisms are introduced during the initialization process to improve the distribution quality and diversity of the initial population. Each initialized individual is independently generated based on different strategies, and feature redundancy is calculated after initialization for re-ranking optimization.
3. The method according to claim 1, characterized in that An individual division strategy based on an adaptive neighborhood update mechanism is adopted. All individuals whose fitness is higher than the current individual and between the current individual and the global optimal individual are formed into a local search group, and each individual is limited to belong to a maximum of eight different groups.
4. The method according to claim 1, wherein In each iteration, a jump perturbation mechanism based on Cauchy distribution is introduced to the current global optimal individual, and the position is corrected according to the distance and attraction strength between the individual and the optimal individual.
5. The method according to claim 1, wherein The fitness function considers both the classification accuracy and the size of the feature selection subset and reduces the number of features in a linear penalty manner. The fitness function value is the classification accuracy minus the proportion of the number of features multiplied by the penalty coefficient.
6. A software defect prediction system, characterized in that: It includes a feature correlation analysis module, a feature optimization selection module and a prediction model integration module; the feature optimization selection module adopts the method described in any one of claims 1 to 5 to perform feature selection, and the prediction model integration module includes multiple base learners and dynamically adjusts the weight of each model according to the statistical properties of the input features.
7. The software defect prediction system according to claim 6, characterized in that: The feature correlation analysis module performs weighted fusion of the nonlinear correlation and linear correlation between each pair of features. The nonlinear correlation is calculated by the mutual information value, and the linear correlation is calculated by the Pearson correlation coefficient. The correlation matrix value is equal to the weighted sum of the two.
8. The method according to claim 1, characterized in that The algorithm also has three independent sub-populations: a global search group that dominates exploration, a local search group that performs fine optimization, and a balance group that performs migration and fusion. The three groups synchronously exchange the best individuals after a fixed number of generations to avoid falling into local optimality.
9. The software defect prediction system according to claim 6, characterized in that: The prediction model integration module includes an evaluation mechanism based on information gain ratio, which is used to dynamically select the base learning model with the best adaptability according to each feature selection result, and assign fusion weights according to the performance results of each model on the verification data set.
10. The software defect prediction system according to claim 6, wherein: The system can perform incremental feature selection and model updates based on historical version feature data, and continuously adapt to the feature distribution drift problem caused by the evolution of software project defect features with versions.
Citation Information
Patent Citations
Feature selection method based on EDSFA
CN110020661A