A static identification method of software defects based on machine learning
Through the determination and preprocessing method based on the program length and sample quality evaluation coefficient of the software defect code, combined with the long short-term memory network and AST/PDG technology, the problem of low accuracy of software defect identification in the existing technology is solved, and the accuracy of the model is improved. Recognition accuracy and efficiency.
Patent Information
- Application Number
- CN202410416627.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-04-08
AI Technical Summary
In the existing technology, due to the small proportion of defective codes in a single sample in the data set, the generalization ability of machine learning is poor and the accuracy of software defect identification is low.
By obtaining the software defect code data set, the judgment method and preprocessing method are determined based on the program length and sample quality evaluation coefficient, long and short-term memory network training and testing are used, the model parameters are adjusted to improve the recognition accuracy, and preprocessing is performed through AST and PDG to identify and fix defects.
Effectively filter out samples with shorter code lengths, improve processing speed and recognition accuracy, optimize resource usage, improve the model's ability to identify defective codes, and enhance generalization capabilities and identification efficiency.
Smart Images

Figure CN118277264B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and in particular to a method for statically identifying software defects based on machine learning. Background Art
[0002] Among the existing software defect identification technologies, a common method is to use machine learning technology to analyze and learn software codes to identify defects. However, the effectiveness of this method is often limited by the quality and quantity of the training data set. Since the defect code accounts for a small proportion of the entire data set, the machine learning model does not learn and understand the defect code sufficiently during the training process, which affects the recognition effect of software defects. In addition, due to the wide variety of software defects, different types of defects may require different identification methods, which limits the versatility and accuracy of software defect identification methods based on machine learning in practical applications. Therefore, how to effectively identify and classify software defects and improve the accuracy and efficiency of software defect identification is an important issue currently facing the field of software engineering.
[0003] The Chinese patent application publication number: CN105653444A discloses a method and system for identifying software defect faults based on Internet log data; collecting log data, the log data includes Internet source system log data and user system source log data: collecting Internet logs from various sources from the Internet, cleaning, filtering and storing these logs; the Internet logs from various sources include log data in a software defect library, log data from a question-and-answer website, log data in a mailing list, etc.; collecting user system source log data and preprocessing it, including: preliminary cleaning, sorting and structured storage; extracting text features of the Internet source system log data and the user system source log data respectively and extracting feature vectors; establishing a software defect fault log identification prediction model based on the text feature vectors of the Internet source system log data through an offline method; according to the software defect fault log identification prediction model, the text feature vectors of the user system source log data are identified online through classification and labeling to obtain the user system log segment type; collecting the user system log segment type and the intermediate results of the online identification process, further identifying the user system log segment, obtaining the relevant software defect report link and verifying the validity of the identification result.
[0004] It can be seen that the existing technology has the following problems: due to the small proportion of defective code in a single sample in the data set, the generalization ability of machine learning is poor and the accuracy of software defect identification is low. Summary of the invention
[0005] To this end, the present invention provides a static software defect identification method based on machine learning to overcome the problem in the prior art that the generalization ability of machine learning is poor and the accuracy of software defect identification is low due to the small proportion of defective code in a single sample in the data set.
[0006] To achieve the above object, the present invention provides a method for statically identifying software defects based on machine learning, comprising:
[0007] Obtain a software defect code data set, and traverse the software defect code samples in the software defect code data set;
[0008] Determining the judgment of the single software defect code sample according to the program length of the single software defect code sample;
[0009] Determining a determination method for determining a single software defect code sample according to a first relative difference between the program length and a preset program length, so as to determine preprocessing of the single software defect code sample;
[0010] Determining a sample quality assessment coefficient of a single software defect code sample, and determining a preprocessing method for preprocessing the single software defect code sample according to the sample quality assessment coefficient;
[0011] Train the LSTM network based on the traversed software defect code dataset, and test the trained LSTM network based on the test set;
[0012] Determine the adjustment of the preset program length according to the accuracy of the long short-term memory network for software defect recognition on the test set, or determine the correction of the preset sample quality assessment coefficient according to a second relative difference between the accuracy and the first preset accuracy;
[0013] The determining of the determination of the single software defect code sample includes determining the single software defect code sample under the condition that the program length of the single software defect code sample is greater than a preset program length;
[0014] The determining of adjusting the preset program length includes adjusting the coefficient Adjust the preset program length;
[0015] The determining of the correction of the preset sample quality assessment coefficient includes: under the condition that the second relative difference is greater than the preset second relative difference, using the correction coefficient Modify the preset sample quality assessment coefficient;
[0016] Among them, Q represents the accuracy, Indicates the first preset accuracy.
[0017] Furthermore, the determination method for determining the single software defect code sample includes determining whether to preprocess the single software defect code sample according to the symbol table vocabulary of the single software defect code sample under the condition that the first relative difference is less than or equal to a first preset relative difference.
[0018] Furthermore, the determination method for determining the single software defect code sample includes determining whether to pre-process the single software defect code sample according to the program capacity of the single software defect code sample under the condition that the first relative difference is greater than a first preset relative difference.
[0019] Further, determining whether to preprocess the single software defect code sample according to the symbol table vocabulary of the single software defect code sample includes preprocessing the single software defect code sample under the condition that the symbol table vocabulary of the single software defect code sample is greater than a preset symbol table vocabulary.
[0020] Further, determining whether to pre-process the single software defect code sample according to the program capacity of the single software defect code sample includes pre-processing the single software defect code sample under the condition that the program capacity of the single software defect code sample is greater than a preset program capacity.
[0021] Furthermore, the sample quality assessment coefficient of the single software defect code sample is calculated according to the following formula:
[0022]
[0023] Among them, X represents the sample quality assessment coefficient, L represents the vocabulary of the symbol table, represents the preset symbol table vocabulary, R represents the program capacity, Indicates the preset program capacity.
[0024] Furthermore, the preprocessing method for determining to preprocess a single software defect code sample includes generating an AST of a single software defect code sample under the condition that a sample quality assessment coefficient is less than or equal to a preset sample quality assessment coefficient, locating the node where the defect is located, extracting a subtree related to the node where the defect is located, and deleting other irrelevant parts of the single software defect code sample.
[0025] Furthermore, the method of determining the preprocessing method for preprocessing a single software defect code sample includes constructing a PDG of the single software defect code sample under the condition that the sample quality assessment coefficient is greater than a preset sample quality assessment coefficient, and cutting out code fragments directly related to the defect.
[0026] Compared with the prior art, the beneficial effect of the present invention lies in that the present invention determines whether to judge a single software defect code sample based on the comparison result of the program length of the single software defect code sample with a preset program length to effectively filter out samples with shorter code length and less likely to contain defects, reduce the amount of data that the model needs to process, and improve the processing speed. Generally, longer codes are more likely to contain defects because they are often more complex and have more logical branches and interactions. The model concentrates on learning those code snippets that are more likely to have problems, thereby improving the model's ability to recognize defective codes.
[0027] Furthermore, the present invention determines a determination method for determining a single software defect code sample based on a comparison result of the first relative difference with a first preset relative difference, so as to optimize the determination and preprocessing steps according to the characteristics of the code sample, thereby improving the overall accuracy and efficiency. By reasonably allocating determination methods to optimize resource usage while ensuring the recognition effect, unnecessary preprocessing steps are reduced, and the relevance and effectiveness of preprocessing are improved. The complexity of the code is positively correlated with the number and severity of its potential defects. By distinguishing code samples with different processing complexities, defects in high-complexity codes can be more effectively identified and repaired.
[0028] Furthermore, the present invention determines whether to preprocess a single software defect code sample to reveal more information about the code structure and semantics based on a comparison result of the symbol table vocabulary of the single software defect code sample with a preset symbol table vocabulary, thereby helping to improve the accuracy of defect identification and avoiding the introduction of unnecessary noise and errors due to excessive processing.
[0029] Furthermore, the present invention determines whether to preprocess a single software defect code sample based on a comparison result of the program capacity of the single software defect code sample with a preset program capacity so as to more accurately determine which code samples are complex enough to benefit from preprocessing, thereby improving the generalization ability of the model in different environments and improving the relevance and effectiveness of the preprocessing.
[0030] Furthermore, the present invention calculates the sample quality assessment coefficient of a single software defect code sample according to a formula to accurately determine the proportion of the defect code in the single software defect code sample in the entire sample.
[0031] Furthermore, the present invention determines a preprocessing method for preprocessing a single software defect code sample based on a comparison result of the sample quality assessment coefficient and a preset sample quality assessment coefficient to more accurately determine which code samples are complex enough to help reduce unnecessary preprocessing, while ensuring that complex codes are properly processed, while saving computing resources and speeding up the entire defect identification process.
[0032] Furthermore, the present invention determines whether to adjust the preset program length based on the comparison result of the accuracy of software defect recognition of the long short-term memory network with the preset accuracy, which helps to continuously optimize the model to adapt to the changes in the data set or the performance of the model in actual applications, ensures that the purpose of model adjustment is to achieve or maintain a higher accuracy, avoids unnecessary adjustments that may cause fluctuations or degradation of model performance, and can adjust key parameters according to the performance of the model on a specific data set, so that the model is more adapted to the characteristics of the data set, thereby possibly improving the performance on the data set, and calculates the adjustment coefficient through a formula to accurately adjust the preset program length.
[0033] Furthermore, the present invention determines whether to correct the preset sample quality assessment coefficient based on the comparison result of the second relative difference with the preset second relative difference, so as to further achieve more accurate model optimization, further improve the accuracy of the model and maintain the stability of the model, while reducing unnecessary computational overhead, which helps to improve the generalization ability of the model on unknown data, and calculates the correction coefficient through the formula to accurately correct the preset sample quality assessment coefficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 This is a flowchart of a method for statically identifying software defects based on machine learning according to an embodiment of the present invention;
[0035] Figure 2 A logic block diagram of the determination process of the method for statically identifying software defects based on machine learning in an embodiment of the present invention;
[0036] Figure 3 A logic block diagram of the preprocessing process of the static software defect identification method based on machine learning in an embodiment of the present invention;
[0037] Figure 4 The present invention is a logic block diagram of the adjustment process of the static software defect identification method based on machine learning according to an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0039] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.
[0040] See also Figure 1-Figure 4 As shown, Figure 1 This is a flowchart of a method for statically identifying software defects based on machine learning according to an embodiment of the present invention; Figure 2A logic block diagram of the determination process of the method for statically identifying software defects based on machine learning in an embodiment of the present invention; Figure 3 A logic block diagram of the preprocessing process of the static software defect identification method based on machine learning in an embodiment of the present invention; Figure 4 The present invention is a logic block diagram of the adjustment process of the static software defect identification method based on machine learning according to an embodiment of the present invention.
[0041] The static software defect identification method based on machine learning in the embodiment of the present invention includes:
[0042] Step S1, obtaining a software defect code data set, and traversing software defect code samples in the software defect code data set;
[0043] Step S2, determining the judgment of the single software defect code sample according to the program length D of the single software defect code sample;
[0044] Step S3, according to the program length D and the preset program length The first relative difference ΔD determines a determination method for determining a single software defect code sample, so as to determine a preprocessing of the single software defect code sample;
[0045] Step S4, determining a sample quality assessment coefficient X of a single software defect code sample, and determining a preprocessing method for preprocessing the single software defect code sample according to the sample quality assessment coefficient X;
[0046] Step S5, training the long short-term memory network according to the traversed software defect code data set, and testing the trained long short-term memory network according to the test set;
[0047] Step S6, determining the preset program length according to the accuracy Q of the long short-term memory network in identifying software defects on the test set or, according to the accuracy Q and the first preset accuracy The second relative difference △Q determines the preset sample quality assessment coefficient correction.
[0048] In the embodiment of the present invention, the long short-term memory network is preferably LSTM.
[0049] Specifically, the embodiment of the present invention is based on the program length D of a single software defect code sample and the preset program length Determine whether to make a judgment on a single software defect code sample based on the comparison result;
[0050] When D≤ When , it is determined that no single software defect code sample will be judged;
[0051] When D> When , it is determined to judge a single software defect code sample;
[0052] In the embodiment of the present invention, the program length D is the sum of the total number of operators and the total number of operands in a single software defect code sample. The preset program length is the average program length of the software defect code samples in the software defect code dataset. Those skilled in the art can preset the program length according to the specific situation. Make adjustments.
[0053] Specifically, the present invention determines whether to judge a single software defect code sample based on the comparison result of the program length of the single software defect code sample with a preset program length to effectively filter out samples with shorter code length and less likely to contain defects, reduce the amount of data that the model needs to process, and improve the processing speed. Generally, longer codes are more likely to contain defects because they are often more complex and have more logical branches and interactions. The model focuses on learning those code snippets that are more likely to have problems, thereby improving the model's ability to identify defective codes.
[0054] Specifically, when determining to judge a single software defect code sample, the program length D and the preset program length D are calculated. The first relative difference △D of the first relative difference △D and the first preset relative difference △D are respectively The comparison results determine the judgment method for a single software defect code sample, setting △D = (D- ) / ;
[0055] When △D≤△ , it is determined to judge the single software defect code sample in the first judging mode;
[0056] When △D>△ , it is determined to judge the single software defect code sample in the second judgment mode;
[0057] Wherein, the first determination method is to determine whether to preprocess the single software defect code sample according to the symbol table vocabulary L of the single software defect code sample;
[0058] The second determination method is to determine whether to pre-process the single software defect code sample according to the program capacity R of the single software defect code sample;
[0059] In the embodiment of the present invention, the first preset relative difference △ The value is 0.3, the first preset relative difference △ The program length D is the preset program length The first preset relative difference △ Make adjustments.
[0060] Specifically, the present invention determines a determination method for determining a single software defect code sample based on a comparison result of the first relative difference with a first preset relative difference, so as to optimize the determination and preprocessing steps according to the characteristics of the code sample, thereby improving the overall accuracy and efficiency. By reasonably allocating determination methods to optimize resource usage while ensuring the recognition effect, unnecessary preprocessing steps are reduced, and the relevance and effectiveness of preprocessing are improved. The complexity of the code is positively correlated with the number and severity of its potential defects. By distinguishing code samples with different processing complexities, defects in high-complexity codes can be more effectively identified and repaired.
[0061] Specifically, when it is determined to judge a single software defect code sample in the first judgment mode, the symbol table vocabulary L of the single software defect code sample is compared with the preset symbol table vocabulary L. Determine whether to pre-process a single software defect code sample based on the comparison result;
[0062] When L≤ When , it is determined that no preprocessing is performed on the single software defect code sample;
[0063] When L> When , it is determined to pre-process a single software defect code sample;
[0064] In the embodiment of the present invention, the symbol table vocabulary L is the sum of the number of different operators and the number of operands in a single software defect code sample. is the average symbol table vocabulary size of the software defect code samples in the software defect code dataset. Those skilled in the art may preset the symbol table vocabulary size according to the specific situation. Make adjustments.
[0065] Specifically, the present invention determines whether to preprocess a single software defect code sample to reveal more information about the code structure and semantics based on the comparison result of the symbol table vocabulary of the single software defect code sample with the preset symbol table vocabulary, thereby helping to improve the accuracy of defect identification and avoid introducing unnecessary noise and generating errors due to excessive processing.
[0066] Specifically, when it is determined to judge a single software defect code sample in the second judgment mode, according to the program capacity R of the single software defect code sample and the preset program capacity Determine whether to pre-process a single software defect code sample based on the comparison result;
[0067] When R≤ When , it is determined that no preprocessing is performed on the single software defect code sample;
[0068] When R> When , it is determined to pre-process a single software defect code sample;
[0069] In the embodiment of the present invention, the program capacity R=D×logL, and the preset program capacity is the average program capacity of the software defect code samples in the software defect code data set. Those skilled in the art may preset the program capacity according to the specific situation. Make adjustments.
[0070] Specifically, the present invention determines whether to preprocess a single software defect code sample based on a comparison result of the program capacity of the single software defect code sample with a preset program capacity so as to more accurately determine which code samples are complex enough to benefit from preprocessing, thereby improving the generalization ability of the model in different environments and improving the relevance and effectiveness of the preprocessing.
[0071] Specifically, when it is determined to pre-process a single software defect code sample, the sample quality assessment coefficient X of the single software defect code sample is calculated and set;
[0072] ;
[0073] Among them, X represents the sample quality assessment coefficient, L represents the vocabulary of the symbol table, represents the preset symbol table vocabulary, R represents the program capacity, Indicates the preset program capacity.
[0074] Specifically, the present invention calculates the sample quality assessment coefficient of a single software defect code sample according to a formula to accurately determine the proportion of the defect code in the single software defect code sample in the entire sample.
[0075] Specifically, when the sample quality assessment coefficient X of a single software defect code sample is calculated, the sample quality assessment coefficient X and the preset sample quality assessment coefficient X are used to calculate the sample quality assessment coefficient X. The comparison result determines the preprocessing method for preprocessing a single software defect code sample;
[0076] When X≤ , it is determined to preprocess the single software defect code sample in a first preprocessing manner;
[0077] When X> , it is determined to preprocess the single software defect code sample in a first preprocessing manner;
[0078] Among them, the first preprocessing method is to generate an AST of a single software defect code sample, locate the node where the defect is located, extract the subtree related to the node where the defect is located, and delete other irrelevant parts in the single software defect code sample.
[0079] The second preprocessing method is to construct a PDG of a single software defect code sample and cut out the code fragments directly related to the defect.
[0080] In the embodiment of the present invention, the sample quality assessment coefficient is preset The value is 0.76, and the sample quality assessment coefficient is preset The symbol table vocabulary L is a preset symbol table vocabulary 130% of the program capacity R and the program capacity R is the preset program capacity The sample quality assessment coefficient can be set according to the specific situation. Make adjustments.
[0081] Specifically, the present invention determines a preprocessing method for preprocessing a single software defect code sample based on a comparison result of the sample quality assessment coefficient and a preset sample quality assessment coefficient to more accurately determine which code samples are complex enough to help reduce unnecessary preprocessing, while ensuring that complex codes are properly processed, while saving computing resources and speeding up the entire defect identification process.
[0082] Specifically, the embodiment of the present invention determines whether to use the preset program length according to the comparison result of the accuracy rate Q of the long short-term memory network for software defect recognition and the preset accuracy rate. Adjustment is made, wherein the preset accuracy rate includes a first preset accuracy rate And the second preset accuracy ;
[0083] When Q< When the preset program length is determined Make adjustments;
[0084] when ≤Q≤ , then according to the accuracy Q and the first preset accuracy The second relative difference △Q determines the preset sample quality assessment coefficient amendments;
[0085] When Q> When the preset program length is Make adjustments;
[0086] In the embodiment of the present invention, the first preset accuracy The value is 0.6, the second preset accuracy The value is 0.9. Those skilled in the art can adjust the first preset accuracy according to the specific situation. And the second preset accuracy Make adjustments.
[0087] Specifically, when determining the preset program length When making adjustments, adjust the preset program length according to the following adjustment factor T: To adjust, set:
[0088] ;
[0089] Set the adjusted preset program length to .
[0090] Specifically, the present invention determines whether to adjust the preset program length based on the comparison result of the accuracy of software defect recognition of the long short-term memory network with the preset accuracy, which helps to continuously optimize the model to adapt to the changes in the data set or the performance of the model in actual applications, ensures that the purpose of model adjustment is to achieve or maintain a higher accuracy, avoids unnecessary adjustments that may cause fluctuations or degradation of model performance, and can adjust key parameters according to the performance of the model on a specific data set, so that the model is more adapted to the characteristics of the data set, thereby possibly improving the performance on the data set, and calculates the adjustment coefficient through a formula to accurately adjust the preset program length.
[0091] Specifically, when determining the preset sample quality assessment coefficient When the second relative difference △Q is corrected, the second relative difference △ The comparison result determines whether to use the preset sample quality assessment coefficient Make corrections and set △Q = (Q- ) / ;
[0092] When △Q≤△ When , it is determined that the preset sample quality assessment coefficient is not make corrections;
[0093] When △Q>△ When , the quality assessment coefficient of the preset sample is determined make corrections;
[0094] In the embodiment of the present invention, the second relative difference △ is preset The value is 0.25, and the second relative difference △ is preset The second relative difference △ is obtained when the accuracy rate Q is 0.75. Those skilled in the art can set the preset second relative difference △ according to the specific situation. Make adjustments.
[0095] Specifically, when determining the preset sample quality assessment coefficient When making corrections, the preset sample quality assessment coefficient is adjusted according to the following correction coefficient Z To make corrections, set:
[0096] ;
[0097] Set the modified preset sample quality assessment coefficient to .
[0098] Specifically, the present invention determines whether to correct the preset sample quality assessment coefficient based on the comparison result of the second relative difference with the preset second relative difference, so as to further achieve more accurate model optimization, further improve the accuracy of the model and maintain the stability of the model, while reducing unnecessary computational overhead, which helps to improve the generalization ability of the model on unknown data, and calculates the correction coefficient through the formula to accurately correct the preset sample quality assessment coefficient.
[0099] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
[0100] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A static software defect identification method based on machine learning, characterized in that: include: Obtain a software defect code data set, and traverse the software defect code samples in the software defect code data set; Determining the judgment of the single software defect code sample according to the program length of the single software defect code sample; Determining a determination method for determining a single software defect code sample according to a first relative difference between the program length and a preset program length, so as to determine preprocessing of the single software defect code sample; Determining a sample quality assessment coefficient of a single software defect code sample, and determining a preprocessing method for preprocessing the single software defect code sample according to the sample quality assessment coefficient; Train the LSTM network based on the traversed software defect code dataset, and test the trained LSTM network based on the test set; Determine the adjustment of the preset program length according to the accuracy of the long short-term memory network for software defect recognition on the test set, or determine the correction of the preset sample quality assessment coefficient according to a second relative difference between the accuracy and the first preset accuracy; The determining of the determination of the single software defect code sample includes determining the single software defect code sample under the condition that the program length of the single software defect code sample is greater than a preset program length; The determining of adjusting the preset program length includes adjusting the coefficient Adjust the preset program length; The determining of the correction of the preset sample quality assessment coefficient includes: under the condition that the second relative difference is greater than the preset second relative difference, using the correction coefficient Modify the preset sample quality assessment coefficient; Among them, Q represents the accuracy, Indicates the first preset accuracy.
2. The method for statically identifying software defects based on machine learning according to claim 1, characterized in that: The determination method for determining the single software defect code sample includes determining whether to preprocess the single software defect code sample according to the symbol table vocabulary of the single software defect code sample under the condition that the first relative difference is less than or equal to a first preset relative difference.
3. The method for statically identifying software defects based on machine learning according to claim 2, characterized in that: The determination method for determining the single software defect code sample includes determining whether to pre-process the single software defect code sample according to the program capacity of the single software defect code sample under the condition that the first relative difference is greater than a first preset relative difference.
4. The method for statically identifying software defects based on machine learning according to claim 3, characterized in that: Determining whether to preprocess the single software defect code sample according to the symbol table vocabulary of the single software defect code sample includes preprocessing the single software defect code sample under the condition that the symbol table vocabulary of the single software defect code sample is greater than a preset symbol table vocabulary.
5. The method for statically identifying software defects based on machine learning according to claim 4, characterized in that: Determining whether to pre-process the single software defect code sample according to the program capacity of the single software defect code sample includes pre-processing the single software defect code sample under the condition that the program capacity of the single software defect code sample is greater than a preset program capacity.
6. The method for statically identifying software defects based on machine learning according to claim 5, characterized in that: The sample quality assessment coefficient of the single software defect code sample is calculated according to the following formula: , Among them, X represents the sample quality assessment coefficient, L represents the vocabulary of the symbol table, represents the preset symbol table vocabulary, R represents the program capacity, Indicates the preset program capacity.
7. The method for statically identifying software defects based on machine learning according to claim 6, characterized in that: The method for determining the preprocessing of a single software defect code sample includes generating an AST of the single software defect code sample under the condition that the sample quality assessment coefficient is less than or equal to a preset sample quality assessment coefficient, locating the node where the defect is located, extracting the subtree related to the node where the defect is located, and deleting other irrelevant parts in the single software defect code sample.
8. The method for statically identifying software defects based on machine learning according to claim 7, characterized in that: The method of determining the preprocessing method for preprocessing a single software defect code sample includes constructing a PDG of the single software defect code sample under the condition that the sample quality assessment coefficient is greater than a preset sample quality assessment coefficient, and cutting out code fragments directly related to the defect.
