A software defect prediction method and system based on information entropy oversampling

Through the oversampling method based on information entropy, the class imbalance and class overlap problems in software defect prediction are solved, and the performance improvement of the software defect prediction model and the testing efficiency are improved.

CN114490386BActive Publication Date: 2025-02-14ANHUI UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210093923.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-26
Publication Date
2025-02-14
Estimated Expiration
2042-01-26

AI Technical Summary

Technical Problem

There are problems of class imbalance and class overlap in the prior art, which adversely affects the classification model of software defect prediction, resulting in poor software defect prediction effect.

Method used

Using an oversampling method based on information entropy, by calculating the class deterministic entropy of most class samples and minority classes, the samples are divided into safe samples, critical samples and dangerous samples, the hazardous samples in most class samples are cleared, and the minority classes are constrained. The local neighborhood of the key samples in the sample is obtained to obtain the balanced training set and train the software defect prediction model.

Benefits of technology

It effectively reduces the impact of class overlap on classification, avoids overfitting caused by oversampling, enhances the local class certainty of the sample, and improves the accuracy and testing efficiency of software defect prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490386B_ABST
    Figure CN114490386B_ABST
Patent Text Reader

Abstract

The present invention provides a software defect prediction method and system based on information entropy oversampling, the method comprising: obtaining a software defect data set; dividing the data set into a training set and a test set, and calculating the class deterministic entropy of the majority class samples and the minority class samples in the training set; dividing the majority class samples and the minority class samples into safe samples, key samples, and dangerous samples according to the class deterministic entropy, and selecting the minority class key samples as seed samples; removing the majority class dangerous samples; constraining oversampling of the local neighborhood of the minority class key samples; training the software defect prediction model with a new balanced training set, and testing the test set. The present invention solves the technical problem that the class imbalance and class overlap problems existing in the prior art have an adverse effect on the classification model, resulting in poor software defect prediction effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of software defect prediction, and relates to a software defect prediction method and system based on information entropy oversampling. Background Art

[0002] Software defects refer to defects, errors or failures in software systems. Their existence will cause software systems to fail, thus affecting the quality of software products. With the widespread application of software systems in various industries such as banks, hospitals, and flight control, it is particularly important to provide defect-free software products. Software defect prediction refers to the technology of mining undiscovered defects and their distribution in software projects based on historical data of software projects and discovered defects, using statistical learning or machine learning techniques. It can effectively improve the quality of software, better meet user needs, and reduce the cost of software development, which is of great significance to the software development process.

[0003] However, 80% of defects are often concentrated in 20% of program modules, and the defect data is unevenly distributed. The number of defective modules (i.e., minority class samples) in the data set is significantly less than that of defect-free modules (i.e., majority class samples). The distribution of software defect data is highly skewed, and such data is usually referred to as class-imbalanced data. The invention patent No. 201510107598.9, "A Signal Detection Method Based on Oversampling", oversamples the communication signal; performs different time bias processing on the oversampled samples, and then weights and fuses the processing results to obtain the detection statistics of the method. The model trained on defect data by traditional machine learning algorithms generally tends to favor defect-free modules and ignores defective modules, thereby hindering the application of such models in practice. There are technical problems in the prior art that class imbalance and class overlap problems have an adverse effect on the classification model, resulting in poor software defect prediction results. Summary of the invention

[0004] The technical problem to be solved by the present invention is how to solve the technical problem that class imbalance and class overlap problems have an adverse effect on the classification model, resulting in poor software defect prediction effect.

[0005] The present invention adopts the following technical solution to solve the above technical problem: a software defect prediction method based on information entropy oversampling, characterized in that it is applied to software defect prediction, and the method comprises:

[0006] Obtain software defect dataset;

[0007] Divide the data set into a training set and a test set, and calculate the class deterministic entropy of the majority class samples and the minority class samples in the training set;

[0008] Dividing the majority class samples and the minority class samples into safe samples, key samples, and dangerous samples according to the class deterministic entropy, and selecting the minority class key samples as seed samples;

[0009] Eliminating the dangerous samples in the majority class samples and constraining the oversampling of the local neighborhood of the key samples in the minority class samples, thereby obtaining a balanced training set;

[0010] The software defect prediction model is trained using the balanced training set, and the test set is tested accordingly.

[0011] The present invention cleans the defect-free samples in the overlapping area, reduces the influence of class overlap on classification, avoids overfitting caused by subsequent oversampling, and selects defective samples that support the decision boundary for oversampling constrained by local neighborhood information, avoids generating additional samples, and enhances the local class certainty of the samples. When the present invention predicts software defects, it can identify more defects, thereby reasonably allocating test resources and improving test efficiency.

[0012] In a more specific technical solution, the step of dividing the data set into a training set and a test set, and calculating the class deterministic entropy of the majority class samples and the minority class samples in the training set includes:

[0013] The data set is divided into the training set and the test set using the five-fold cross validation method, and each module in the software defect prediction data set is used as a sample. Indicated by X P Represents the minority class samples, with X N represents the majority class sample;

[0014] Calculate the k nearest neighbor distance of the current minority class sample using the Euclidean distance, the formula is as follows;

[0015]

[0016] Calculate the proportion of the number of minority class samples and the proportion of the number of majority class samples according to the k nearest neighbor samples;

[0017] The class deterministic entropy of this minority class sample is calculated using the following logic:

[0018]

[0019]

[0020]

[0021] where p i ,q iare the proportions of the same type and different types respectively. When p i = 0, p i log2 p i = 0, when p i =q i =(k / 2), E max =1;

[0022] Repeat steps S201, S202, and S203 until all minority class samples are calculated. When calculating the deterministic entropy of the majority class samples, it is only necessary to replace p in the judgment condition (2) with i Change to q i .

[0023] The present invention calculates the class deterministic entropy of minority class samples and majority class samples, and can roughly infer the local distribution characteristics of the sample locations according to the entropy value measurement.

[0024] In a more specific technical solution, the step of dividing the majority class samples and the minority class samples into safe samples, key samples, and dangerous samples according to the class deterministic entropy, and selecting the minority class key samples as seed samples includes:

[0025] Get class deterministic entropy threshold data;

[0026] The majority class samples and the minority class samples are processed according to the class deterministic entropy threshold data division;

[0027] When the class deterministic entropy of the majority class samples and the minority class samples satisfies:

[0028] 0≤E(x i )≤α (5)

[0029] , classifying the current sample as the safe sample;

[0030] When the class deterministic entropy of the majority class samples and the minority class samples satisfies:

[0031] α <E(x i )<β (6)

[0032] , dividing the current sample into the key sample;

[0033] When the class deterministic entropy of the majority class samples and the minority class samples satisfies:

[0034] β≤E(x i )≤2E max (7)

[0035] , classifying the current sample as the dangerous sample;

[0036] The key samples of the minority class are used as the seed samples.

[0037] In a more specific technical solution, the step of removing the dangerous samples from the majority class samples and constraining the oversampling of the local neighborhood of the key samples from the minority class samples to obtain a balanced training set includes:

[0038] Get the majority class cleaning threshold γ;

[0039] Traverse the dangerous samples in the majority class The majority class samples whose entropy value is greater than or equal to the threshold γ are deleted according to the following logic:

[0040]

[0041] To obtain the clean majority class samples;

[0042] constraining the local neighborhood of the key sample in the minority class sample to oversample, thereby obtaining the oversampled minority class sample;

[0043] The balanced training set is obtained according to the cleaned majority class samples and the oversampled minority class samples.

[0044] Alternatively, taking the minority class as an example, the former is in an area where the minority class is densely distributed and is relatively easy to classify, while the latter is likely to be in an area where the majority class is densely distributed and is more difficult to classify. Conversely, for the majority class, the former is in an area where the majority class is densely distributed, while the latter is in an area where the minority class is densely distributed.

[0045] The present invention cleans the majority class samples that penetrate into the minority class area, which can effectively improve the effectiveness of subsequent sampling and the performance of the model. In order to avoid synthesizing additional samples, the local neighborhood information is used to constrain the location of minority class sample synthesis. On the one hand, it prevents the generated samples from extending back into the majority class area. On the other hand, synthesizing samples near the seed samples can enhance the class certainty of the samples, allowing the classifier to better learn the samples.

[0046] In a more specific technical solution, the step of constraining oversampling the local neighborhood of the key sample in the minority class sample to obtain the oversampled minority class sample comprises:

[0047] Use the following logic to find the nearest majority class distance d of the majority class sample closest to the current key sample: i :

[0048]

[0049] Find the key sample x using the following logic: iThe distance among the nearest neighbors of the same knn sample is less than or equal to the nearest majority class distance d i and use these samples as auxiliary samples:

[0050]

[0051] The entropy value of the key sample is obtained and used as a weight to process and obtain the number of minority class samples that need to be generated for each key sample.

[0052] Each of the key samples is synthetically processed according to the generated number to obtain a synthetic sample so as to achieve data balance.

[0053] In a more specific technical solution, the step of obtaining and using the entropy value of the key sample as a weight to process and obtain the number of minority class samples that need to be generated for each key sample includes:

[0054] Obtaining an entropy value of the key sample;

[0055] Using the entropy value as a weight;

[0056] Normalizing the weights;

[0057] The weight is calculated according to the following logic to obtain the number of minority class samples that need to be generated for each key sample:

[0058]

[0059] In a more specific technical solution, the step of using the balanced training set to train the software defect prediction model and testing the test set accordingly includes:

[0060] Obtaining and obtaining the software defect prediction model based on the classifier;

[0061] The balanced training set is trained by the software defect prediction model to balance the sample training model;

[0062] The test set is tested using the balanced sample training model.

[0063] In a more specific technical solution, in the step of obtaining and acquiring the software defect prediction model based on the classifier, the software defect prediction model uses a decision tree (DT), a support vector machine (SVM), a random forest (RF), and a multi-layer perceptron (MLP) as a classifier.

[0064] The present invention can improve prediction accuracy, improve software quality and reduce the amount of subsequent maintenance by training a balanced training set and then predicting defects on a test set.

[0065] In a more specific technical solution, a software defect prediction system based on information entropy oversampling is characterized in that it is applied to software defect prediction, and the system includes:

[0066] A data set acquisition module, used to acquire software defect data sets;

[0067] A class deterministic entropy module, used to divide the data set into a training set and a test set, and calculate the class deterministic entropy of the majority class samples and the minority class samples in the training set, the class deterministic entropy module being connected to the data acquisition module;

[0068] A sample division module, used for dividing the majority class samples and the minority class samples into safe samples, key samples, and dangerous samples according to the class deterministic entropy, and selecting the minority class key samples as seed samples, the sample division module being connected to the class deterministic entropy module;

[0069] An oversampling module, used to remove the dangerous samples in the majority class samples and constrain the local neighborhood of the key samples in the minority class samples to obtain a balanced training set, the oversampling module is connected to the sample partitioning module;

[0070] A model training module is used to train a software defect prediction model using the balanced training set to test the test set, and the model training module is connected to the oversampling module.

[0071] Compared with the prior art, the present invention has the following advantages: the present invention can achieve two goals at the same time: one is to clean the defect-free samples in the overlapping area, reduce the impact of class overlap on classification, and avoid overfitting caused by subsequent oversampling; the other is to select defective samples that support the decision boundary for oversampling constrained by local neighborhood information, avoid generating additional samples, and enhance the local class certainty of the samples. When the present invention predicts software defects, it can identify more defects, thereby reasonably allocating test resources and improving test efficiency, solving the technical problem that the class imbalance and class overlap problems existing in the prior art have an adverse effect on the classification model, resulting in poor software defect prediction results. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 A flowchart of a software defect prediction method based on information entropy oversampling proposed by the present invention;

[0073] Figure 2 Schematic diagram of selecting key samples of minority classes in step S3 in an embodiment of the present invention;

[0074] Figure 3 This is a schematic diagram of cleaning dangerous samples in step S4 in an embodiment of the present invention;

[0075] Figure 4 Schematic diagram of local neighborhood constrained oversampling of minority class samples described in step S5 in an embodiment of the present invention. DETAILED DESCRIPTION

[0076] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0077] Example:

[0078] like Figure 1 As shown, a software defect prediction method based on information entropy oversampling provided by an embodiment of the present invention comprises the following steps:

[0079] S1. Obtain software defect dataset;

[0080] S2, divide the data set into a training set and a test set, and calculate the class deterministic entropy of the majority class samples and the minority class samples in the training set;

[0081] S3, dividing the majority class samples and the minority class samples into safe samples, key samples, and dangerous samples according to the class deterministic entropy calculated in the above step S2, and selecting the key minority class samples as seed samples;

[0082] S4, removing most dangerous samples in the above step S3;

[0083] S5, constraining oversampling of the local neighborhood of the key samples of the minority class in step S3;

[0084] S6. Use the new balanced training set to train the software defect prediction model and test the test set.

[0085] In step S1, a data set collected from the PROMISE repository is used. Each data set contains 20 static code metrics that measure sample complexity. In addition, there is a metric that indicates whether the sample is defective. Samples containing one or more defects are marked as defects, and others are marked as non-defective.

[0086] Among them, in step S2, a five-fold cross validation is used to randomly divide the data set into 5 parts, 4 of which are used as training sets and the other one is used as a test set, and each part has only one chance to be used as a test set.

[0087] Imbalanced training set Indicated by X PRepresents minority class samples, with X N Represents the majority class sample. Calculate the class deterministic entropy of the minority class sample and the majority class sample. According to the entropy value measurement, the local distribution characteristics of the sample location can be roughly inferred. For a minority class sample x i , the steps to calculate its class deterministic entropy are as follows:

[0088] S201, calculate the k nearest neighbors of the minority class sample, and the distance adopts the Euclidean distance, and the formula is as follows;

[0089]

[0090] S202, calculating the proportion of the number of minority class samples and the proportion of the number of majority class samples among the k nearest neighbors;

[0091] S203, calculate the class deterministic entropy of the minority class sample using formula (2):

[0092]

[0093]

[0094]

[0095] where p i ,q i are the proportions of the same type and different types respectively. When p i = 0, p i log2 p i = 0, when p i =q i =(k / 2), E max =1.

[0096] S204, repeat steps S201, S202, and S203 until the class deterministic entropy of all minority class samples is calculated. When calculating the class deterministic entropy of the majority class samples, it is only necessary to replace p in the judgment condition (2) with i Change to q i .

[0097] In step S3, we can know that the entropy value of the sample ranges from [0,2E max ], when the k nearest neighbors of a sample are all samples of the same type, the entropy value of the sample is 0, and when its nearest neighbors are all samples of different types, the entropy value of the sample is 2E maxTaking the minority class as an example, the former is in an area where the minority class is densely distributed and is relatively easy to classify, while the latter is likely to be in an area where the majority class is densely distributed and is more difficult to classify. Conversely, for the majority class, the former is in an area where the majority class is densely distributed, while the latter is in an area where the minority class is densely distributed. In recent years, studies have shown that cleaning the majority class samples that go deep into the minority class area can effectively improve the effectiveness of subsequent sampling and improve the performance of the model.

[0098] Therefore, the following definition is given according to the entropy value:

[0099] Safety sample: 0≤E(x i )≤α (5)

[0100] Key sample: α <E(x i )<β (6)

[0101] Dangerous sample: β≤E(x i )≤2E max (7)

[0102] Given a set of parameters (α, β), the samples can be divided into three sets according to the formula. Different samples are located in different areas, and their influence on the classification model is also different. It represents a collection of three different samples: minority class samples and majority class samples, and selects minority class key samples as seed samples.

[0103] example: Figure 2 It shows a schematic diagram of selecting key samples of the minority class. Assuming that k = 6 for calculating the class deterministic entropy, the class deterministic entropy of the majority class and minority class samples is calculated first. Here α is set to 0. Assuming β = 1.0817, the black points in the figure are the selected key samples of the minority class.

[0104] Among them, in step S4, considering that most software defect datasets are class-imbalanced and class-overlapping, some studies have pointed out that compared with class imbalance, class overlap has a greater impact on the performance of the classifier. A recent study focused on removing majority class samples from overlapping areas without rebalancing the data, and the performance of the model was significantly improved. Therefore, in order to improve the performance of the model, cleaning majority class samples from overlapping areas is a reasonable means.

[0105] Given a threshold γ, the majority class cleaning method is defined as follows: for dangerous samples in the majority class By deleting samples whose entropy values ​​are greater than or equal to , we can get a deleted sample set:

[0106]

[0107] γ is the threshold used to control the number of samples deleted from the majority class. The larger the γ, the fewer samples are deleted, and the smaller the γ, the more samples are deleted.

[0108] example: Figure 3 It is a schematic diagram of cleaning dangerous samples in step S4. Assuming that k=6 for calculating the class deterministic entropy and γ=1.0817, the black points in the figure are the majority class dangerous samples that need to be deleted.

[0109] Among them, in step S5, after executing step S4, a training set with a lower balance rate can be obtained. At this time, the key samples of the minority class with a threshold of β are selected as seed samples. The synthesized samples of SMOTE and SMOTE variants are blind, and the generated samples may fall within the majority class sample area. In order to avoid synthesizing additional samples, the local neighborhood information is used to constrain the position of the minority class sample synthesis. On the one hand, it avoids the generated samples from extending back into the majority class area. On the other hand, synthesizing samples near the seed samples can enhance the class certainty of the samples, so that the classifier can better learn this sample. Here, only the key samples are oversampled, and the SMOTE linear interpolation method is still used to synthesize the samples. The selection of another auxiliary sample for the seed sample determines the quality of the synthesized sample. For each seed sample x in the key sample set, i ,Further, the oversampling steps are as follows:

[0110] S501, first find the distance of the majority class sample closest to this sample:

[0111]

[0112] S502, find sample x i The distance between the nearest neighbors of the same knn sample is less than or equal to d i A sample collection of:

[0113]

[0114] S503, based on the entropy value of the sample as a weight to determine the number of samples that should be generated for each key sample, the sample with a larger entropy value is given a larger weight. First, the weight of the sample is normalized, and then the number of minority class samples that need to be generated for each sample can be obtained:

[0115]

[0116] where |X P | represents the minority class samples, |X N | represents the number of majority class samples remaining after cleaning the overlapping areas.

[0117] S504, using SMOTE to synthesize new samples for each key sample, including the following steps:

[0118] Take this key sample as the seed sample x i ;

[0119] Randomly select an auxiliary sample x from the sample set obtained from S02 n ;

[0120] Randomly generate new defective samples on the linear connection line of the above two samples;

[0121] Repeat steps a, b, and c until the sample generates the required number of samples.

[0122] The calculation formula for generating new samples is:

[0123] x new =x i +random(0,1)×dif(x n -x i ) (12)

[0124] In the formula, x new A newly generated defect sample.

[0125] example: Figure 4 The diagram shows the oversampling of the local neighborhood of the key sample, where the black dots are the key samples of the minority class obtained in step S3. After executing step S4, the key samples of the minority class can be oversampled. Assuming that point A is selected as the seed sample from the key samples of the minority class, the nearest majority class sample C can be found at this time. Assuming knn = 5, the 5 nearest neighbor samples of the same type of point A within the AC distance are D, E, F, and G. If point D is selected as the auxiliary sample, the newly synthesized minority class sample of A and D is H.

[0126] Among them, in step S6, after executing step S5, a balanced training set can be obtained. The software defect prediction model uses decision tree (DT), support vector machine (SVM), random forest (RF), and multi-layer perceptron (MLP) as classifiers. By training the balanced training set, defects are predicted on the test set.

[0127] In order to illustrate the effectiveness of the method proposed in this invention, multiple indicators are used to evaluate the model performance. The experimental results show that the effects on pd, balance, F-measure, AUC, and MCC are all improved, which shows that this method weakens the interference of class imbalance data on software defect prediction, can improve prediction accuracy, improve software quality, and reduce the amount of later maintenance.

[0128] In summary, the present invention can achieve two goals at the same time: one is to clean the defect-free samples in the overlapping area, reduce the impact of class overlap on classification, and avoid overfitting caused by subsequent oversampling; the other is to select defective samples that support the decision boundary for oversampling constrained by local neighborhood information, avoid generating additional samples, and enhance the local class certainty of the samples. When the present invention predicts software defects, it can identify more defects, thereby reasonably allocating test resources and improving test efficiency, solving the technical problem that the class imbalance and class overlap problems existing in the prior art have an adverse effect on the classification model, resulting in poor software defect prediction results.

[0129] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A software defect prediction method based on information entropy oversampling, characterized in that: Applied to software defect prediction, the method comprises: Obtain software defect dataset; Divide the data set into a training set and a test set, and calculate the class deterministic entropy of the majority class samples and the minority class samples in the training set; The data set is divided into the training set and the test set using a five-fold cross validation method, and each module in the software defect prediction data set is taken as a sample. The unbalanced training set is represented by X, and X is represented by P Represents the minority class samples, with X N represents the majority class sample; Calculate the k nearest neighbor distance of the current minority class sample using the Euclidean distance, the formula is as follows; Calculate the proportion of the number of minority class samples and the proportion of the number of majority class samples according to the k nearest neighbor samples; The class deterministic entropy of this minority class sample is calculated using the following logic: Among them, p i ,q i are the proportions of the same type and different types respectively. When p i = 0, p i log2 p i = 0, when p i =q i =(k / 2), E max =1; After all the minority class samples have been calculated, when calculating the class deterministic entropy of the majority class samples, the p in the judgment condition of formula (2) is replaced by i Adjust to q i ; Dividing the majority class samples and the minority class samples into safe samples, key samples, and dangerous samples according to the class deterministic entropy, and selecting the key samples among the minority class samples as seed samples; Eliminating the dangerous samples in the majority class samples and constraining the oversampling of the local neighborhood of the key samples in the minority class samples, thereby obtaining a balanced training set; The software defect prediction model is trained using the balanced training set, and the test set is tested accordingly.

2. The software defect prediction method based on information entropy oversampling according to claim 1, characterized in that: The step of dividing the majority class samples and the minority class samples into safe samples, key samples, and dangerous samples according to the class deterministic entropy, and selecting the key samples among the minority class samples as seed samples comprises: Get class deterministic entropy threshold data; The majority class samples and the minority class samples are processed according to the class deterministic entropy threshold data division; When the class deterministic entropy of the majority class samples and the minority class samples satisfies: 0≤E(x i )≤α (5) , classifying the current sample as the safe sample; When the class deterministic entropy of the majority class samples and the minority class samples satisfies: a <E(x i )<β (6) , dividing the current sample into the key sample; When the class deterministic entropy of the majority class samples and the minority class samples satisfies: β≤E(x i )≤2E max (7) , classifying the current sample as the dangerous sample; The key samples in the minority class samples are used as the seed samples.

3. The software defect prediction method based on information entropy oversampling according to claim 1, characterized in that: The step of removing the dangerous samples from the majority class samples and constraining the local neighborhood of the key samples from the minority class samples to oversample to obtain a balanced training set includes: Get the majority class cleaning threshold γ; Traverse the dangerous samples in the majority class The majority class samples whose entropy value is greater than or equal to the threshold γ are deleted according to the following logic: To obtain the clean majority class samples; constraining the local neighborhood of the key sample in the minority class sample to oversample, thereby obtaining the oversampled minority class sample; The balanced training set is obtained according to the cleaned majority class samples and the oversampled minority class samples.

4. The software defect prediction method based on information entropy oversampling according to claim 3 is characterized in that: The step of constraining oversampling the local neighborhood of the key sample in the minority class sample to obtain the oversampled minority class sample comprises: Use the following logic to find the nearest majority class distance d of the majority class sample closest to the current key sample: i : Find the key sample x using the following logic: i The distance among the nearest neighbors of the same knn sample is less than or equal to the nearest majority class distance d i and use these samples as auxiliary samples: Obtaining and using the entropy value of the key sample as a weight, and processing the entropy value to obtain the number of minority class samples that need to be generated for each key sample; Each of the key samples is synthetically processed according to the generated number to obtain a synthetic sample so as to achieve data balance.

5. The software defect prediction method based on information entropy oversampling according to claim 4, characterized in that: The step of obtaining and using the entropy value of the key sample as a weight to process and obtain the number of minority class samples that need to be generated for each key sample includes: Obtaining an entropy value of the key sample; Using the entropy value as a weight; Normalizing the weights; The weight is calculated according to the following logic to obtain the number of minority class samples that need to be generated for each key sample:

6. The software defect prediction method based on information entropy oversampling according to claim 4, characterized in that: The step of using the balanced training set to train the software defect prediction model and testing the test set accordingly comprises: Obtaining and obtaining the software defect prediction model based on the classifier; The balanced training set is trained by the software defect prediction model to obtain a balanced sample training model; The test set is tested using the balanced sample training model.

7. The software defect prediction method based on information entropy oversampling according to claim 6, characterized in that: In the step of obtaining and acquiring the software defect prediction model according to the classifier, the software defect prediction model uses a decision tree (DT), a support vector machine (SVM), a random forest (RF), and a multi-layer perceptron (MLP) as a classifier.

8. A software defect prediction system based on information entropy oversampling, used to execute a software defect prediction method based on information entropy oversampling according to any one of claims 1 to 7, characterized in that: Applied to software defect prediction, the system comprises: A data set acquisition module, used to acquire software defect data sets; A class deterministic entropy module, used to divide the data set into a training set and a test set, and calculate the class deterministic entropy of the majority class samples and the minority class samples in the training set, the class deterministic entropy module is connected to the data set acquisition module; A sample division module, used for dividing the majority class samples and the minority class samples into safe samples, key samples, and dangerous samples according to the class deterministic entropy, and selecting the minority class key samples as seed samples, the sample division module being connected to the class deterministic entropy module; An oversampling module, used to remove the dangerous samples in the majority class samples and constrain the local neighborhood of the key samples in the minority class samples to obtain a balanced training set, the oversampling module is connected to the sample partitioning module; A model training module is used to train a software curve prediction model using the balanced training set to test the test set, and the model training module is connected to the oversampling module.

Citation Information

Patent Citations

  • A signal detection method based on oversampling

    CN104767577B

  • Software defect prediction method based on class imbalance learning algorithm

    CN112465040A

  • Software defect prediction method based on sample distribution characteristics and SPY algorithm

    CN113434401A