Feature attachment detection method based on multi-level code representation

By converting Java code into token sequences and abstract syntax trees to construct heterogeneous directed hypergraphs, and using bidirectional long and short-term memory networks and hypergraph network models to perform feature fusion, the problem of insufficient accuracy of feature attachment detection in the existing technology is solved. , realizes more efficient code odor detection.

CN119025418APending Publication Date: 2024-11-26CHENGDU UNIV OF INFORMATION TECH
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411064135.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

Existing code odor detection methods have subjectivity in measurement selection and difficulty in formulating rules, resulting in insufficient accuracy in detection of feature attachment and difficulty in capturing complex contextual information.

Method used

Using a multi-level code representation method, heterogeneous directed hypergraph is constructed by converting Java code into token sequences and abstract syntax trees, and using bidirectional long and short-term memory network and hypergraph network model to process the code information, and fuse the features to Characteristic attachment detection was performed.

Benefits of technology

It improves the accuracy and efficiency of feature attachment detection, can more comprehensively understand and characterize the higher-order structural and semantic information of the source code, and enhances the network's expression ability and feature extraction ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025418A_ABST
    Figure CN119025418A_ABST
Patent Text Reader

Abstract

The invention discloses a feature attachment detection method based on multi-level code representation, which is based on java programming language codes and comprises the following steps of: converting a java programming language code to be processed into a token sequence, namely a first code representation, and simultaneously converting the java programming language code to be processed into a heterogeneous directed hypergraph, namely a second code representation, based on an abstract syntax tree; inputting the first code representation into a bidirectional long short-term memory network model to obtain a first output feature, and inputting the second code representation into a hypergraph network model to obtain a second output feature; fusing the first output feature and the second output feature to obtain a total output feature; and performing code feature attachment detection on the total output feature to obtain a detection result. According to the method, the structure, grammar, semantics and other high-order information of the code can be comprehensively obtained through the method combined with multi-level source code representation, and therefore richer and deeper data features are provided for code peculiar smell detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of code detection, and in particular to a feature attachment detection method based on multi-level code representation. Background Art

[0002] In the context of rapid development and changing demands in the software industry, developers need to constantly update the source code of the software to meet the changing needs of the project. However, this frequent update process may make the code more complex, increase the difficulty of understanding, and lead to higher development costs. At the same time, it may also cause a decline in code quality and bring a series of potential problems. Code smells usually come from the fact that developers do not follow best practices or fully consider design principles during the design process, resulting in poor readability and difficulty in maintenance of program designs. These problems not only increase the maintenance cost of the software and reduce the quality of the software, but also imply the possibility of software refactoring. Therefore, it is particularly important to accurately identify code smells.

[0003] Feature attachment is a common code smell that is prevalent in software development. It mainly manifests itself in the lack of clarity in the allocation of responsibilities for certain classes, and the class design needs to be further optimized. When a class's methods frequently operate on the properties of other classes or call methods of other classes, it shows "attachment" to that class. This phenomenon indicates that these methods are actually more suitable to be defined in the class they frequently access rather than the class they are currently operating on. Excessive feature attachment may lead to increased coupling and weakened cohesion of the code, ultimately having a negative impact on the maintainability of the system.

[0004] Traditional code smell detection methods based on metrics and heuristic rules rely on the use of manually designed rules to extract features from the code to detect code smells. Tsantalis et al. developed the JDeodorant tool to detect feature attachment code smells. Simon et al. proposed a method to measure the strength of the relationship between two entities by defining the distance to detect feature attachment. Liu et al. proposed a new method to improve feature attachment code smell by moving the highest similarity and strongest association with the m method. Sales et al. proposed a feature attachment detection method JMove based on static dependency. Although such methods provide a certain degree of evaluation for code quality, there is subjectivity in metric selection and difficulty in rule formulation. Everyone has a lot of deviations in defining the rules and setting metrics for code smells, resulting in a lack of unified standards in code smell detection.

[0005] In the code smell detection methods based on machine learning, such as random forest, support vector machine, naive Bayes and logistic regression, some results have been achieved in code smell detection. Fontana et al. used a variety of machine learning models to detect feature attachment. Seema Dewangan used an integrated machine learning model for feature attachment detection. L. Amorim used decision trees to detect code feature attachment. Amandeep Kaur proposed a SVMCSD detection method based on support vector machine to detect feature attachment. However, the number of features of machine learning methods is relatively single, and they need to rely on external tools to calculate code metrics and indicator information, making it difficult to capture complex contextual information, resulting in insufficient accuracy in detecting smells. Summary of the invention

[0006] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a feature attachment detection method based on multi-level code representation.

[0007] The objective of the present invention is achieved through the following technical solutions:

[0008] A first aspect of the present invention provides a feature attachment detection method based on multi-level code representation, based on Java programming language code, comprising the following steps:

[0009] Converting the Java programming language code to be processed into a token sequence, i.e., a first code representation, and converting the Java programming language code to be processed into a heterogeneous directed hypergraph based on an abstract syntax tree, i.e., a second code representation;

[0010] Inputting the first code representation into a bidirectional long short-term memory network model to obtain a first output feature, and inputting the second code representation into a hypergraph network model to obtain a second output feature;

[0011] Fusing the first output feature and the second output feature to obtain a total output feature;

[0012] A code feature attachment detection is performed on the total output feature to obtain a detection result.

[0013] Furthermore, the step of converting the Java programming language code to be processed into a token sequence, i.e., a first code representation, includes:

[0014] Utilize the parsing function of the javalang library to parse the java programming language code to be processed and convert it into a standardized token sequence.

[0015] Furthermore, the step of converting the Java programming language code to be processed into a heterogeneous directed hypergraph based on an abstract syntax tree, i.e., a second code representation, includes:

[0016] Use the functions provided by the javalang library to extract the abstract syntax tree from the java programming language code to be processed;

[0017] A heterogeneous directed hypergraph is constructed based on the extracted abstract syntax tree.

[0018] Furthermore, the abstract syntax tree includes non-identifier nodes and identifier nodes. The non-identifier nodes represent the abstract structure of the code, and their values ​​are directly associated with the type of the corresponding syntax structure, including compilation units, method declarations, member references, and method calls; the identifier nodes are used to identify specific named elements in different code parts, including class names, variable names, and method names; the association between nodes is described by fields, and each field has a clear directionality. If one node contains another node, the former node plays the role of "head" in the relationship, and the other node plays the role of "tail". The name of the field is used to indicate the type of hyperedge, that is, the type of relationship between different nodes;

[0019] The step of constructing a heterogeneous directed hypergraph based on the extracted abstract syntax tree includes:

[0020] Initialize an empty graph;

[0021] Traverse each node in the abstract syntax tree and add identifier nodes or non-identifier nodes to the graph;

[0022] Traverse each edge in the abstract syntax tree and add the edge to the graph;

[0023] Return the constructed heterogeneous directed hypergraph G;

[0024] The heterogeneous directed hypergraph G is represented as a tuple {N(μ,x),E(ρ,T(e),H(e))}; in this structure, the node set N contains a series of nodes, each node includes a node type μ and a node value x; the hyperedge set E includes a series of hyperedges, each edge includes a hyperedge type ρ, a tail node set T(e) and a head node H(e); the hyperedge type ρ represents different relationship types, the tail node set T(e) represents the set of source nodes associated with the hyperedge, and the head node H(e) represents the target node pointed to by the hyperedge, and the direction of the hyperedge e is from T(e) to H(e).

[0025] Furthermore, the bidirectional long short-term memory network model includes, from bottom to top, an input layer, an embedding layer, a bidirectional long short-term memory network layer, a multi-head attention layer, and a fully connected layer; wherein:

[0026] The embedding layer maps the token sequence input by the input layer into an embedding vector through an index;

[0027] The bidirectional long short-term memory network layer calculates the embedding vector to obtain a forward hidden state representing the context information on the left and a reverse hidden state representing the context information on the right, and concatenates the forward hidden state and the reverse hidden state to form a complete context representation, that is, a total hidden state corresponding to the entire token sequence;

[0028] The multi-head attention layer combines the total hidden state and different weight matrices for calculation;

[0029] The fully connected layer combines the calculations of multiple attention layers for integrated connection.

[0030] Furthermore, the step of inputting the second code representation into a hypergraph network model to obtain a second output feature includes:

[0031] According to the node value x, node type μ and hyperedge type ρ of node N, they are converted into continuous vectors through word embedding as input to the model, and then the high-order semantics and structure in the code are extracted according to the two-stage message passing strategy.

[0032] Furthermore, the extracting of high-level semantics and structure in the code according to the two-stage message passing strategy includes: message passing from node to hyperedge and message passing from hyperedge to node.

[0033] Furthermore, the message transmission from the node to the hyperedge includes:

[0034] Use the head matrix and tail matrix to linearly transform the hidden vector of each node to obtain the information vector from the node to the hyperedge;

[0035] The original hyperedge vector and the information vector from the node to the hyperedge are aggregated using the multi-head attention mechanism information to obtain a hyperedge vector after the aggregation operation;

[0036] The hyperedge vector after the aggregation operation is integrated with the original hyperedge vector by using a residual connection to obtain an enhanced hyperedge vector;

[0037] The hyperedge-to-node message transmission includes:

[0038] Use the head matrix and tail matrix to linearly transform the hidden vector of each node to obtain the information vector from the hyperedge to the node;

[0039] Using multi-head attention mechanism information, the linearly transformed hidden vector and the hyperedge-to-node information vector are aggregated to obtain a node vector after the aggregation operation;

[0040] Using residual connection to perform feature fusion on the node vector after the aggregation operation and the hidden vector after the linear transformation to obtain an enhanced node vector;

[0041] Performing graph normalization on the enhanced node vector to obtain an implicit vector of the node;

[0042] The implicit vector of the node and the initialization vector are aggregated using multi-head attention mechanism information to obtain a node vector;

[0043] Convolutional layers are used to parse the patterns and structures of node vectors.

[0044] Further, the fusing the first output feature and the second output feature to obtain the total output feature includes:

[0045] Set the hyperparameters representing the output weights;

[0046] The first output feature and the second output feature are fused using the hyperparameter to obtain a total output feature.

[0047] Furthermore, the bidirectional long short-term memory network model and the hypergraph network model are trained models, and the training process adopts a binary cross entropy loss function.

[0048] The beneficial effects of the present invention are:

[0049] In an exemplary embodiment of the present invention, in order to effectively capture high-order data features in source code without relying on code metrics, a source code token sequence and a heterogeneous directed hypergraph constructed based on an abstract syntax tree (AST) are proposed as code representation. A heterogeneous directed hypergraph based on an abstract syntax tree AST and a multi-level source code representation method based on a source code token sequence are used. A hypergraph neural network and a bidirectional long short-term memory network (LSTM) with an attention mechanism are used to process source code information, respectively, to enhance the interpretability and generalization capabilities of the model. These improvements help to more comprehensively understand and characterize the high-order structure and semantic information of the source code, enhance the network's expressive power and feature extraction, and thus improve the performance of feature attachment detection. Through this method combined with multi-level source code representation, high-order information such as the structure, syntax, and semantics of the code can be fully obtained, thereby providing richer and deeper data features for code smell detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 A flowchart of a feature attachment detection method based on multi-level code representation provided by an exemplary embodiment of the present invention;

[0051] Figure 2 A schematic diagram of a heterogeneous directed hypergraph provided for an exemplary embodiment of the present invention;

[0052] Figure 3 A schematic diagram of the structure of a bidirectional long short-term memory network model provided by an exemplary embodiment of the present invention;

[0053] Figure 4 A schematic diagram of the structure of a multi-head attention layer provided for an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0054] The technical solution of the present invention is described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only 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.

[0055] In the description of the present invention, it should be noted that the directions or positional relationships indicated by "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside", etc. are directions or positional relationships based on the drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0056] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, "installation", "connection" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0057] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0058] See also Figure 1 , Figure 1 A flowchart of a feature attachment detection method based on multi-level code representation provided in an exemplary embodiment of the present invention is shown, based on Java programming language code, comprising the following steps:

[0059] Converting the Java programming language code to be processed into a token sequence, i.e., a first code representation, and converting the Java programming language code to be processed into a heterogeneous directed hypergraph based on an abstract syntax tree, i.e., a second code representation;

[0060] Inputting the first code representation into a bidirectional long short-term memory network model to obtain a first output feature, and inputting the second code representation into a hypergraph network model to obtain a second output feature;

[0061] Fusing the first output feature and the second output feature to obtain a total output feature;

[0062] A code feature attachment detection is performed on the total output feature to obtain a detection result.

[0063] Specifically, in order to effectively capture high-order data features in source code without relying on code metrics, a source code token sequence and a heterogeneous directed hypergraph built based on an abstract syntax tree (AST) are proposed as code representation. In this exemplary embodiment, instead of simply processing the code representation information, a heterogeneous directed hypergraph based on an abstract syntax tree AST and a multi-level source code representation method based on a source code token sequence are adopted. A hypergraph neural network and a bidirectional long short-term memory network (LSTM) with an attention mechanism are used to process the source code information, respectively, to enhance the interpretability and generalization ability of the model. These improvements help to more comprehensively understand and characterize the high-order structure and semantic information of the source code, enhance the network's expressive power and feature extraction, and thus improve the performance of feature attachment detection.

[0064] This method of combining multi-level source code representation can comprehensively obtain high-level information such as code structure, syntax, and semantics, thereby providing richer and deeper data features for code smell detection. This strategy of comprehensively utilizing multiple source code representations is expected to significantly improve the accuracy and efficiency of code smell detection and contribute to the field of software development and maintenance.

[0065] More specifically, the Java programming language code to be processed is parsed into an abstract syntax tree and code token information using javalang. For the first level of the abstract syntax tree + hypergraph network:

[0066] Then, by adding heterogeneous information and directional information to the abstract syntax tree of the source code to construct a heterogeneous directed hypergraph, it helps to better understand the high-order semantics and structural features in the code, and is beneficial to enhancing the network's expressiveness and feature extraction capabilities.

[0067] Directed hypergraph is an extended form of hypergraph, which introduces the concept of directionality and makes hyperedges directional. Unlike ordinary hypergraphs, hyperedges in directed hypergraphs have clear sets of tail nodes and head nodes. This enables directed hypergraphs to describe the specific associations and connection patterns between nodes in more detail, because it can capture unidirectional relationships between nodes. When modeling complex association structures, directed hypergraphs show a high degree of expressiveness and can more accurately represent the directional associations and dependencies between nodes. The introduction of directionality enables directed hypergraphs to provide a deeper understanding and insight into node association patterns, making the modeling and analysis of practical problems more accurate and comprehensive.

[0068] Heterogeneous hypergraph: An extended form of hypergraph, heterogeneous hypergraph further introduces the concept of heterogeneity, so that the nodes and edges in the graph can have different types, better reflecting the complex systems in the real world. Different types of nodes and edges in heterogeneous hypergraphs can represent different entities or relationships, thereby more accurately capturing and modeling the diversity and complexity of the real world.

[0069] Hypergraph network: Graphs and hypergraphs are structures composed of nodes and edges and hyperedges connecting nodes, respectively, which are used to describe the relationship between entities. However, there are significant differences in the way they connect the structures. A hypergraph is an extended structure of a graph, consisting of nodes and hyperedges connecting nodes. Unlike the edges of a graph that only connect two nodes, hyperedges allow multiple nodes to be connected, giving hypergraphs greater flexibility and the ability to more accurately capture the relationship between nodes while better representing complex association structures. In a hypergraph, a hyperedge can be viewed as a high-level relationship connecting multiple nodes, allowing the association between nodes to be presented in a richer and more diverse way. This makes hypergraphs important in the modeling of many practical problems, especially in situations where multivariate relationships need to be modeled. Through hypergraphs, researchers can more comprehensively understand and describe complex associations in the real world.

[0070] For the token sequence + bidirectional long short-term memory network model:

[0071] This exemplary embodiment uses the text information of the code as input based on the characteristics of the code itself. In this process, the Java code snippet is regarded as a natural language text, and its token sequence is converted into an embedding vector through index mapping. These embedding vectors are then fed into a bidirectional long short-term memory network (Bi-LSTM) as input data, which can globally capture the contextual information in the code and effectively analyze the structural and semantic features of the code.

[0072] This exemplary embodiment focuses on the intrinsic representation of the source code and globally captures the important contextual information in the code, while the prior art uses code metrics to obtain code metric relationships through Transformer. That is, compared to the prior art, which relies on tool indicators to use code metric information, this exemplary embodiment is based on source code representation rather than indicator information.

[0073] In addition, it should be noted that the token sequence-based method may ignore some important grammatical structures and dependencies when processing the code; the abstract syntax tree-based method may fail to fully capture the semantic information of the code; and the graph-based method may fail to reflect the grammatical details of the source code in detail. In order to avoid the above problems and to prevent dependence on the metric information of the tool, this exemplary embodiment proposes a multi-level code representation method and applies a hypergraph to the field of code smell to better understand the high-level semantic information and structural features in the code, which is conducive to enhancing the network's expression ability and feature extraction ability.

[0074] The following contents will describe various preferred exemplary embodiments in detail:

[0075] More preferably, in an exemplary embodiment, converting the Java programming language code to be processed into a token sequence, i.e., a first code representation, includes:

[0076] Utilize the parsing function of the javalang library to parse the java programming language code to be processed and convert it into a standardized token sequence.

[0077] Specifically, in this exemplary embodiment, in order to convert Java code into a token sequence representation that can be processed by a deep learning model, the following steps are followed: First, the Java code snippet is regarded as a natural language text to lay the foundation for subsequent tokenization and deep learning analysis. Second, with the help of the parsing function of the javalang library, the code snippet is parsed and converted into a standardized token sequence.

[0078] More preferably, in an exemplary embodiment, converting the Java programming language code to be processed into a heterogeneous directed hypergraph based on an abstract syntax tree, i.e., a second code representation, comprises:

[0079] Use the functions provided by the javalang library to extract the abstract syntax tree from the java programming language code to be processed;

[0080] A heterogeneous directed hypergraph is constructed based on the extracted abstract syntax tree.

[0081] Specifically, in this exemplary embodiment, extracting hypergraph information from Java code is more complicated than extracting token information. First, the abstract syntax tree (AST) is extracted using the function provided by the javalang library. AST is an accurate representation of the code structure, which captures the syntax and logical relationships in the code. Subsequently, a heterogeneous directed hypergraph is constructed based on the extracted AST.

[0082] More preferably, in an exemplary embodiment, the abstract syntax tree includes non-identifier nodes and identifier nodes, the non-identifier nodes represent the abstract structure of the code, and their values ​​are directly associated with the type of the corresponding syntax structure, including compilation unit, method declaration, member reference, method call; the identifier nodes are used to identify specific named elements in different code parts, including class names, variable names and method names; the association between nodes is described by fields, each field has a clear directionality, where one node contains another node, the former node plays the role of "head" in the relationship, and the other node plays the role of "tail", and the name of the field is used to indicate the type of hyperedge, that is, the type of relationship between different nodes;

[0083] The step of constructing a heterogeneous directed hypergraph based on the extracted abstract syntax tree includes:

[0084] Initialize an empty graph;

[0085] Traverse each node in the abstract syntax tree and add identifier nodes or non-identifier nodes to the graph;

[0086] Traverse each edge in the abstract syntax tree and add the edge to the graph;

[0087] Return the constructed heterogeneous directed hypergraph G;

[0088] The heterogeneous directed hypergraph G is represented as a tuple {N(μ,x),E(ρ,T(e),H(e))}; in this structure, the node set N contains a series of nodes, each node includes a node type μ and a node value x; the hyperedge set E includes a series of hyperedges, each edge includes a hyperedge type ρ, a tail node set T(e) and a head node H(e); the hyperedge type ρ represents different relationship types, the tail node set T(e) represents the set of source nodes associated with the hyperedge, and the head node H(e) represents the target node pointed to by the hyperedge, and the direction of the hyperedge e is from T(e) to H(e).

[0089] Specifically, in this exemplary embodiment, a hypergraph is a mathematical model that allows for the representation of complex relationships between multiple nodes, which is difficult to achieve in traditional graph models. In the method of this exemplary embodiment, a hypergraph can represent not only entities in the code (such as classes, methods, variables, etc.), but also multiple different types of relationships between these entities (such as inheritance, calls, dependencies, etc.).

[0090] Based on the concept of feature attachment, the methods of one class frequently operate the properties of other classes or call the methods of other classes. The abstract syntax tree defines two types of nodes: "non-identifier" nodes and "identifier" nodes. "Non-identifier" nodes represent the abstract structure of the code, and their values ​​are directly associated with the type of the corresponding syntax structure, such as compilation unit, method declaration, member reference, method call, etc. "Identifier" nodes are used to identify specific named elements in different code parts, such as class names, variable names, and method names. The association between nodes is described by fields, and each field has a clear directionality. If one node contains another node, the former node plays the role of "head" in the relationship, and the other node plays the role of "tail". The name of the field is used to indicate the type of hyperedge, that is, the type of relationship between different nodes.

[0091] Finally, the super nodes and hyper edges in the hypergraph are embedded into the hypergraph network, that is, the “constructing a heterogeneous directed hypergraph based on the extracted abstract syntax tree”.

[0092] This step involves mapping the elements in the hypergraph into a high-dimensional vector space so that the complex relationships between them can be captured and analyzed. In this way, a rich, multi-dimensional code representation can be constructed, providing strong data support for subsequent code analysis and processing.

[0093] More preferably, in an exemplary embodiment, Figure 2 As shown in the figure, in the graphical representation, the ellipse and square represent "non-identifier" nodes and "identifier" nodes respectively, and the connecting line with an arrow indicates the direction of the relationship. The node pointed by the arrow is called the "head node", and the node from which the arrow originates is called the "tail node". This directional design reflects the relationship between entities in the code. Hyperedges of different colors represent different types of relationships, and the same type of relationship can connect multiple nodes.

[0094] More preferably, in an exemplary embodiment, the bidirectional long short-term memory network model includes, from bottom to top, an input layer, an embedding layer, a bidirectional long short-term memory network layer, a multi-head attention layer, and a fully connected layer; wherein:

[0095] The embedding layer maps the token sequence input by the input layer into an embedding vector through an index;

[0096] The bidirectional long short-term memory network layer calculates the embedding vector to obtain a forward hidden state representing the context information on the left and a reverse hidden state representing the context information on the right, and concatenates the forward hidden state and the reverse hidden state to form a complete context representation, that is, a total hidden state corresponding to the entire token sequence;

[0097] The multi-head attention layer combines the total hidden state and different weight matrices for calculation;

[0098] The fully connected layer combines the calculations of multiple attention layers for integrated connection.

[0099] Specifically, in this exemplary embodiment, the code smell detection method using natural language processing (NLP) technology deeply understands the source code by analyzing the token sequence. A bidirectional LSTM (Bi-LSTM) network is used to globally capture the context information in the code, but the standard Bi-LSTM ignores the differences in the importance of different code positions, which may weaken the ability to identify key information in complex structures and affect the accuracy of smell detection. To solve this problem, a multi-head attention mechanism model is incorporated, which can highlight key code elements and strengthen important feature dependencies, thereby enhancing the model's semantic understanding and code smell detection performance. Figure 3 The bidirectional long short-term memory network model (Bi-LSTM-Attention model) is demonstrated.

[0100] Specifically, the generated token sequence is first mapped to an embedding vector through an index, and the embedding vector provides rich semantic information for the model. Then the embedding vector is sent as input data to the bidirectional long short-term memory network layer. The model can effectively analyze the structure and semantic features of the code with its strong performance in processing sequence data. Among them:

[0101] Long short-term memory (LSTM) networks play a key role in many areas of natural language processing (NLP), such as text generation, classification, sentiment analysis, named entity recognition, and syntactic analysis. Although LSTM performs well in handling long-term dependency problems, the limitation of its unidirectional information flow may affect the understanding of complex contexts. Bidirectional long short-term memory (Bi-LSTM) networks capture the contextual information of sequence data more comprehensively by combining forward and reverse information flows, thereby improving the performance of the model in complex tasks.

[0102] In the preprocessing stage, the code token sequence is converted into an embedding vector and input into the Bi-LSTM model. represents the contextual information on the left, while the reverse hidden state Indicates contextual information on the right.

[0103]

[0104] Concatenate these two states to form a complete context representation h t , which contains comprehensive semantic information of each element in the sequence. The hidden state of the entire sequence is represented by the matrix H, H = (h 1 ,h 2 ,h 3 ,...,h t ).

[0105] Furthermore, a multi-head attention mechanism is integrated after the bidirectional long short-term memory network layer. This mechanism can highlight key code elements and strengthen the reliance on important features, thereby significantly improving the model's semantic understanding ability and the efficiency of code smell detection.

[0106] The attention mechanism is inspired by human vision and cognition, and enhances model efficiency and performance by selectively focusing on key parts of the input. Originated from the field of machine translation, it is now widely used in many fields such as natural language processing, computer vision, and reinforcement learning. The multi-head attention mechanism captures different aspects of the input sequence by processing multiple "heads" in parallel, and further promotes the performance of natural language processing tasks by calculating the correlation weights between each head. This mechanism performs linear transformation through the fully connected layer, effectively extracting and strengthening the features that are critical to task completion.

[0107] Among them, Q is the query vector, K is the key vector, and V is the value vector, which are linearly transformed from different weight matrices and hidden states. In order to prevent the multiplication result from being too large, a scaling factor d is used k The attention weights calculated by the Softmax function represent the degree of attention the model pays to each key, and the sum of these weights is 1. Then, the attention weights are weightedly combined on the value vector V to obtain the final attention output.

[0108]

[0109] By adopting a parallel multi-head structure, the model performs independent linear transformations on the query (Q), key (K), and value (V), and then integrates the outputs of these transformations. This design enables the model to capture and consider multiple complex relationships in the input data at the same time. Finally, through the weight matrix W O Output mapping is performed on the integrated information.

[0110] head i =Attention(QW i Q ,KW i K ,VW iV )

[0111] MultiHead(Q,K,V)=Concat(head 1 ,...,head h )·W O

[0112] Figure 4 The model of the multi-head attention mechanism is described. The multi-head attention mechanism gives the model the ability to flexibly select and focus on key parts when processing input data, thereby enhancing the performance and robustness of the model. The use of the multi-head attention mechanism can learn from the code at multiple levels, thereby more comprehensively capturing the features in the code, which helps to parse and detect feature attachment.

[0113] More preferably, in an exemplary embodiment, the step of inputting the second code representation into a hypergraph network model to obtain a second output feature includes:

[0114] According to the node value x, node type μ and hyperedge type ρ of node N, they are converted into continuous vectors through word embedding as input to the model, and then the high-order semantics and structure in the code are extracted according to the two-stage message passing strategy.

[0115] Specifically, in this exemplary embodiment, as described above, the heterogeneous directed hypergraph G can be represented as a tuple {N(μ,x),(ρ,T(e),H(e))}. In this structure, the node set N contains a series of nodes, each of which consists of a node type μ and a node value x. The hyperedge set G includes a series of hyperedges, each of which consists of an edge type ρ, a tail node set T(e), and a head node H(e). The edge type ρ can represent different relationship types, the tail node set T(e) represents the source node set associated with the hyperedge, and the head node H(e) represents the target node to which the hyperedge points, and the direction of the hyperedge e is from T(e) to H(e).

[0116] According to the value x of node n, the node type μ and the type ρ of hyperedge, they are converted into continuous vectors through word embedding as input to the model, and then the high-order semantics and structure in the code are extracted according to the two-stage message passing strategy.

[0117] More preferably, in an exemplary embodiment, the extracting high-level semantics and structure in the code according to a two-stage message passing strategy includes: node-to-hyperedge message passing and hyperedge-to-node message passing.

[0118] More preferably, in an exemplary embodiment, the node-to-hyperedge message delivery includes:

[0119] Use the head matrix and tail matrix to linearly transform the hidden vector of each node to obtain the information vector from the node to the hyperedge;

[0120] The original hyperedge vector and the information vector from the node to the hyperedge are aggregated using the multi-head attention mechanism information to obtain a hyperedge vector after the aggregation operation;

[0121] The hyperedge vector after the aggregation operation is integrated with the original hyperedge vector by using a residual connection to obtain an enhanced hyperedge vector;

[0122] The hyperedge-to-node message transmission includes:

[0123] Use the head matrix and tail matrix to linearly transform the hidden vector of each node to obtain the information vector from the hyperedge to the node;

[0124] Using multi-head attention mechanism information, the linearly transformed hidden vector and the hyperedge-to-node information vector are aggregated to obtain a node vector after the aggregation operation;

[0125] Using residual connection to perform feature fusion on the node vector after the aggregation operation and the hidden vector after the linear transformation to obtain an enhanced node vector;

[0126] Performing graph normalization on the enhanced node vector to obtain an implicit vector of the node;

[0127] The implicit vector of the node and the initialization vector are aggregated using multi-head attention mechanism information to obtain a node vector;

[0128] Convolutional layers are used to parse the patterns and structures of node vectors.

[0129] Specifically, in this exemplary embodiment, a) node-to-hyperedge message transmission includes: The process is shown in the following formula, using the head matrix and the tail matrix to hide the vector of each node Perform a linear transformation to aggregate information from nodes to hyperedges The superscript l indicates the number of layers.

[0130]

[0131] Simple information aggregation may lead to the loss of important information. Therefore, when the directed hyperedge aggregates the rich information from the tail node and the head node, a multi-head attention mechanism is used to improve the diversity, flexibility and interpretability of the model for information aggregation. As shown in the following formula. e is the hyperedge vector, and Represents the information vector after linear transformation from node n to hyperedge e. It represents a heterogeneous directed hyperedge information vector aggregated using multi-head attention mechanism information.

[0132]

[0133] In order to integrate the information flow from nodes to hyperedges and retain the characteristics of the original edges, the model can be provided with richer and more detailed semantic information. The following formula uses residual connections to convert the original hyperedge vector set ebd e and the hyperedge vector after aggregation The feature integration of

[0134]

[0135] b) Hyperedge-to-node message passing: The process is shown in the following formula: Based on the point-to-edge information aggregation, the enhanced hyperedge vector Perform a linear transformation similar to step (a) to obtain the information vector from the hyperedge e to the contained node n

[0136]

[0137] In order to ensure the richness and effectiveness of node information and avoid the loss of important information, a multi-head attention mechanism is used to efficiently aggregate information from hyperedges to nodes. is the latent vector after linear transformation, and Represents the information vector from the hyperedge e to the node n after linear transformation. Represents the aggregation information of directed hyperedge e to node.

[0138]

[0139] In order to integrate the information flow from hyperedge to node and retain the characteristics of the original node, residual connection is used to aggregate the node information with the node information through heterogeneous directed hyperedges to obtain enhanced node vectors. Then the graph normalization operation is performed to obtain the implicit vector of the node

[0140]

[0141]

[0142] The following formula aggregates the information of each node to obtain the node vector c, where w is the initialization vector. The convolution layer and pooling layer are introduced to deeply analyze the pattern and structure of the code, improving the model's ability to learn the local features of the node and the overall performance.

[0143]

[0144] cnot=Conv(c)

[0145] More preferably, in an exemplary embodiment, the fusing the first output feature and the second output feature to obtain a total output feature includes:

[0146] Set the hyperparameters representing the output weights;

[0147] The first output feature and the second output feature are fused using the hyperparameter to obtain a total output feature.

[0148] More preferably, in an exemplary embodiment, the bidirectional long short-term memory network model and the hypergraph network model are trained models, and the training process adopts a binary cross entropy loss function.

[0149] Specifically, in this exemplary embodiment, the models are all trained models. The entire training process needs to be processed by constructing a data set and calculating the model loss.

[0150] In the current field of code smell detection, publicly available datasets often have defects in the preprocessing stage, which not only affects the overall quality of the data, but also may weaken the efficiency of the detection task. In view of this, it is particularly important to obtain a high-quality code smell dataset. In order to meet this challenge, the dataset can be preprocessed through rigorous data cleaning and normalization to ensure the accuracy and reliability of the dataset, thereby improving the accuracy and efficiency of detection.

[0151] First, the high-quality open source Java projects on GitHub were screened using the eight quality evaluation indicators provided by RepoReapers (including continuous integration, documentation, history, and unit testing, etc.). Projects from different fields were screened to avoid the influence of code styles in the same field. After evaluation, the project set of code feature attachment adopted by this exemplary embodiment was determined. Then, the codesplitc tool was used to split the source code of the project set into code fragments. Finally, in order to mine the possible smells in the source code, Designite was used and the corresponding code feature attachment smell report was generated. Although Designite showed high precision and recall in the feature attachment experiment, in order to ensure the quality of the data set, 10% of them were verified and the quality of the data set was further confirmed.

[0152] Although the constructed feature attachment datasets are all high-quality projects, there are still some non-standard data, such as unrecognizable class names, uncompilable code, and imbalanced data distribution. In order to ensure the acquisition of high-quality project source code, a series of data cleaning rules are formulated to screen the source code of the project set, involving but not limited to the following aspects:

[0153] a) Classes that are too short or too long in the dataset: In software development practice, developers often create some empty classes as reserved structures for future functional expansion or implementation. These empty classes lack actual code implementation. In addition, there are some samples in the dataset that are too long and have a length that exceeds one standard deviation from the mean. The study of these extreme samples may not be of practical significance. In order to ensure the high quality of the dataset and the effectiveness of the study, empty classes that lack actual code content and samples that are too long are excluded.

[0154] b) Annotations in the dataset: According to the characteristics of code feature attachment, the method of one class shows excessive dependence on the attribute or method of another class. However, the comments in the source code are usually not directly related to the code feature attachment. In order to ensure the accuracy of the model and avoid the interference of irrelevant information on the analysis results, the code comments are excluded to reduce the potential impact of noise on the model performance. This strategy helps to focus more clearly on the actual logic and structure of the code to achieve more accurate feature attachment detection.

[0155] c) Special characters in class names and non-standard elements in code: During the dataset construction process, special characters that may be contained in class names and special symbols and garbled codes that may be mixed in the code were strictly screened and excluded. Special characters in class names may cause problems in reading and parsing source code files, while special symbols and garbled codes may cause exceptions during code parsing, affecting the accuracy of the analysis results. By taking necessary data cleaning measures, class names containing special characters are excluded, and non-standard data elements that may cause misunderstandings are cleaned up, thereby improving the overall quality of the dataset and promoting the standardization of the dataset.

[0156] d) Redundant samples in the dataset: In the process of building a dataset, duplicate code samples may be included. These redundant samples do not provide new information or value to model learning except for increasing storage and computing burden during the training phase. In order to optimize resource usage and avoid the negative impact of redundant data on model training results, all duplicate code instances need to be removed. This strategy not only improves the efficiency of the dataset, but also helps ensure that the analysis and model training process is more accurate and efficient.

[0157] By implementing these data cleaning rules, the dataset not only improves the standardization of the dataset, but also greatly enhances its usability. The application of these rules ensures that the dataset can provide more accurate and reliable analysis results in subsequent code smell detection tasks, which is conducive to in-depth mining of source code characteristics and detection of smells. The dataset preprocessing algorithm is as follows:

[0158] Input: Java project on GitHub

[0159] Output: Code Feature Attachment Smell Dataset

[0160] a) Screen the Java projects on GitHub and select projects from different fields to avoid the influence of code styles in the same field.

[0161] b) Determine the item set of code feature attachment adopted by this exemplary embodiment.

[0162] c) Split the source code of the project set into code snippets.

[0163] d) Data preprocessing and data screening.

[0164] e) Mining feature attachment smells in source code and generating reports.

[0165] f) Verify the quality of the dataset and obtain the code feature attachment dataset.

[0166] As for the loss calculation process: the calculation output of the model is represented by out1 and out2, and the hyperparameter m plays the role of regulating the output weights of the fusion model.

[0167]

[0168] When optimizing the loss of the above two models, the binary cross entropy loss function is used. Where N is the number of samples, p is i refers to the result in the i-th predicted label, and y i It represents the true label of the corresponding i-th item.

[0169]

[0170] The following content will conduct an experimental comparison of the content of the above exemplary embodiments:

[0171] (1) Experimental environment and parameter settings

[0172] For the experimental environment, the following experimental environment and server configuration were selected for the experiment:

[0173]

[0174] In the method of this exemplary embodiment (CSDMLCR), the embedding vector is generated by random initialization, and the training batch is set to 32, and the verification and test batches are set to 256. In order to effectively prevent the model from overfitting, the dropout strategy is introduced and its value is set to 0.2. In terms of the optimization algorithm, Adam is selected, and the initial learning rate is set to 0.001. In terms of model structure, the dimensions of hidden vectors and embedded vectors are both set to 256. In addition, the model covers Bi-LSTM and hypergraph networks. In order to further enhance its expressive power, a multi-head attention mechanism is incorporated, in which the number of heads of each multi-head attention mechanism is 8, and the hypergraph network also adds 3 layers of convolution. In order to ensure that the model can be fully trained and optimized, the number of epochs in the entire training process is set to 50.

[0175] (2) Experimental data

[0176] The same dataset as the existing technology (Sharma T, Efstathiou V, Louridas P, et al. Code smell detection by deep direct-learning and transfer-learning [J]. Journal of Systems and Software, 2021, 176: 110936) is selected, which comes from 500 Java projects on the Github open source platform. In order to ensure the quality of the dataset, projects from different fields are randomly selected to avoid the influence of code styles in the same field, and 100 high-quality Java projects are screened out. After preprocessing, the dataset is divided into training set, validation set and test set in a ratio of 7:2:1 according to the code smell label. The following table shows the specific distribution of the dataset.

[0177]

[0178] (3) Evaluation indicators

[0179] In view of the significant imbalance in the distribution of positive and negative samples in actual projects, we do not consider using accuracy to compare and evaluate various models. This is because even if a model predicts all samples as negative samples, it can still have a high accuracy, but this does not truly reflect the quality of the model. For this reason, we choose to use precision, recall, and F1-score as the core indicators for evaluating model performance.

[0180]

[0181] Precision: Indicates how many samples predicted by the model as positive are actually true positive samples. It is the ratio of true positive samples (TP) to samples predicted as positive samples (TP+FP). The higher the precision, the more accurate the model is in judging a sample as a positive sample.

[0182]

[0183] Recall: Indicates how many samples that are actually positive are correctly predicted as positive. It is the ratio of true positives (TP) to all samples that are actually positive (TP+FN). The higher the recall, the stronger the model's ability to identify positive examples.

[0184]

[0185] F 1 F1-score: The F1 score is the weighted average of precision and recall, which is used to measure the overall performance of the model. Its value range is between 0 and 1. The higher the F1 value, the better the balance between precision and recall. For classification tasks, high precision and recall are ideal, but in practice they usually restrict each other. Therefore, it is necessary to find a balance between the two.

[0186]

[0187] (4) Experimental results

[0188] Although source code representation information is crucial, relatively few studies have used this information to detect code smells. This exemplary embodiment is based on multi-level code representation, and uses source code token sequences and AST to construct heterogeneous directed hypergraphs as code representations for code smell detection tasks. In order to verify the effectiveness of the CSDMLCR model, this exemplary embodiment compares the method with the following three benchmarks: Tushar Sharma, Anh Ho, and Weiwei Xu are the benchmarks for the experiment.

[0189] Tushar Sharma used source code token sequences as code representations, applied a variety of deep learning models (CNN-1D, CNN-2D, RNN, AE) through transfer learning, and performed code smell detection, and proved the feasibility of transfer learning on this task.

[0190] Anh Ho proposed a code smell detection method called DeepSmells. This method applies deep convolutional neural networks (CNN) to learn the complex and abstract features of source code and uses long short-term memory networks (LSTM) to extract semantic information encoded in context.

[0191] Weiwei Xu proposed a method based on abstract syntax tree (AST) (AST-CSD), which uses the abstract syntax tree (AST) to obtain the semantic and structural features of the code to detect code smells.

[0192]

[0193] The above table shows the performance comparison of the CSDMLCR method and other benchmark methods in the code feature attachment detection task. From the performance of the three performance indicators of precision, recall and F1 value (F1-score), the CSDMLCR method achieved 35.83% in precision, 53.18% in recall, and 42.81% in F1 score. By analyzing the key performance indicators, it can be clearly seen that the CSDMLCR method in this exemplary embodiment is completely superior to other methods in performance.

[0194] In terms of precision, the CSDMLCR method performs best with an accuracy of 35.83%, which is 14.44% higher than the highest accuracy among the four methods of Tushar Sharma, and 11.12% and 3.16% higher than Weiwei Xu and Anh Ho, respectively. This shows that the model of this exemplary embodiment has a better performance in terms of the accuracy of code feature attachment detection.

[0195] In terms of recall, the CSDMLCR method performs best with an accuracy of 53.18%, which is 3.02% higher than the highest accuracy of the four methods of TusharSharma and 17.21% higher than Anh Ho. Although Weiwei Xu's recall rate reached a high 52.31%, the model of this exemplary embodiment still won with a slight advantage of 0.87%. This shows that the CSDMLCR method is more capable of correctly detecting positive sample situations.

[0196] In terms of the comprehensive evaluation index F1-score, which takes into account both precision and recall, the model of this exemplary embodiment achieved 42.81%, which is higher than other methods. It is 15.39% higher than the highest precision of Tushar Sharma's four methods, and 9.25% and 8.57% higher than Weiwei Xu and Anh Ho, respectively.

[0197] Tushar Sharma and Anh Ho used source code token sequences as code representation, and Weiwei Xu used abstract syntax trees (AST) as source code representation. The CSDMLCR method not only uses source code token sequences as source code representation, but also expands the source code representation of heterogeneous directed hypergraphs based on AST. Experimental results show that compared with other methods, the CSDMLCR method can better understand the high-level semantic and structural information in the source code and improve the performance of code feature attachment detection.

[0198] After a series of experimental verifications, the CSDMLCR method outperforms other existing studies in the code feature attachment detection task. This method can not only deeply parse the complex structure and rich semantic information of the code, but also show excellent performance in the feature attachment detection task. This exemplary embodiment has made important innovative progress in the field of code smell detection and opened up a new idea based on hypergraphs for this field.

[0199] Obviously, the above embodiments are merely examples for clear explanation, and are not intended to limit the implementation methods. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from them are still within the protection scope of the invention.

Claims

1. A feature attachment detection method based on multi-level code representation, based on Java programming language code, characterized by: The following steps are involved: Converting the Java programming language code to be processed into a token sequence, i.e., a first code representation, and converting the Java programming language code to be processed into a heterogeneous directed hypergraph based on an abstract syntax tree, i.e., a second code representation; Inputting the first code representation into a bidirectional long short-term memory network model to obtain a first output feature, and inputting the second code representation into a hypergraph network model to obtain a second output feature; Fusing the first output feature and the second output feature to obtain a total output feature; A code feature attachment detection is performed on the total output feature to obtain a detection result.

2. The feature attachment detection method based on multi-level code representation according to claim 1, characterized in that: The step of converting the Java programming language code to be processed into a token sequence, i.e., a first code representation, includes: Utilize the parsing function of the javalang library to parse the java programming language code to be processed and convert it into a standardized token sequence.

3. The feature attachment detection method based on multi-level code representation according to claim 1, characterized in that: The step of converting the Java programming language code to be processed into a heterogeneous directed hypergraph based on an abstract syntax tree, i.e., a second code representation, comprises: Use the functions provided by the javalang library to extract the abstract syntax tree from the java programming language code to be processed; A heterogeneous directed hypergraph is constructed based on the extracted abstract syntax tree.

4. The feature attachment detection method based on multi-level code representation according to claim 3 is characterized in that: The abstract syntax tree includes non-identifier nodes and identifier nodes. The non-identifier nodes represent the abstract structure of the code, and their values ​​are directly associated with the type of the corresponding syntax structure, including compilation units, method declarations, member references, and method calls; the identifier nodes are used to identify specific named elements in different code parts, including class names, variable names, and method names; the association between nodes is described by fields, and each field has a clear directionality. If one node contains another node, the former node plays the role of "head" in the relationship, and the other node plays the role of "tail". The name of the field is used to indicate the type of hyperedge, that is, the type of relationship between different nodes; The step of constructing a heterogeneous directed hypergraph based on the extracted abstract syntax tree includes: Initialize an empty graph; Traverse each node in the abstract syntax tree and add identifier nodes or non-identifier nodes to the graph; Traverse each edge in the abstract syntax tree and add the edge to the graph; Return the constructed heterogeneous directed hypergraph G; The heterogeneous directed hypergraph G is represented as a tuple {N(μ,x),E(ρ,T(e),H(e))}; in this structure, the node set N contains a series of nodes, each node includes a node type μ and a node value x; the hyperedge set E includes a series of hyperedges, each edge includes a hyperedge type ρ, a tail node set T(e) and a head node H(e); the hyperedge type ρ represents different relationship types, the tail node set T(e) represents the set of source nodes associated with the hyperedge, and the head node H(e) represents the target node pointed to by the hyperedge, and the direction of the hyperedge e is from T(e) to H(e).

5. The feature attachment detection method based on multi-level code representation according to claim 2, characterized in that: The bidirectional long short-term memory network model includes an input layer, an embedding layer, a bidirectional long short-term memory network layer, a multi-head attention layer, and a fully connected layer from bottom to top; wherein: The embedding layer maps the token sequence input by the input layer into an embedding vector through an index; The bidirectional long short-term memory network layer calculates the embedding vector to obtain a forward hidden state representing the context information on the left and a reverse hidden state representing the context information on the right, and concatenates the forward hidden state and the reverse hidden state to form a complete context representation, that is, a total hidden state corresponding to the entire token sequence; The multi-head attention layer combines the total hidden state and different weight matrices for calculation; The fully connected layer combines the calculations of multiple attention layers for integrated connection.

6. The feature attachment detection method based on multi-level code representation according to claim 4, characterized in that: The step of inputting the second code representation into a hypergraph network model to obtain a second output feature includes: According to the node value x, node type μ and hyperedge type ρ of node N, they are converted into continuous vectors through word embedding as input to the model, and then the high-order semantics and structure in the code are extracted according to the two-stage message passing strategy.

7. The feature attachment detection method based on multi-level code representation according to claim 6, characterized in that: The high-level semantics and structure in the code are extracted according to the two-stage message passing strategy, including: message passing from node to hyperedge and message passing from hyperedge to node.

8. The feature attachment detection method based on multi-level code representation according to claim 7, characterized in that: The message transmission from the node to the hyperedge includes: Use the head matrix and tail matrix to linearly transform the hidden vector of each node to obtain the information vector from the node to the hyperedge; The original hyperedge vector and the information vector from the node to the hyperedge are aggregated using the multi-head attention mechanism information to obtain a hyperedge vector after the aggregation operation; The hyperedge vector after the aggregation operation is integrated with the original hyperedge vector by using a residual connection to obtain an enhanced hyperedge vector; The hyperedge-to-node message transmission includes: Use the head matrix and tail matrix to linearly transform the hidden vector of each node to obtain the information vector from the hyperedge to the node; Using multi-head attention mechanism information, the linearly transformed hidden vector and the hyperedge-to-node information vector are aggregated to obtain a node vector after the aggregation operation; Using residual connection to perform feature fusion on the node vector after the aggregation operation and the hidden vector after the linear transformation to obtain an enhanced node vector; Performing graph normalization on the enhanced node vector to obtain an implicit vector of the node; The implicit vector of the node and the initialization vector are aggregated using multi-head attention mechanism information to obtain a node vector; Convolutional layers are used to parse the patterns and structures of node vectors.

9. The feature attachment detection method based on multi-level code representation according to claim 1, characterized in that: The fusing the first output feature and the second output feature to obtain the total output feature includes: Set the hyperparameters representing the output weights; The first output feature and the second output feature are fused using the hyperparameter to obtain a total output feature.

10. The feature attachment detection method based on multi-level code representation according to claim 1, characterized in that: The bidirectional long short-term memory network model and the hypergraph network model are trained models, and the training process adopts a binary cross entropy loss function.

Citation Information

Cited By

  • Visual anesthesia monitoring system for perioperative patient

    CN119581024A

  • Automatic software reconstruction method based on transfer learning

    CN119917163A

  • An Automated Software Refactoring Method Based on Transfer Learning

    CN119917163B

  • Large model test case intelligent generation system based on big data

    CN120448285A