A software defect prediction method based on multi-dimensional code joint graph representation

CN117215935BActive Publication Date: 2026-09-08NANJING TECH UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311174665.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-12
Publication Date
2026-09-08
Estimated Expiration
2043-09-12

AI Technical Summary

Technical Problem

[0004]本发明所要解决的技术问题是提供基于多维度代码联合图表示的软件缺陷预测方法,借助抽象语法树和程序依赖关系的思想,解决软件缺陷预测中代码缺少程序语法语义和注释之间的关联问题

Benefits of technology

[0040] This invention employs a software defect prediction method based on multi-dimensional code joint graph representation. By leveraging the concepts of Abstract Syntax Trees (ASTs) and Graph Convolutional Neural Networks (GCNs), it addresses the lack of correlation between program syntax, semantics, and comments in software defect prediction. Utilizing the advantages of GCNs, it better captures global information from code segments to construct a GCN prediction model for defect prediction and classification. Specifically, it uses ASTs to obtain rich semantic structure information from program statements, while code comments enhance code interpretability, enabling more efficient communication among developers regarding code details. This improves the accuracy of software defect prediction and provides important parameters for software development teams in project quality assessment and test resource allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117215935B_ABST
    Figure CN117215935B_ABST
Patent Text Reader

Abstract

The application relates to a software defect prediction method based on a multi-dimensional code joint graph representation. First, source code containing a code defect label is submitted to a storage library, the source code in the storage library is decomposed into code content information and code annotation information, then an abstract syntax tree in the code content information is extracted, the abstract syntax tree is traversed, dependent relationship representation data and calling relationship representation data are obtained, word sequences extracted from the code annotation are input into a Word2Vec model together with node sequences of the abstract syntax tree to obtain corresponding word vectors, the word vectors are spliced to obtain a final representation of a graph node, edges are constructed by using the dependent relationship and the calling relationship, complete graph structure representation is obtained, and finally the graph structure representation is input into a graph convolutional neural network (GCN) prediction model to complete the software defect prediction task. The application can better represent code information by means of the advancement and advantages of the graph neural network and the joint graph of the annotation and the code, and the accuracy of the software defect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a software defect prediction method based on multi-dimensional code joint graph representation, belonging to the technical field of software analysis and software defect prediction in software engineering. Background Technology

[0002] With the increasing scale and complexity of software, software quality has become a focal point. Software defects, the antithesis of software quality, threaten it, making the early detection of defective modules a pressing issue. Software defect prediction involves mining historical software repositories, designing intrinsic metrics related to defects, and then using machine learning and other methods to proactively identify and pinpoint defective modules, thereby enabling the rational allocation of limited resources. Software defect prediction has long been a topic of interest for researchers and industry practitioners because knowing the predicted probability of defects helps improve software quality and reduce costs. For example, developers can use software defects to prioritize maintenance tasks, plan activities to reduce technical debt, estimate the cost and required resources for project quality assurance work, and improve the entire development process by understanding the systemic factors that lead to defects. Therefore, software defect prediction is one of the important approaches to software quality assurance. Patents related to software defect prediction include: a software defect prediction model based on deep neural networks and probabilistic decision forests (publication number CN109446090); and a software defect prediction method based on long short-term memory networks and the LASSO algorithm (CN113778862A), etc.

[0003] In recent years, numerous machine learning-based methods and various software metrics have been proposed and applied to software defect prediction. Most existing work attempts to understand program behavior by extracting metric features to understand program semantics, thereby constructing predictive classification models based on software metric features. Software defect prediction aims to predict the probability of defects in software artifacts, typically defects in source code elements of different granularities (e.g., methods, classes, files, components), predicting source code defects by extracting metric features as program representations. However, existing traditional deep learning-based software prediction methods neglect the rich semantic and structural information inherent in source code, and traditional feature extraction methods may fail to capture semantic features reflecting detection patterns effectively. The graph-based semi-supervised learning model proposed by Kipf et al. in 2017 has been widely used for code representation in software defect prediction to address the problem of source code structural semantics. The structural semantics and attributes of source code differ from natural language; traditional defect prediction features may fail to capture defect pattern features well, and some defects in modules may not be caused by code structural errors but by functional errors. In 2018, Xuan Huo et al. embedded code comments into semantic features for software defect prediction, which solved the problem of code function representation to some extent. Summary of the Invention

[0004] The technical problem this invention aims to solve is to provide a software defect prediction method based on multi-dimensional code joint graph representation. By leveraging the concepts of abstract syntax trees and program dependencies, it addresses the issue of missing connections between program syntax semantics and comments in software defect prediction. This effectively improves the prediction efficiency of software defects.

[0005] To address the aforementioned technical problems, the following technical solution is adopted: This invention designs a software defect prediction method based on multi-dimensional code joint graph representation, used to predict code defects and construct a code defect prediction model targeting the content and comments of each software source code in a corresponding code library. The software defect prediction model construction method and model training process include the following steps:

[0006] Step A. Submit the source code information containing class labels to the repository as a code sample. Decompose the code sample into two parts: source code without comments and code comments. The source code without comments usually includes several sub-parts, such as: function and class definitions, variable and constant definitions, control flow statements, error handling and exception handling, etc. Then proceed to Step B.

[0007] Step B. For the two parts mentioned above in the code sample, extract the abstract syntax tree (AST) structure from the source code without comments, obtain the AST nodes, and traverse the AST to obtain the dependency representation data and call relationship representation data. Finally, obtain the feature sequence of its syntax tree nodes, dependency relationships, and call relationship data. Then, extract the word sequence from the code comment text and encode it to obtain the code comment sequence. Then proceed to step C.

[0008] Step C. For the syntax tree nodes and code comment sequences obtained in Step B, the new sequences are transformed into corresponding vectors using the Word2vec model: syntax tree node vector and code comment vector, and then proceed to Step D;

[0009] Step D. For the syntax tree node vector and code comment vector obtained from the code information, concatenate the two into a new node vector as the final node vector representation of the graph structure, and use the dependency and call relationships parsed in steps B1.3 and B1.4 as edges to construct a complete graph structure representation, and then proceed to step E;

[0010] Step E. Input the graph structure representation obtained in Step D into a graph convolutional neural network (GCN). After several convolutional layers, use pooling operations to construct the graph representation. Integrate all the information learned in the network through two fully connected layers. Finally, use a Softmax classifier to output the defect tendency, and then proceed to Step F.

[0011] Step F. Based on the AST word vectors corresponding to the code content and the word vectors corresponding to the code comments, a graph structure prediction model is constructed. The training task is performed on the constructed graph convolutional neural network (GCN) model to optimize the GCN model parameters and obtain the trained GCN prediction model, which is the model for predicting software defects.

[0012] When constructing a software defect prediction model, steps I to III need to be performed.

[0013] Step I. Collect the source code and break it down into modules. First, mark the defective modules in each module. Then proceed to Step II.

[0014] Step II. Divide the labeled dataset into training and test sets, using 70% and 30% of the source code dataset as the training and test sets respectively, and then proceed to Step III;

[0015] Step III. Input the pre-divided dataset into the constructed defect prediction model, allowing the model to learn the relationship between features and labels, and optimize and adjust the model to obtain better prediction results.

[0016] As a preferred technical solution of the present invention: in step B, the abstract syntax tree is extracted and the semantic structure relationship is parsed for the code content information according to step B1 to obtain the control dependency relationship and data dependency relationship; the code comment information is encoded according to step B2.

[0017] As a preferred technical solution of the present invention: In step B1, an abstract syntax tree structure is extracted from the source code content submitted to the code repository, and the structural relationships are parsed to obtain control dependencies and calling relationships, according to the following steps B1.1 to B1.4:

[0018] Step B1.1 The lexical analysis process merges the code content in the source code into tokens according to predetermined rules and removes redundant information such as whitespace and comments in the code statements. Finally, all the synthesized tokens are split into a token list.

[0019] Step B1.2, the syntax analysis process, transforms the list of tokens obtained in step B1.1 into a tree structure, and verifies whether there are any syntax errors, discarding any parts with syntax errors.

[0020] Step B1.3 involves traversing the constructed syntax tree during dependency resolution, calculating the control and data dependencies in the code statements, and obtaining the representation data of the dependencies.

[0021] Step B1.4 involves traversing the constructed syntax tree during call relationship resolution, extracting function call nodes and definition nodes from the syntax tree, constructing the relationship between them, and obtaining representational data of the call relationship.

[0022] As a preferred technical solution of the present invention: In step B2, for the code comments in the source code, the word sequence is extracted using the Natural Language Toolkit (NLTK). The extraction process typically consists of three parts: word segmentation, stemming, and constructing the word sequence, and is performed according to steps B2.1 to B2.2 as follows:

[0023] Step B2.1 performs word segmentation on the comment text of the source code, removing all special characters, punctuation marks, extra spaces, and other content that may interfere with the comment conversion, and then dividing it into word sub-sequences, where each word can be regarded as an element in the sequence;

[0024] Step B2.2 combines the segmented annotation words into a complete word sequence and uses spaces, special markers, and other delimiters to represent the different word element sequences in the sequence.

[0025] As a preferred embodiment of the present invention, step E includes the following steps E1 to E2:

[0026] Step E1. Obtain the adjacency matrix from the complete graph structure representation of the source code. The formula is as follows:

[0027]

[0028] in A represents the adjacency matrix of each node in the graph structure. Note that each node ignores its own characteristics, so an identity matrix I needs to be added. N N is the number of nodes in the graph structure. express The degree matrix is ​​then processed, and then step E2 is performed.

[0029] Step E2. For the adjacency matrix obtained in the graph structure, the propagation model H of the graph convolutional neural network (GCN) from layer l to layer l+1. (l+1) It can be represented as:

[0030]

[0031] in Let W represent the transfer function of the GCN network, σ(·) represent the activation function, which is usually used to enhance the expressive power of the model. (l) H represents the weight matrix. (l) H represents the state information of each layer in the GCN network, l∈{0,1,2,...,L}, where L represents the total number of network layers. (L) =Z (Z is the output of the network model), when l=0, H (0) =X (X is the information representation of each node in the graph structure), and then proceed to step F.

[0032] As a preferred embodiment of the present invention: Step I is performed according to Step I1 to Step I3:

[0033] Step I 1. Collect datasets containing software defects from the company's open-source software projects, bug databases, software defect reports, etc.;

[0034] Step 1.2. Define specific and clear annotation rules for different types of defects in the dataset, such as bugs, errors, and security vulnerabilities;

[0035] Step I 3. The annotator annotates the prepared dataset according to the annotation rules established above, annotating defective modules as 1 and defect-free modules as 0.

[0036] As a preferred embodiment of the present invention: step III is performed according to steps III1 to III2:

[0037] Step III 1. Input the labeled training set into the prediction model, learn the relationship between features and labels through the network model, train the model parameters, and further obtain the trained prediction model;

[0038] Step III 2. Input the labeled test set into the trained prediction model to predict whether there are defects in the input module. Then, optimize and adjust the model according to the test structure to obtain the final prediction model.

[0039] Compared with the prior art, the technical solution of the present invention has the following technical effects:

[0040] This invention employs a software defect prediction method based on multi-dimensional code joint graph representation. By leveraging the concepts of Abstract Syntax Trees (ASTs) and Graph Convolutional Neural Networks (GCNs), it addresses the lack of correlation between program syntax, semantics, and comments in software defect prediction. Utilizing the advantages of GCNs, it better captures global information from code segments to construct a GCN prediction model for defect prediction and classification. Specifically, it uses ASTs to obtain rich semantic structure information from program statements, while code comments enhance code interpretability, enabling more efficient communication among developers regarding code details. This improves the accuracy of software defect prediction and provides important parameters for software development teams in project quality assessment and test resource allocation. Attached Figure Description

[0041] Figure 1 This is a flowchart of a software defect prediction method based on multi-dimensional code joint graph representation designed in this invention.

[0042] Figure 2 This is a schematic diagram of the multi-dimensional code joint graph representation designed in this invention.

[0043] Figure 3 This is a flowchart of the source code processing for the prediction model designed in this invention. Detailed Implementation

[0044] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0045] This invention presents a software defect prediction method based on multi-dimensional code joint graph representation. This method targets various source code information within a codebase and combines this information with corresponding code comments to predict software defects. The flow of the multi-dimensional code joint graph representation software defect prediction model is as follows: Figure 1 and Figure 2 As shown, the specific steps are as follows: steps A through F.

[0046] Step A. Submit the source code information containing class labels to the repository as a code sample. Decompose the code sample into two parts: source code without comments and code comments. The first part usually includes several sub-parts, such as: function and class definitions, variable and constant definitions, control flow statements, error handling and exception handling, etc. Then proceed to Step B.

[0047] It should be noted that the source code submitted to the repository is divided into n modules, X = {x1, x2, ..., x...} n} represents the collection of modules in the repository. This indicates that it contains source code information from the source code. and code comments Where i ∈ {1,...,n}. Furthermore, the source code information can be in various languages ​​such as C++, Java, PHP, and Python.

[0048] Step B. For the two parts mentioned above in the code sample, extract the Abstract Syntax Tree (AST) structure from the source code without comments, obtain the AST nodes, and traverse the AST to obtain the dependency representation data and call relationship representation data. Finally, obtain the feature sequence of its AST nodes, dependencies, and call relationship data. Then, extract the word sequence from the code comment text and encode it to obtain the code comment sequence, and then proceed to Step C.

[0049] In practical applications, the abstract syntax tree is extracted and the semantic structure relationship is parsed for the code content information according to the following step B1 to obtain the control dependency relationship and data dependency relationship. The code comment information is encoded according to the following step B2.

[0050] Step B1. Extract the abstract syntax tree structure from the source code content submitted to the code repository, and parse the structural relationships to obtain the control dependencies and calling relationships, following steps B1.1 to B1.4 below.

[0051] Step B1.1 The lexical analysis process merges the code content in the source code into tokens according to predetermined rules and removes redundant information such as whitespace and comments in the code statements. Finally, all the synthesized tokens are split into a token list.

[0052] Step B1.2, the syntax analysis process, transforms the list of tokens obtained in step B1.1 into a tree structure, and verifies whether there are any syntax errors, discarding any parts with syntax errors.

[0053] Step B1.3 involves traversing the constructed syntax tree during dependency resolution, calculating control and data dependencies in the code statements, and obtaining the representation data of the dependencies.

[0054] Step B1.4 involves traversing the constructed syntax tree during call relationship resolution, extracting function call nodes and definition nodes from the syntax tree, constructing the relationship between them, and obtaining representational data of the call relationship.

[0055] In practical applications, comments in source code are explanatory texts, the purpose of which is to explain the function, implementation method, algorithm, logic, design choices or other relevant information of the code. Therefore, to obtain its sequence, the following step B2 is performed.

[0056] Step B2 targets the code comments in the source code and extracts word sequences from them using the Natural Language Toolkit (NLTK). The extraction process typically consists of three parts: word segmentation, stemming, and constructing word sequences, and is carried out according to steps B2.1 to B2.2 below.

[0057] Step B2.1 performs word segmentation on the comment text of the source code, removing all special characters, punctuation marks, extra spaces, and other content that may interfere with the comment conversion, and then dividing it into word sub-sequences, where each word can be regarded as an element in the sequence;

[0058] Specifically, when segmenting text information in comment text, it can be done based on spaces, punctuation marks, and paragraphs. Words in code comments are often closely related to words in the code content. For example, splitting Get_Support_Action into [Get,Support,Action] can be achieved by segmenting the code comment text into a set of words.

[0059] Step B2.2 combines the segmented annotation words into a complete word sequence and uses spaces, special markers, and other delimiters to represent the different word element sequences in the sequence.

[0060] The NLTK toolkit is a widely used Python library for natural language processing tasks. NLTK provides numerous functions for processing natural language, applicable to tasks such as text processing, language analysis, feature extraction, and language modeling.

[0061] Step C. For the syntax tree nodes and code comment sequences obtained in Step B, the new sequences are transformed into corresponding vectors using the Word2vec model: syntax tree node vector and code comment vector, and then proceed to Step D;

[0062] Step D. For the syntax tree node vector and code comment vector obtained from the code information, concatenate the two into a new node vector as the final node vector representation of the graph structure, and use the dependency and call relationships parsed in steps B1.3 and B1.4 as edges to construct a complete graph structure representation, and then proceed to step E.

[0063] Step E. Input the graph structure representation obtained in Step D into a Graph Convolutional Neural Network (GCN). After several convolutional layers, use pooling operations to construct the graph representation. Integrate all the information learned in the network through two fully connected layers. Finally, use a Softmax classifier to output the defect tendency.

[0064] It should be noted that the convolutional neural network for graph classification is an end-to-end learning method that can learn higher-level features and patterns. Step E includes the following steps E1 to E2.

[0065] Step E1. Obtain the adjacency matrix from the complete graph structure representation of the source code. The formula is as follows:

[0066]

[0067] in A represents the adjacency matrix of each node in the graph structure. Note that each node ignores its own characteristics, so an identity matrix I needs to be added. N N is the number of nodes in the graph structure. express The degree matrix is ​​then processed, and then step E2 is performed.

[0068] Step E2. For the adjacency matrix obtained in the graph structure, the propagation model H of the graph convolutional neural network (GCN) from layer l to layer l+1. (l+1) It can be represented as:

[0069]

[0070] in Let W represent the transfer function of the GCN network, σ(·) represent the activation function, which is usually used to enhance the expressive power of the model. (l) H represents the weight matrix. (l) H represents the state information of each layer in the GCN network, l∈{0,1,2,...,L}, where L represents the total number of network layers. (L) =Z (Z is the output of the network model), when l=0, H (0) =X (X is the information representation of each node in the graph structure), and then proceed to step F.

[0071] It should be noted that the Softmax function used at the end of the GCN network is for classification tasks, thus completing the construction of the Graph Convolutional Neural Network (GCN) model. The Softmax function is shown below:

[0072]

[0073] Step F. Based on the AST word vectors corresponding to the code content and the word vectors corresponding to the code comments, a graph structure prediction model is constructed. The training task is performed on the constructed graph convolutional neural network (GCN) model to optimize the GCN model parameters and obtain the trained GCN prediction model, which is the model for predicting software defects.

[0074] In actual operation, such as Figure 3 As shown, software defect prediction further executes steps I to III.

[0075] Step I. Collect the source code and break it down into modules. First, mark each module for defects. Mark the defective modules and then proceed to Step II. Step I is performed according to Step I1 to Step I3.

[0076] Step I 1. Collect datasets containing software defects from the company's open-source software projects, bug databases, software defect reports, etc.;

[0077] Step 1.2. Define specific and clear annotation rules for different types of defects in the dataset, such as bugs, errors, and security vulnerabilities;

[0078] Step I 3. The annotator annotates the prepared dataset according to the annotation rules established above, annotating defective modules as 1 and defect-free modules as 0.

[0079] Step II. Divide the labeled dataset into training and test sets. Use 70% and 30% of the source code dataset as the training and test sets, respectively, and then proceed to Step III.

[0080] Step III. Input the pre-divided dataset into the constructed defect prediction model, allowing the model to learn the relationship between features and labels, and optimize and adjust the model to obtain better prediction results. Then proceed to Step IV. In the specific process, Step III is carried out according to Step III1 and Step III2.

[0081] Step III 1. Input the labeled training set into the prediction model, learn the relationship between features and labels through the network model, train the model parameters, and further obtain the trained prediction model;

[0082] Step III 2. Input the labeled test set into the trained prediction model to predict whether there are defects in the input module. Then, optimize and adjust the model according to the test structure to obtain the final prediction model.

[0083] The present invention has been described in detail above with reference to the accompanying drawings and specific embodiments. However, the present invention is not limited to the above-described embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made based on the present invention.

Claims

1. A software defect prediction method based on multi-dimensional code joint graph representation, characterized in that: A software defect prediction model is constructed based on the code content and comment information in the corresponding code repository, and then applied to the software defect prediction task to achieve defect prediction. This process includes the following steps: Step A. Submit the source code information containing class labels to the repository as a code sample. Decompose the code sample into two parts: source code without comments and code comments. The source code without comments includes the following sub-parts: function and class definitions, variable and constant definitions, control flow statements, error handling, and exception handling. Step B. For the two parts mentioned above in the code sample, extract the abstract syntax tree (AST) structure from the source code without comments, obtain the AST nodes, and traverse the AST to obtain the dependency relationship representation data and call relationship representation data. Finally, obtain the feature sequence of its syntax tree nodes, dependency relationships, and call relationship data. Then, extract the word sequence from the code comment text and encode it to obtain the code comment sequence. Step C. For the syntax tree nodes and code comment sequences obtained in Step B, the new sequences are transformed into corresponding vectors using the Word2vec model: syntax tree node vector and code comment vector; Step D. For the syntax tree node vector and code comment vector obtained from the code information, concatenate the two into a new node vector as the final node vector representation of the graph structure, and use the dependency and call relationships obtained in Step B as edges to construct a complete graph structure representation; Step E. Input the graph structure representation obtained in step D into the graph convolutional neural network. After several convolutional layers, use pooling operations to construct the graph representation. Integrate all the information learned in the network through two fully connected layers. Finally, use the Softmax classifier to output the defect tendency. Step F. Based on the AST word vectors corresponding to the code content and the word vectors corresponding to the code comments, a graph structure prediction model is constructed. The training task is performed on the constructed graph convolutional neural network (GCN) model to optimize the GCN model parameters and obtain the trained GCN prediction model, which is the model for predicting software defects. Based on the construction of the software defect prediction model, the following steps I to III are followed to realize the software defect detection task of applying the code prediction model to code content and code comments. Step 1. Collect the source code and break it down into modules. First, mark the defective modules. Step II. Divide the labeled dataset into a training set and a test set, with 70% and 30% of the source code dataset used as the training set and test set, respectively; Step III. Input the pre-divided dataset into the constructed defect prediction model, allowing the model to learn the relationship between features and labels, and optimize and adjust the model to obtain better prediction results and the final prediction model.

2. The software defect prediction method based on multi-dimensional code joint graph representation according to claim 1, characterized in that: Step B1. Extract the abstract syntax tree structure from the source code submitted to the code repository, parse the structural relationships, and obtain the control dependencies and call relationships, following steps B1.1 to B1.4: Step B1.1 The lexical analysis process merges the code content in the source code into tokens according to predetermined rules and removes whitespace and redundant information from comments in the code statements. Finally, all the synthesized tokens are split into a token list. Step B1.2, the syntax analysis process, transforms the list of tokens obtained in step B1.1 into a tree structure, and verifies whether there are any syntax errors, discarding any parts with syntax errors. Step B1.3 involves traversing the constructed syntax tree during dependency resolution, calculating the control and data dependencies in the code statements, and obtaining the representation data of the dependencies. Step B1.4 During the call relationship parsing, the constructed syntax tree is traversed to extract the function call nodes and definition nodes in the syntax tree, construct the relationship between the two, and obtain the representation data of the call relationship; Step B2 involves extracting word sequences from code comments in the source code using a natural language processing toolkit. This extraction process typically consists of three parts: word segmentation, stemming, and word sequence construction, following steps B2.1 to B2.2: Step B2.1 performs word segmentation on the comment text of the source code, removing all special characters, punctuation marks, extra spaces, and other content that may interfere with the comment conversion, and then dividing it into word sub-sequences, where each word can be regarded as an element in the sequence; Step B2.2 combines the segmented annotation words into a complete word sequence and uses spaces, special markers, and other delimiters to represent the different word element sequences in the sequence.

3. The software defect prediction method based on multi-dimensional code joint graph representation according to claim 1, characterized in that, Step E includes steps E1 to E2: Step E1. Obtain the adjacency matrix from the complete graph structure representation of the source code. The formula is as follows: in Let A represent the adjacency matrix of each node in the graph structure. Note that each node ignores its own characteristics, so an identity matrix needs to be added. N is the number of nodes in the graph structure. express The degree matrix is ​​then processed, and then step E2 is performed. Step E2. For the adjacency matrix obtained in the graph structure, the propagation model of the Graph Convolutional Neural Network (GCN) from layer l to layer l+1. It can be represented as: in The transfer function of the GCN network is represented. Activation functions are typically used to enhance the expressive power of a model. Represents the weight matrix. This represents the state information of each layer in the GCN network. ∈{0,1,2..., }, where L represents the total number of network layers. =Z, where Z is the output of the network model. When l=0... =X, where X is the information representation of each node in the graph structure.

4. The software defect prediction method based on multi-dimensional code joint graph representation according to claim 1, characterized in that, Step I includes steps I1 to I3: Step I 1. Collect datasets containing software defects from open-source software projects, bug databases, and software defect reports; Step 1.

2. Define specific and clear annotation rules for different types of defects such as bugs, errors, and security vulnerabilities in the dataset; Step 3. The annotator annotates the prepared dataset according to the above annotation rules, annotating defective modules as 1 and defect-free modules as 0.

5. The software defect prediction method based on multi-dimensional code joint graph representation according to claim 1, characterized in that, Step III includes steps III1 to III2: Step III 1. Input the labeled training set into the prediction model, learn the relationship between features and labels through the network model, train the model parameters, and further obtain the trained prediction model; Step III 2. Input the labeled test set into the trained prediction model to predict whether the input module has defects. Then, optimize and adjust the model according to the test structure to obtain the final prediction model.

Citation Information

Patent Citations

  • Software defect prediction method based on long short-term memory network and LASSO algorithm

    CN113778862A

  • Software defect prediction model interpretation method

    CN115629980A

  • Software defect detection method based on multivariate information fusion

    CN116136822A