High-robustness heterogeneous software defect prediction algorithm based on federated learning
Through the federated learning framework, combined with Tomek links, Bootstrap Loss and client contribution regulation mechanism, the noise and heterogeneity problems in software defective data are handled, and the poor model accuracy caused by data heterogeneity and noise is solved, and the high-luxury model is achieved Awesome and accurate software defect prediction.
Patent Information
- Application Number
- CN202411310183.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-01-14
AI Technical Summary
In the field of software defect prediction, data heterogeneity and label noise lead to poor model accuracy, and traditional methods are difficult to effectively deal with the differences and noise problems across projects.
The highly robust heterogeneous software defect prediction algorithm based on federated learning is adopted, combined with Tomek links and unilateral selection algorithm to process data noise, and the Bootstrap Loss loss function and client contribution adjustment mechanism are used to optimize the model, and the distribution difference is reduced through KL divergence. Alternate to global models to reduce communication expenses.
It significantly improves the robustness and accuracy of the model, reduces the negative impact of error labels, enhances anti-noise performance, is suitable for heterogeneous data sets, and improves the accuracy of software defect prediction and model generalization capabilities.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of federated learning and software defect prediction. Background Art
[0002] In today's deep learning field, the performance of algorithms often depends on large-scale data sets, but in reality, it is often a challenge to obtain sufficient data to train models, which limits the maximization of model performance. At the same time, in the data-driven modern society, data ownership and privacy protection are increasingly valued. With the strengthening of privacy protection regulations, sensitive data such as software defect prediction data has become more private, forming the so-called "data island". This makes it complicated and difficult to expand the training set by centrally collecting data. It is in this context that Federated Learning (FL) has emerged as an innovative solution. Federated learning allows multiple parties to collaborate to build a shared model without directly sharing the data in their hands. This approach allows data to remain locally while being trained collaboratively over the network, thereby achieving joint use of data while protecting data privacy and security. Federated learning effectively breaks data silos, promotes the application and development of deep learning technology in a variety of industries, and provides new ideas for technological innovation and privacy protection in the era of big data.
[0003] And as the complexity of software systems increases, cross-project defect prediction (CPDP) becomes particularly important. Traditional software defect prediction methods mainly rely on single project data, but in actual applications, there are often significant differences in data between projects, which makes the direct application of traditional methods face many challenges. These challenges include but are not limited to:
[0004] 1. Data heterogeneity problem: The data collection standards and methods of different projects may be different, resulting in differences in data characteristics and distribution, causing data heterogeneity.
[0005] 2. Data label noise problem: The consistency and accuracy of annotations in different projects may vary greatly, and errors are inevitable in the process of data collection, resulting in the generation of wrong labels and noise, which increases the difficulty of model training. In order to solve these problems, the present invention proposes a highly robust heterogeneous software defect prediction algorithm based on federated learning, which uses federated learning technology to allow collaborative training across multiple data sources, and effectively handles the noise labels and class imbalance problems in the data by integrating Tomeklinks and One-Side Selection (OSS) algorithms and combining BootstrapLoss loss function. Tomeklinks and OSS algorithms optimize the training data set and the test data set by identifying and removing too many negative instances in the data, while the BootstrapLoss loss function dynamically adjusts the label uncertainty of each data point, improving the robustness of the model in the face of label noise. In addition, the present invention also introduces a client contribution adjustment mechanism (ClientConfidenceReweighting, CCR), which dynamically adjusts the weight of each node in model training according to the data quality, further optimizing the overall performance and accuracy of the model. The present invention also cancels the global model used in traditional federated learning, and instead adopts a public data set combined with KL (Kullback-Leibler, KL) divergence to align feature distributions in the collaborative learning stage and adjust the distribution differences between clients, so that clients can learn from each other and continuously improve their own models, while reducing communication costs. Summary of the invention
[0006] The present invention aims to solve the problem of poor prediction model accuracy caused by data heterogeneity and label noise in software defect data sets. Based on the federated learning framework, the Bootstrap Loss loss function with strong anti-noise performance is adopted in the local learning stage, and the CCR method is added to reduce the weight of clients with poor label quality, thereby improving the robustness of the model; in the collaborative learning stage, by using a public data set and KL divergence, the distribution differences between clients are reduced, replacing the traditional global model, reducing the burden on communication and improving the performance of the model.
[0007] The highly robust heterogeneous software defect prediction algorithm based on federated learning described in the present invention includes:
[0008] Step 1: Use Tomek links and One-Side Selection (OSS) algorithm to preprocess the local data of each participant. By combining the two methods, excessive negative instances in the data are deleted, and the number of minority classes and majority classes is balanced as much as possible, which greatly reduces the possibility of overfitting during training.
[0009] Step 2: Since the dimensions of the data of each participant are quite different, i.e., heterogeneous, in order to align the feature dimensions of the data input into the local model during training, the chi-square test is used to select the optimal number of features, remove redundant features, and obtain the same feature dimensions. This method can improve the ability of each participant's model to learn the knowledge possessed by other participants;
[0010] Step 3: Each participant divides the local data after balancing the positive and negative instances and aligning the feature dimensions into training sets and test sets, and randomly selects a fixed number of samples with different features as a public data set in each iteration to adjust the model alignment knowledge distribution of each participant in the collaborative learning phase, and creates an untrained local convolutional neural network model at the same time;
[0011] Step 4: The client confidence reweighting (CCR) method is adopted, and the loss function is the improved Bootstrap Loss to optimize the model architecture and federated learning, reduce the participation of clients with low label quality, and the loss function designed by the present invention is more robust to label noise data, thereby improving the overall performance of the algorithm against noise;
[0012] Step 5: Introduce KL (Kullback-Leibler, KL) divergence for knowledge exchange, replace the traditional global model, reduce communication costs, and improve model performance;
[0013] Step 6: Use the training set to train the local model created in step 3 to obtain a heterogeneous software defect prediction model;
[0014] Step 7: Use the test set to test the heterogeneous software defect prediction model.
[0015] Furthermore, in the present invention, in step 1, the process of preprocessing the local data of each participant using Tomek links and OSS algorithm is as follows:
[0016] Step 1: Most of the local software defect data owned by each participant have too many negative instances, and the data they own is heterogeneous with the data of other participants. Tomek links are used to link a single negative instance with a single positive instance in the boundary area. The two do not belong to the same category, and some noisy negative instance samples appear on the other side of the decision boundary. By deleting the negative instances in Tomek links, the negative impact caused by too many negative instances can be reduced, and the generalization ability of the model can be improved;
[0017] Step 1 and 2: Use the OSS algorithm to delete negative instances in Tomek links from software defect data from different project sources. Reclassify the data in the original data set using the 1-NN classification principle for randomly selected positive and negative instances, and compare them. Collect all misclassified instances into a set, and delete all negative instances that participate in Tomek Link from this set to reduce the impact of class imbalance. Compared with other methods, OSS will perform deletion more conservatively, effectively avoiding excessive elimination of negative instances, protecting the diversity of instances in the data set, and improving the performance of the model trained under this data set.
[0018] Furthermore, in the present invention, in step 2, the process of using the chi-square test to screen the optimal features of each local data set that is nearly balanced after processing is as follows:
[0019] Step 21: Use the chi-square test method to select the most representative feature subset from the software defect data collected from each node. By calculating the correlation between the features and the categories, the features that have the greatest impact on the prediction model can be effectively identified. This step reduces the computational burden of the model when processing high-dimensional data;
[0020] Step 2: In order to remove as many redundant features as possible while maintaining model performance, the dimension requirement is set to 25, which can best balance the above issues. The system selects the optimal feature subset for each participant according to the set dimension requirements. On each participating client, the local model input data is constructed based on the selected feature subset to enhance the ability to handle data heterogeneity.
[0021] Furthermore, in step 21, the mathematical expression of the chi-square test is:
[0022]
[0023] Among them, n represents the total number of samples, f represents the feature, c represents the category, and chi(f,c) represents the correlation between the feature and the target variable.
[0024] Furthermore, in the present invention, in step 3, the local data after balancing and normalization of feature dimensions are divided for different participants, and the public data set is selected and divided, and the process of establishing a local CNN network model is as follows:
[0025] Step 31. Each participant randomly distributes the data, with 70% as the training set and 30% as the test set. In the training set, the correct labels are flipped by Pairflip and Symmetric to add noise to test the robustness of the present invention in the face of label noise. The 25-dimensional one-dimensional data is sorted into a 5×5 two-dimensional tensor, and the training set is packaged into a 64-size and the test set is packaged into a 32-size. This size can reduce the impact of randomness, more sensitively capture the difference in performance of the model on different samples, and accelerate convergence. It adapts to the input of the model and is ready for training and testing.
[0026] Step 32: In each local training, samples with different features are randomly selected from the participating clients. The number of samples is fixed at 400, and the feature size is set to the same size as the local dataset, and organized into a 5×5 two-dimensional tensor;
[0027] Step 3. Create a local convolutional neural network model that adapts to the feature dimension of 5×5 two-dimensional tensor. The structure is: two convolutional layers are followed by the input layer, and each convolutional layer is followed by a ReLU activation function. After the convolutional layer, the network has two maximum pooling layers. Subsequently, the network contains a Flatten layer, followed by two fully connected layers, and the first fully connected layer contains a ReLU activation function and a Dropout layer. Finally, the network outputs the final category prediction through the LogSoftmax classifier.
[0028] Furthermore, in the present invention, in step 4, the client confidence reweighting (CCR) method is adopted, and the loss function is the improved Bootstrap Loss, the model architecture and federated learning are optimized, the model anti-noise performance is improved, and the process of increasing robustness is as follows:
[0029] Step 41: In the collaborative stage of federated learning, each node adopts the CCR method, using loss value and loss change rate to evaluate the label quality of the private dataset and the learning effectiveness of the local model, thereby calculating the confidence of each participant and dynamically adjusting its weight in the global model training. This strategy helps optimize the learning efficiency and model performance of the entire network;
[0030] Step 42: Each node uses the improved Bootstrap Loss loss function for local model training, which combines the standard binary cross entropy loss with the Bootstrap loss. This combination method can better handle label noise. The inverse form of the true label is used to encourage the model to consider its prediction when the label is incorrect. The bootstrap loss term combines the true label with the "pseudo label" predicted by the model for learning, improving resistance to the influence of label noise.
[0031] Furthermore, in step 41, the mathematical expression of the CCR method is:
[0032]
[0033] Among them, θ k represents the model parameters of the kth client, Represents sample x i The logic output, Indicates the label quality of the client. represents the rate of change of loss, Denotes client k in client communication round t g The confidence level in It represents the weight assigned to the client calculated by confidence. The parameter τ is used to adjust the contribution of the client confidence to the federated learning process. α represents the current learning rate. The end of the expression is to update the new model.
[0034] Furthermore, in step 42, the mathematical expression of the BootstrapLoss loss function is:
[0035]
[0036] L BL =α·L BCE +(1-α)·L Bs
[0037] Among them, y i represents the true label of the sample, represents the original output of the model, σ(·) represents the sigmoid function,
[0038] represents the weight term of the bootstrap loss and the parameter α controls the adjustment of BL under different noise levels.
[0039] Furthermore, in the present invention, in step 5, the KL (Kullback-Leibler) divergence is introduced to exchange knowledge, replace the traditional global model, reduce communication costs, and improve the model performance. The process is:
[0040] Step 51: In the model aggregation stage, the system does not use the traditional global model aggregation method, but implements a model knowledge exchange method based on KL divergence to allow each node to learn from each other. This method allows each node to evaluate the knowledge difference by calculating the KL divergence with the model output of other nodes, achieving more accurate and personalized knowledge fusion. In this way, each node can learn key information from other nodes that may not be available on the local data set, thereby improving the accuracy of prediction and the generalization ability of the model.
[0041] Furthermore, in step 51, the mathematical expression of KL divergence is:
[0042]
[0043] in, and Represents the knowledge distribution of different clients.
[0044] Furthermore, in the present invention, in step six, the local model of the participant is trained using the training set to obtain a heterogeneous software defect prediction model.
[0045] Furthermore, in step 6, the mathematical expression of the model update is:
[0046]
[0047] Among them, λ represents the learning rate in collaborative learning, Indicates t g -1 phase KL divergence value.
[0048] Furthermore, in the present invention, in step seven, the heterogeneous software defect prediction model is tested using a test set.
[0049] The present invention designs and verifies a highly robust heterogeneous software defect prediction algorithm based on federated learning, aiming to cope with the data heterogeneity and noise problems existing in the field of software defect prediction. The system strengthens data privacy protection, reduces data bias, and improves the generalization ability of the model by leveraging the advantages of distributed and collaborative learning of federated learning, effectively coping with the core problem of cross-project defect prediction. The system adopts unilateral selection (OSS) for noise filtering and BootstrapLoss for dynamically adjusting the noise impact, significantly reducing the negative impact of wrong labels and enhancing the credibility of the prediction results. Experimental results show that the accuracy of defect prediction is significantly improved, especially in the face of high label noise and data heterogeneity. At the same time, the client confidence reweighting (CCR) strategy in the system ensures the high standard of the learning process and the stability of the model performance by weighting the contribution of the client according to the data quality. In addition, the traditional global model is replaced by the public data set and the KL divergence method, reducing the communication consumption in the collaborative learning stage and improving the performance of the model. The present invention achieves good accuracy on different types of noise and heterogeneous data sets, is suitable for the field of software defect prediction, and has robust and noise-tolerant performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flow chart of a highly robust heterogeneous software defect prediction algorithm based on federated learning in the method of the present invention.
[0051] Figure 2 It is a block diagram of a highly robust heterogeneous software defect prediction algorithm based on federated learning in the method of the present invention.
[0052] Figure 3 It is a schematic diagram of the convolutional network model structure of each participant in the method of the present invention.
[0053] Figure 4 It is a visualization result diagram comparing different loss functions in the method of the present invention. DETAILED DESCRIPTION
[0054] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0055] The highly robust heterogeneous software defect prediction algorithm based on federated learning in this specific implementation mode is as follows: Figure 1 As shown, the following steps are included:
[0056] Step 1: Use Tomek links and One-Side Selection (OSS) algorithm to perform underfitting processing on the local data of each participant, delete excessive negative instances in the data, and balance the number of majority and minority classes as much as possible;
[0057] Step 1: Most of the local software defect data owned by each participant have too many negative instances, and the data they own is heterogeneous with the data of other participants. Tomek links are used to link a single negative instance with a single positive instance in the boundary area. The two do not belong to the same category, and some noisy negative instance samples appear on the other side of the decision boundary. By deleting the negative instances in Tomek links, the negative impact caused by too many negative instances can be reduced, and the generalization ability of the model can be improved;
[0058] Step 1 and 2: Use the OSS algorithm to delete negative instances in Tomek links from software defect data from different projects. Reclassify the data in the original data set using the 1-NN classification principle for randomly selected positive and negative instances, and compare them. Collect all misclassified instances into a set, and delete all negative instances participating in Tomek Link from this set, so as to reduce the impact of class imbalance and improve the ability to resist noise.
[0059] Step 2. Due to the large differences in the dimensions of the data of each participant, that is, heterogeneity, there are 61 elements in some projects, 37 elements in other projects, and only 26 elements in a few cases. The experiment uses NASA, AEEEM and Relink datasets, as shown in Table 1 below. The chi-square test is used to select the optimal number of features, remove redundant features, and obtain the same feature dimension;
[0060] Table 1. Distribution of the number of categories in the dataset
[0061]
[0062] Step 21: Use the chi-square test method to select the most representative feature subset from the software defect data collected from each node. By calculating the correlation between the features and the categories, the features that have the greatest impact on the prediction model can be effectively identified. This step reduces the computational burden of the model when processing high-dimensional data;
[0063] Step 2: In order to remove as many redundant features as possible while maintaining model performance, the dimension requirement is set to 25, which can best balance the above issues. The system selects the optimal feature subset for each participant according to the set dimension requirements. On each participating client, the local model input data is constructed based on the selected feature subset to enhance the ability to handle data heterogeneity.
[0064] Step 3: Each participant divides the local data after balancing positive and negative instances and normalizing feature dimensions into training sets and test sets, and randomly selects a fixed number of samples with different features as the public data set in each iteration, and creates an untrained convolutional neural network model at the same time;
[0065] Step 31. Each participant randomly distributes the data, with 70% as the training set and 30% as the test set. In the training set, the correct labels are flipped by Pairflip and Symmetric to add noise to test the robustness of the present invention. The 25-dimensional one-dimensional data is sorted into a 5×5 two-dimensional tensor, and the training set is packaged into a 64-size and the test set is packaged into a 32-size. This size can reduce the impact of randomness, more sensitively capture the difference in performance of the model on different samples, and accelerate convergence. It adapts to the input of the model and is ready for training and testing.
[0066] Step 32: In each local training, samples with different features are randomly selected from the participating clients. The number of samples is fixed at 400, and the feature size is set to the same size as the local dataset, and organized into a 5×5 two-dimensional tensor.
[0067] Step 3. Create a convolutional neural network model that adapts to the feature dimension of 5×5 two-dimensional tensor. The structure is: two convolutional layers are followed by the input layer, and each convolutional layer is followed by a ReLU activation function. After the convolutional layer, the network has two maximum pooling layers. Subsequently, the network contains a Flatten layer, followed by two fully connected layers, and the first fully connected layer contains a ReLU activation function and a Dropout layer. Finally, the network outputs the final category prediction through the LogSoftmax classifier.
[0068] Step 4: The client confidence reweighting (CCR) method is adopted, and the loss function is the improved Bootstrap Loss to optimize the model architecture and federated learning, reduce the participation of clients with low label quality, and the loss function designed by the present invention is more robust to label noise data, and improves the overall performance of the algorithm against noise. In order to verify the high efficiency of the loss function designed by the present invention against noise, the comparison results with other loss functions are as follows: Figure 4 As shown;
[0069] Step 41: In the collaborative stage of federated learning, each node adopts the CCR method, using loss value and loss change rate to evaluate the label quality of the private dataset and the learning effectiveness of the local model, thereby calculating the confidence of each participant and dynamically adjusting its weight in the global model training. This strategy helps optimize the learning efficiency and model performance of the entire network;
[0070] Step 42: Each node uses the improved Bootstrap Loss loss function for local model training, which combines the standard binary cross entropy loss with the Bootstrap loss. This combination method can better handle label noise. The inverse form of the true label is used to encourage the model to consider its prediction when the label is incorrect. The bootstrap loss term combines the true label with the "pseudo label" predicted by the model for learning, improving resistance to the influence of label noise.
[0071] Step 5: Introduce KL (Kullback-Leibler, KL) divergence for knowledge exchange, replace the traditional global model, reduce communication costs, improve model performance, and repeat this process until the maximum number of rounds in the collaborative learning stage is reached;
[0072] Step 51: In the model aggregation stage, the system does not use the traditional global model aggregation method, but implements a model knowledge exchange method based on KL divergence to allow each node to learn from each other. This method allows each node to evaluate the knowledge difference by calculating the KL divergence with the model output of other nodes, achieving more accurate and personalized knowledge fusion. In this way, each node can learn key information from other nodes that may not be available on the local data set, thereby improving the accuracy of prediction and the generalization ability of the model.
[0073] Step 6: Use the training set to train the local models of each participant to obtain a heterogeneous software defect prediction model. The maximum number of training rounds for global collaboration is 40 rounds, and the number of local model update rounds is 10 rounds.
[0074] Step 7: Use the test set to test the heterogeneous software defect prediction model.
[0075] In order to verify the advantages and robustness of the present invention in processing heterogeneous and noisy data sets, experiments were conducted with different noise types and intensities, and each participant had different heterogeneous data. The results are shown in Tables 2 to 4 below.
[0076] Table 2 Software defect prediction accuracy when NASA and AEEEM are participants
[0077]
[0078]
[0079] Table 3 Software defect prediction accuracy when NASA and Relink are participants
[0080]
[0081] Table 4. Software defect prediction accuracy when AEEEM and Relink are participants
[0082]
[0083] From the results in Tables 2 to 4, it can be seen that although each participant has heterogeneous data, the software defect prediction has high accuracy. It can be concluded that the accuracy of this method remains stable under different types of noise. Even if the noise intensity is increased from 0.1 to 0.2, the impact on the accuracy is not significant, which proves that the solution proposed in this paper is robust for joint learning with heterogeneous data even under different noise settings. Therefore, the present invention has high practical value in the prediction of noisy heterogeneous software defect data in practical scenarios.
Claims
1. A highly robust heterogeneous software defect prediction algorithm based on federated learning, characterized in that: The following steps are involved: Step 1: Use Tomek links and One-Side Selection (OSS) algorithm to preprocess the local data of each participant. By combining the two methods, excessive negative instances in the data are deleted, and the number of minority classes and majority classes is approximately balanced, which greatly reduces the possibility of overfitting during training. Step 1: Most of the local software defect data owned by each participant have too many negative instances, and the data they own is heterogeneous with the data of other participants. Tomek links are used to link a single negative instance with a single positive instance in the boundary area. The two do not belong to the same category, and some noisy negative instance samples appear on the other side of the decision boundary. By deleting the negative instances in Tomek links, the negative impact caused by too many negative instances can be reduced, and the generalization ability of the model can be improved; Step 1 and 2: Use the OSS algorithm to delete negative instances in Tomek links from software defect data from different project sources. Reclassify the data in the original data set using the 1-NN classification principle for randomly selected positive and negative instances, and compare them. Collect all misclassified instances into a set, and delete all negative instances that participate in Tomek Link from this set to reduce the impact of class imbalance. Compared with other methods, OSS will delete more conservatively, effectively avoiding excessive elimination of negative instances, protecting the diversity of instances in the data set, and improving the performance of the model trained under this data set. Step 2: Since the dimensions of the data of each participant are quite different, i.e., heterogeneous, in order to align the feature dimensions of the data input into the local model during training, the chi-square test is used to select the optimal number of features, remove redundant features, and obtain the same feature dimensions. This method can improve the ability of each participant's model to learn the knowledge possessed by other participants; Step 21: Use the chi-square test method to select the most representative feature subset from the approximately balanced software defect data. By calculating the correlation between features and categories, the features that have the greatest impact on the prediction model can be effectively identified. This step reduces the computational burden of the model when processing high-dimensional data; Step 2: In order to remove as many redundant features as possible while maintaining model performance, the dimension requirement is set to 25, which can best balance the above issues. The system selects the optimal feature subset of each participant according to the requirements of the set dimensions. On each participating client, the local model input data is constructed based on the selected feature subset to enhance the ability to handle data heterogeneity. Step 3: Each participant divides the local data after balancing the positive and negative instances and aligning the feature dimensions into training sets and test sets, and randomly selects a fixed number of samples with different features as a public data set in each iteration to adjust the model alignment knowledge distribution of each participant in the collaborative learning phase, and creates an untrained local convolutional neural network model at the same time; Step 31. Each participant randomly distributes the data, with 70% as the training set and 30% as the test set. In the training set, the correct labels are flipped by Pairflip and Symmetric to add noise to test the robustness of the present invention in the face of label noise. The 25-dimensional one-dimensional data is sorted into a 5×5 two-dimensional tensor, and the training set is packaged into a 64-size and the test set is packaged into a 32-size. This size can reduce the impact of randomness, more sensitively capture the difference in performance of the model on different samples, and accelerate convergence. It adapts to the input of the model and is ready for training and testing. Step 32: In each local training, samples with different features are randomly selected from the participating clients. The number of samples is fixed at 400, and the feature size is set to the same size as the local dataset, and organized into a 5×5 two-dimensional tensor. Step 3. Create a local convolutional neural network model that adapts to the feature dimension of 5×5 two-dimensional tensor. The structure is: two convolutional layers are followed by the input layer, and each convolutional layer is followed by a ReLU activation function. After the convolutional layer, the network has two maximum pooling layers. Subsequently, the network contains a Flatten layer, followed by two fully connected layers, and the first fully connected layer contains a ReLU activation function and a Dropout layer. Finally, the network outputs the final category prediction through the LogSoftmax classifier. Step 4: The client confidence reweighting (CCR) method is adopted, and the loss function is the improved Bootstrap Loss to optimize the model architecture and federated learning, reduce the participation of clients with low label quality, and the loss function designed by the present invention is more robust to label noise data, thereby improving the overall performance of the algorithm against noise; Step 41: In the collaborative stage of federated learning, each node adopts the CCR method, using loss value and loss change rate to evaluate the label quality of the private dataset and the learning effectiveness of the local model, thereby calculating the confidence of each participant and dynamically adjusting its weight in the global model training. This strategy helps optimize the learning efficiency and model performance of the entire network; Step 42: Each node uses the improved Bootstrap Loss loss function for local model training, which combines the standard binary cross entropy loss with the Bootstrap loss. This combination method can better handle label noise. The inverse form of the true label is used to encourage the model to consider its prediction when the label is incorrect. The bootstrap loss term combines the true label with the "pseudo label" predicted by the model for learning, improving resistance to the influence of label noise. Step 5: Introduce KL (Kullback-Leibler, KL) divergence for knowledge exchange, replace the traditional global model, reduce communication costs, and improve model performance; Step 51: In the model aggregation stage, the system does not use the traditional global model aggregation method, but implements a model knowledge exchange method based on KL divergence to allow each node to learn from each other. This method allows each node to evaluate the knowledge difference by calculating the KL divergence with the model output of other nodes, achieving more accurate and personalized knowledge fusion. In this way, each node can learn key information from other nodes that may not be available on the local data set, thereby improving the accuracy of prediction and the generalization ability of the model. Step 6: Use the training set to train the local model created in step 3 to obtain a heterogeneous software defect prediction model; Step 7: Use the test set to test the heterogeneous software defect prediction model. A highly robust heterogeneous software defect prediction algorithm based on federated learning, characterized in that: In step 1, the system preprocesses the software defect data set containing heterogeneous data using Tomek links and unilateral selection (OSS) algorithm to preprocess the software defect data from different project sources and delete excessive negative instances. This algorithm effectively reduces category imbalance, especially in scenarios with high-noise data. It significantly improves the generalization ability of the model in a cross-project data environment by accurately removing abnormal data instances that are prone to overfitting the model. A highly robust heterogeneous software defect prediction algorithm based on federated learning is characterized in that, in step 2, the 25 most informative features are selected using the chi-square test to ensure the consistency of the feature dimensions in each node of the federated learning. This step not only optimizes the quality of the input data, but also simplifies the computational complexity of the model, making the models between different nodes more unified and efficient; finally, each participating node constructs local model input data based on these selected feature subsets. This strategy strengthens the management of data heterogeneity and improves the stability and reliability of the model in practical applications. A highly robust heterogeneous software defect prediction algorithm based on federated learning, characterized in that: The dataset partitioning method in step 3 and the creation of a public dataset, and the use of pairflip and symmetric flipping to add noise to the training set during the partitioning. Create a convolutional neural network model that adapts to the feature dimension of 5×5 two-dimensional tensor, with the following structure: two convolutional layers, 2×2 convolution kernel size, 32 output channels, the second convolutional layer also uses a 2×2 convolution kernel size, 64 output channels, and the convolution kernel sliding step is 1. Two maximum pooling layers, both use a pooling kernel size of 2×2, the first pooling kernel sliding step is 1, and the padding is 1; the second pooling kernel sliding step is 2 to further reduce the feature dimension. Flatten layer, used to flatten the multi-dimensional input into one dimension, which is convenient for connecting to the subsequent fully connected layer. Two fully connected layers, the input feature dimension of the first fully connected layer is 256, and the output is 10. The second fully connected layer further compresses these 10 features into the final 2 outputs, corresponding to the number of categories in the classification task. The first fully connected layer contains a ReLU activation function and a Dropout layer with a ratio of 0.5 to prevent overfitting and enhance the generalization ability of the model. The network outputs the final category prediction through the LogSoftmax classifier to ensure that the output can be directly used to calculate the cross entropy loss. This neural network structure can achieve efficient and accurate classification performance. A highly robust heterogeneous software defect prediction algorithm based on federated learning, characterized in that: As described in step 4, the client confidence reweighting (CCR) method and the improved Bootstrap Loss loss function are combined to optimize the cross-project software defect prediction model. The system specifically designs a strategy to dynamically adjust the weight of each participating node using the CCR method during the collaborative stage of federated learning, based on the label quality of the private data set on each node and the learning effect of the local model. This process is achieved by analyzing the loss value and the loss change rate. In addition, the improved Bootstrap Loss loss function that combines binary cross entropy loss and Bootstrap loss provides a new way for model training to effectively deal with label noise and data heterogeneity problems. This loss function not only improves the robustness of the model to noisy labels, but also optimizes the learning process by combining the true labels with the pseudo labels predicted by the model, especially showing higher prediction accuracy on datasets with uneven label quality. By implementing these strategies in the federated learning framework, the system can significantly improve the performance of software defect prediction while ensuring data privacy, adapt to heterogeneous data environments from multiple projects, and effectively solve a series of challenges in cross-project software defect prediction. This approach not only enhances the generalization ability of the model, but also ensures the efficiency and reliability of the model in practical applications by optimizing the global learning process of the model and improving the accuracy of local model training. A highly robust heterogeneous software defect prediction algorithm based on federated learning, characterized in that: The system described in step 5 adopts an innovative aggregation strategy that does not rely on traditional global models. After completing local training, each participating node does not simply summarize and update to a central model. Instead, the system uses a KL divergence-based method to evaluate and integrate knowledge across nodes. This method allows each node to evaluate the difference between its model output and other nodes, and to identify differences in knowledge distribution through KL divergence calculations. The advantages of other nodes on specific issues can be learned, thereby achieving more effective knowledge transfer and integration. This method based on differential learning not only improves the specificity and pertinence of learning, but also reduces performance degradation problems caused by inconsistent data distribution and reduces communication costs. Through this improved aggregation and knowledge sharing method, the system effectively maintains data privacy and security without a central global model, while significantly improving the performance and reliability of cross-project software defect prediction, especially the adaptability and robustness when dealing with large-scale distributed data sources. A highly robust heterogeneous software defect prediction algorithm based on federated learning, characterized in that: In step 6, the local model of each node is trained using the training set to obtain a model for heterogeneous software defect prediction; A highly robust heterogeneous software defect prediction algorithm based on federated learning, characterized in that the trained federated learning model is tested using a test set as described in step seven.
Citation Information
Cited By
Tag distribution drift adaptive high-dimensional data feature filtering method and system based on federated learning
CN120236157A