A knowledge graph retrieval and classification method based on an improved semi-supervised classification model
By improving the semi-supervised classification model and combining GCN, GAT and JK mechanisms, preprocessing and classification of knowledge graph nodes and extending query, the problem of insufficient node classification accuracy and retrieval efficiency in the existing technology is solved, and efficient and accurate knowledge graph retrieval and classification is achieved.
Patent Information
- Application Number
- CN202510771831.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2045-06-11
AI Technical Summary
The existing knowledge graph retrieval and classification methods have shortcomings in node classification accuracy and retrieval efficiency, which is difficult to meet the real-time requirements of complex queries, and insufficient labeling data leads to poor supervised learning results.
The improved semi-supervised classification model is adopted, combined with graph convolutional network (GCN), graph attention network (GAT) and jump connection (JK) mechanisms, and the graph nodes are preprocessed and classified. The similarity score is calculated using the semantic matching algorithm of Jaccard coefficient and Levenshtein distance similarity, and the matching failure is performed to obtain relevant node information through multi-hop path search.
It improves the classification accuracy and retrieval efficiency of graph nodes, improves the coverage and accuracy of query, reduces dependence on labeled data, and adapts to the real-time needs of complex queries.
Smart Images

Figure CN120296179B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information retrieval technology, and in particular to a knowledge graph retrieval and classification method based on an improved semi-supervised classification model. Background Art
[0002] As an efficient knowledge representation method, knowledge graphs have been widely used in intelligent systems, encompassing a variety of application scenarios, including search engines, recommendation systems, question-answering systems, medical diagnosis, and financial risk control. Knowledge graphs, constructed through a graph structure composed of nodes (entities) and edges (relationships), systematically store and organize information and support deep understanding and reasoning of complex data.
[0003] However, common knowledge graph retrieval and classification methods still have certain limitations in practical applications. On the one hand, traditional classification models are often based on manually defined rules or simple graph algorithms, which make it difficult to fully explore the complex relationships and structural information in graph data, resulting in insufficient accuracy in graph node classification. On the other hand, although knowledge graphs themselves have efficient information representation capabilities, during the retrieval process, graph traversal-based methods, especially depth-first search and breadth-first search, although they perform well for small-scale graphs, their time complexity increases significantly when processing complex queries, making it difficult to meet real-time requirements.
[0004] In other words, common knowledge graph retrieval and classification methods still have obvious shortcomings in node classification accuracy and retrieval efficiency, and more optimized solutions are urgently needed to improve their performance.
[0005] The above content is only used to assist in understanding the technical solution of the present invention and does not constitute an admission that the above content is prior art. Summary of the Invention
[0006] The main purpose of the present invention is to provide a knowledge graph retrieval and classification method based on an improved semi-supervised classification model, aiming to solve the problem that common knowledge graph retrieval and classification methods still have obvious deficiencies in node classification accuracy and retrieval efficiency.
[0007] To achieve the above objectives, the present invention provides a knowledge graph retrieval and classification method based on an improved semi-supervised classification model, which comprises the following steps:
[0008] Based on the improved semi-supervised classification model, a pre-processing classification operation is performed on the graph nodes in the knowledge graph to determine the node features of the graph nodes;
[0009] When a query keyword is received, a similarity score between the query keyword and the node feature is calculated based on a semantic matching algorithm combining the Jaccard coefficient and the Levenshtein distance similarity;
[0010] Determining whether a graph entity is matched based on the similarity score and a preset similarity threshold;
[0011] If yes, obtain the graph node corresponding to the query keyword and its directly related nodes; if no, determine the graph node with the highest matching degree based on the similarity score;
[0012] According to the graph node with the highest matching degree, an extended query action is performed to obtain the graph nodes and attribute information related to the query keyword.
[0013] Optionally, the step of performing a preprocessing classification operation on the graph nodes in the knowledge graph based on the improved semi-supervised classification model to determine the node features of the graph nodes includes:
[0014] Based on the graph convolutional network, feature aggregation is performed on the graph nodes to capture the global information of the graph nodes;
[0015] Passing the global information to a graph attention network to determine the attention weights corresponding to the node neighbors of each graph node; and
[0016] Based on the jumping mechanism, the node information of different levels in the global information is integrated to determine the node features of each of the graph nodes.
[0017] Optionally, the graph nodes include labeled nodes and unlabeled nodes, and the step of performing a preprocessing classification operation on the graph nodes in the knowledge graph based on the improved semi-supervised classification model to determine the node features of the graph nodes further includes:
[0018] Based on the label propagation mechanism, the information of the labeled nodes is diffused to the unlabeled nodes.
[0019] Optionally, before the step of performing a preprocessing classification operation on the graph nodes in the knowledge graph based on the improved semi-supervised classification model and determining the node features of the graph nodes, the step further includes:
[0020] training the improved semi-supervised classification model;
[0021] The step of training the improved semi-supervised classification model comprises:
[0022] Performing supervised learning on the improved semi-supervised classification model based on labeled data, and performing unsupervised learning on the improved semi-supervised classification model based on unlabeled data;
[0023] The amount of the labeled data is less than the amount of the unlabeled data.
[0024] Optionally, the step of performing an extended query action based on the graph node with the highest matching degree to obtain graph nodes and attribute information related to the query keyword includes:
[0025] Perform a multi-hop path search based on the graph node with the highest matching degree to obtain an extended result, wherein the extended result includes graph nodes and relationships on all paths;
[0026] Based on the expansion result, the graph nodes and attribute information related to the query keyword are determined.
[0027] Optionally, the step of performing an extended query action based on the graph node with the highest matching degree to obtain graph nodes and attribute information related to the query keyword includes:
[0028] Performing a type classification operation on the query keyword to obtain a classification result corresponding to the query keyword;
[0029] Determining a corresponding query path according to the classification result;
[0030] Execute a query action based on the query path to obtain a query result;
[0031] Expanding actions are performed step by step according to the query results to obtain graph nodes and attribute information related to the query keywords.
[0032] Optionally, the step of performing a preprocessing classification operation on the graph nodes in the knowledge graph based on the improved semi-supervised classification model and determining the node features of the graph nodes further includes:
[0033] Acquire target data and store the target data in a graph database in the form of triples;
[0034] In the graph database, an inverted index structure based on node attributes and relationships is established to form the knowledge graph.
[0035] Optionally, the step of establishing an inverted index structure based on node attributes and relationships in the graph database to form the knowledge graph includes:
[0036] Obtaining the node name, node type, node attributes of each of the graph nodes and the relationship information between the graph nodes;
[0037] Based on the node name, node type, node attributes and the relationship information between the graph nodes, the inverted index structure based on node attributes and relationships is established to form the knowledge graph.
[0038] In addition, to achieve the above-mentioned purpose, the present invention also provides a retrieval and classification device, which includes a memory, a processor, and a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored on the memory and run on the processor. When the knowledge graph retrieval and classification program based on the improved semi-supervised classification model is executed by the processor, the steps of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model as described above are implemented.
[0039] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which is stored a knowledge graph retrieval and classification program based on an improved semi-supervised classification model. When the knowledge graph retrieval and classification program based on the improved semi-supervised classification model is executed by a processor, the steps of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model as described above are implemented.
[0040] The beneficial effects of the present invention are:
[0041] 1. An improved semi-supervised classification model is constructed by combining the feature aggregation mechanism of the graph convolutional network (GCN) and the graph attention network (GAT) with the skip connection (JK) mechanism to classify the graph nodes in the knowledge graph;
[0042] 2. Use the fuzzy matching algorithm (a semantic matching algorithm that combines the Jaccard coefficient and Levenshtein distance similarity) to calculate the similarity score and select the most relevant graph nodes for matching;
[0043] 3. When a match fails, an extended query is performed based on the similarity score, and a multi-hop path search is used to gradually expand the query scope. Finally, based on the user's query type, a dynamic path search strategy is used to return relevant nodes and their attribute information, thereby achieving efficient and accurate knowledge graph retrieval and classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification, serve to explain the principles of the present invention. In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for describing the embodiments. Obviously, it is possible for a person skilled in the art to derive other drawings based on these drawings without inventive effort.
[0045] Figure 1 A schematic diagram of the architecture of the hardware operating environment of the retrieval and classification device involved in an embodiment of the present invention;
[0046] Figure 2 Schematic diagram of the process of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model involved in an embodiment of the present invention;
[0047] Figure 3 Schematic diagram of a detailed process of step S100 in the knowledge graph retrieval and classification method based on the improved semi-supervised classification model according to an embodiment of the present invention;
[0048] Figure 4 This is a diagram of the overall process framework of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model involved in an embodiment of the present invention;
[0049] Figure 5 This is a process framework diagram for determining whether a graph node is matched by a fuzzy matching algorithm in a knowledge graph retrieval and classification method based on an improved semi-supervised classification model according to an embodiment of the present invention;
[0050] Figure 6 This is a process framework diagram of extended query and path search in the knowledge graph retrieval and classification method based on the improved semi-supervised classification model involved in an embodiment of the present invention.
[0051] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0052] With the rapid development of big data and artificial intelligence technologies, knowledge graphs, as an efficient knowledge representation method, have been widely used in various intelligent application fields, including but not limited to search engines, recommendation systems, intelligent question-answering, medical-assisted diagnosis, and financial risk control. Knowledge graphs, through their graph structure constructed from nodes (entities) and edges (relationships), enable systematic organization and efficient storage of information. They not only support in-depth understanding of complex data but also possess powerful logical reasoning capabilities. However, despite the ever-expanding application scope of knowledge graphs, existing retrieval and classification methods still face numerous technical challenges in practical application.
[0053] Traditional knowledge graph retrieval and classification methods primarily employ rule-based classification models or graph-based algorithms. These methods rely excessively on manually defined rules, making it difficult to fully exploit the complex relationships and structural information in graph data, resulting in generally low entity classification accuracy. Particularly when processing large-scale knowledge graphs, these methods face significant performance bottlenecks, and their classification results often struggle to meet the demands of practical applications. Regarding retrieval efficiency, while knowledge graphs inherently possess efficient information representation capabilities, common graph-traversal-based retrieval methods (such as depth-first search and breadth-first search) often exhibit high time complexity when processing complex queries, making it difficult to meet real-time requirements. Furthermore, insufficient labeled data is another challenge currently facing knowledge graph retrieval and classification. In specialized field applications, obtaining labeled data is difficult and costly, making it difficult for traditional supervised learning methods to effectively train models.
[0054] Given the complexity of the graph structure of knowledge graphs, the diversity of graph node types and relationship types, and the multi-level relationship network between entities, although graph neural networks (GNNs) can effectively capture the local relationships between graph nodes through convolution operations, as the network depth increases, the "over-smoothing" phenomenon commonly found in graph convolutional networks (GCNs) will cause node features to gradually converge, resulting in information loss and degraded model performance.
[0055] To solve the above problems, this application proposes a knowledge graph retrieval and classification method based on an improved semi-supervised classification model. Based on the improved semi-supervised classification model, a pre-processing classification operation is performed on the graph nodes in the knowledge graph to determine the node features of the graph nodes. When a query keyword is received, a semantic matching algorithm combining the Jaccard coefficient and the Levenshtein distance similarity is used to calculate the similarity score between the query keyword and the node features. Based on the similarity score and a preset similarity threshold, it is determined whether the graph entity is matched. If not, the graph node with the highest matching degree is determined based on the similarity score. Based on the graph node with the highest matching degree, an extended query action is performed to obtain the graph nodes and their attribute information related to the query keyword. This achieves the purpose of improving the classification accuracy of graph nodes, improving the matching accuracy between query keywords and graph nodes, and improving the coverage and accuracy of retrieval.
[0056] To better understand the above technical solutions, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0057] As an implementation solution, Figure 1 This is a schematic diagram of the architecture of the hardware operating environment of the retrieval and classification device involved in the embodiment of the present invention.
[0058] like Figure 1 As shown, the retrieval and classification device may include: a processor 101, such as a central processing unit (CPU), a memory 102, and a communication bus 103. Memory 102 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk drive. Memory 102 may also be a storage device independent of processor 101. Communication bus 103 is used to connect and communicate between these components.
[0059] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the retrieval and classification device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0060] like Figure 1 As shown, the memory 102 as a computer-readable storage medium may include an operating system, a data storage module, a network communication module, a user interface module, and a knowledge graph retrieval and classification method program based on an improved semi-supervised classification model.
[0061] exist Figure 1 In the retrieval and classification device shown, the processor 101 and the memory 102 can be set in the retrieval and classification device. The retrieval and classification device calls the knowledge graph retrieval and classification program based on the improved semi-supervised classification model stored in the memory 102 through the processor 101, and performs the following operations:
[0062] Based on the improved semi-supervised classification model, a pre-processing classification operation is performed on the graph nodes in the knowledge graph to determine the node features of the graph nodes;
[0063] When a query keyword is received, a similarity score between the query keyword and the node feature is calculated based on a semantic matching algorithm combining the Jaccard coefficient and the Levenshtein distance similarity;
[0064] Determining whether a graph entity is matched based on the similarity score and a preset similarity threshold;
[0065] If yes, obtain the graph node corresponding to the query keyword and its directly related nodes; if no, determine the graph node with the highest matching degree based on the similarity score;
[0066] According to the graph node with the highest matching degree, an extended query action is performed to obtain the graph nodes and attribute information related to the query keyword.
[0067] In an embodiment, the processor 101 may be configured to call a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored in the memory 102 and perform the following operations:
[0068] Based on the graph convolutional network, feature aggregation is performed on the graph nodes to capture the global information of the graph nodes;
[0069] Passing the global information to a graph attention network to determine the attention weights corresponding to the node neighbors of each graph node; and
[0070] Based on the jumping mechanism, the node information of different levels in the global information is integrated to determine the node features of each of the graph nodes.
[0071] In an embodiment, the processor 101 may be configured to call a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored in the memory 102 and perform the following operations:
[0072] Based on the label propagation mechanism, the information of the labeled nodes is diffused to the unlabeled nodes.
[0073] In an embodiment, the processor 101 may be configured to call a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored in the memory 102 and perform the following operations:
[0074] training the improved semi-supervised classification model;
[0075] The step of training the improved semi-supervised classification model comprises:
[0076] Performing supervised learning on the improved semi-supervised classification model based on labeled data, and performing unsupervised learning on the improved semi-supervised classification model based on unlabeled data;
[0077] The amount of the labeled data is less than the amount of the unlabeled data.
[0078] In an embodiment, the processor 101 may be configured to call a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored in the memory 102 and perform the following operations:
[0079] Perform a multi-hop path search based on the graph node with the highest matching degree to obtain an extended result, wherein the extended result includes graph nodes and relationships on all paths;
[0080] Based on the expansion result, the graph nodes and attribute information related to the query keyword are determined.
[0081] In an embodiment, the processor 101 may be configured to call a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored in the memory 102 and perform the following operations:
[0082] Performing a type classification operation on the query keyword to obtain a classification result corresponding to the query keyword;
[0083] Determining a corresponding query path according to the classification result;
[0084] Execute a query action based on the query path to obtain a query result;
[0085] Expanding actions are performed step by step according to the query results to obtain graph nodes and attribute information related to the query keywords.
[0086] In an embodiment, the processor 101 may be configured to call a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored in the memory 102 and perform the following operations:
[0087] Acquire target data and store the target data in a graph database in the form of triples;
[0088] In the graph database, an inverted index structure based on node attributes and relationships is established to form the knowledge graph.
[0089] In an embodiment, the processor 101 may be configured to call a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored in the memory 102 and perform the following operations:
[0090] Obtaining the node name, node type, node attributes of each of the graph nodes and the relationship information between the graph nodes;
[0091] Based on the node name, node type, node attributes and the relationship information between the graph nodes, the inverted index structure based on node attributes and relationships is established to form the knowledge graph.
[0092] Based on the hardware architecture of the above-mentioned retrieval and classification device, an embodiment of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model of the present invention is proposed.
[0093] Reference Figure 2 In an embodiment, the knowledge graph retrieval and classification method based on the improved semi-supervised classification model includes the following steps:
[0094] Step S100: Based on the improved semi-supervised classification model, preprocessing classification operations are performed on the graph nodes in the knowledge graph to determine the node features of the graph nodes.
[0095] In this embodiment, an improved semi-supervised classification model pre-processes and classifies graph nodes in the knowledge graph to improve the classification quality of the graph nodes and optimize the retrieval effect in subsequent queries. It should be noted that the improved semi-supervised model refers to the GAT-GCN-JK model, where GAT refers to the graph attention network, GCN refers to the graph convolutional network, and JK (Jumping Knowledge) refers to the jump connection mechanism.
[0096] Optionally, before adopting the above-mentioned improved semi-supervised model to perform the preprocessing classification operation, it also includes model training, that is, training the improved semi-supervised classification model. The step of training the improved semi-supervised classification model includes performing supervised learning on the improved semi-supervised classification model based on labeled data, and performing unsupervised learning on the improved semi-supervised classification model based on unlabeled data, so as to obtain the improved semi-supervised model. It should be noted that the amount of the labeled data is less than the amount of the unlabeled data. It can be understood that by using a small amount of labeled data for supervised learning and a large amount of unlabeled data for unsupervised learning, the generalization ability of the improved semi-supervised model is enhanced through the label propagation mechanism; during the learning process, the improved semi-supervised model can adjust the classification of nodes according to the structural relationship and attribute information between nodes.
[0097] Specifically, the optimization objective function of the improved semi-supervised classification model can be expressed as:
[0098]
[0099] Where, is the cross entropy loss function, is the true label, To predict the label, is the regularization term, is the regularization coefficient, N is the total number of nodes, and M is the number of model parameters.
[0100] In the improved semi-supervised classification model, GCN aggregates the features of graph nodes during pre-processing and classification. GAT, based on this, assigns attention weights to the neighbors of each graph node. Finally, a skip connection mechanism is used to fuse node information from different layers. The improved semi-supervised classification model effectively aggregates information from the neighbors of graph nodes, and the influence of different node neighbors can be adjusted using the graph attention mechanism.
[0101] In this embodiment, the improved semi-supervised classification model combines a graph convolutional network with a graph attention network and introduces a skip connection mechanism to classify graph nodes in the graph. This is done to improve the effectiveness of graph node classification. In addition, the use of a skip connection mechanism to fuse node information from different layers can alleviate the over-smoothing problem in deep networks, thereby improving the accuracy and robustness of node classification.
[0102] Optionally, in a knowledge graph, graph nodes include labeled nodes and unlabeled nodes. The step of performing a preprocessing classification operation on the graph nodes in the knowledge graph based on the improved semi-supervised classification model and determining node features of the graph nodes further includes, based on a label propagation mechanism, diffusing information of the labeled nodes to the unlabeled nodes.
[0103] Understandably, most graph nodes in knowledge graphs are typically unlabeled (lacking category or attribute labels). Label propagation leverages known information about labeled nodes to infer labels for unlabeled nodes through graph connectivity (such as attention weights and node neighborhood similarity), thereby expanding the training data size and reducing reliance on manual labeling. Furthermore, label propagation iteratively updates the label distribution of nodes, aligning the labels of adjacent graph nodes. This captures implicit connections between graph nodes and improves classification accuracy, particularly for relationally dense knowledge graphs. Furthermore, through the diffusion process, unlabeled nodes acquire temporary or probabilistic labels. This information can be fed into subsequent classification models as supplementary features (such as label probability vectors), supporting a more comprehensive understanding of the semantics and contextual relationships of graph nodes. Furthermore, label propagation requires only a small amount of initial annotation to generalize to the entire knowledge graph, avoiding the high annotation costs of fully supervised learning. Its computational complexity is typically lower than end-to-end training, making it suitable for quickly generating preliminary classification results during the preprocessing phase.
[0104] In other words, by leveraging the transitivity of graph structures, we maximize the use of limited labeled information, enabling unlabeled nodes to receive pseudo-labels or feature enhancements that match their topological positions, thereby improving the accuracy and robustness of subsequent classification tasks. By combining GCN, GAT, and the JK mechanism into an improved semi-supervised classification model, we improve the accuracy of graph node classification. Even when labeled data is scarce, we can fully utilize unlabeled data for learning, thereby providing more accurate node classification results in retrieval.
[0105] Furthermore, before the step of pre-processing and classifying the graph nodes using the improved semi-supervised classification model, it also includes obtaining target data and storing the target data in the form of triples in the graph database; then, in the graph database, an inverted index structure based on node attributes and relationships is established to form the knowledge graph.
[0106] In this embodiment, a graph database refers to a database system specifically designed for storing and processing graph-structured data. It uses nodes, edges, and attributes as core elements, and intuitively expresses the relationships between entities through a graph-theoretic model. The triple form refers to the "entity-relationship-entity" format. This inverted index structure, based on node attributes and relationships, is understood to be used to index these node attributes and relationships, thereby optimizing query performance.
[0107] As an optional implementation method, the knowledge graph is stored in the graph database Neo4j in the form of triples. Each triple represents the basic entity relationship in the knowledge graph. In this way, all entities and their relationships in the knowledge graph are stored in a structured manner, thereby providing data support for subsequent retrieval and classification.
[0108] Optionally, the step of establishing the above-mentioned inverted index structure includes obtaining the node name, node type, node attributes of each of the graph nodes and the relationship information between the graph nodes; then, based on the node name, node type, node attributes and the relationship information between the graph nodes, establishing the inverted index structure based on node attributes and relationships to form the knowledge graph.
[0109] Specifically, the inverted index structure can be expressed by the following formula:
[0110]
[0111] Among them, n represents the graph node, Represents the relationship associated with node n.
[0112] It can be understood that based on the characteristics prepared by the inverted index structure, by establishing an inverted index structure, it is possible to efficiently retrieve graph nodes and their relationships related to the query keywords, improve the speed and accuracy of graph queries, and thus optimize subsequent retrieval and classification processes.
[0113] Step S200: When a query keyword is received, a similarity score between the query keyword and the node feature is calculated based on a semantic matching algorithm combining the Jaccard coefficient and the Levenshtein distance similarity.
[0114] In this embodiment, the received query keywords are user-entered. The Jaccard coefficient (set overlap) excels at capturing the degree of term overlap between keywords and node features. The Levenshtein distance (edit distance) measures spelling or morphological similarity, addressing spelling variations or abbreviations. The combination of the Jaccard coefficient and Levenshtein distance covers both exact and fuzzy matches at the lexical level, thereby reducing mismatches caused by terminology discrepancies.
[0115] Optionally, in the semantic matching algorithm, the calculation formula for the semantic matching similarity score is:
[0116]
[0117] in, is the Jaccard coefficient, is the edit distance similarity, is the weight coefficient. It should be noted that Preferably, We choose 0.5 to obtain the highest information retrieval accuracy. We combine the similarities of the two weighted values to fully consider different types of matching situations.
[0118] As you can understand, the Jaccard coefficient is a measure of the similarity and difference between different finite sample sets. When solving the Jaccard coefficient between the query keyword w and the graph entity e, the two can be regarded as a set of character sequences. First, calculate the number of identical characters between the two, Same(w,e), and then calculate the Jaccard coefficient using the Jaccard coefficient calculation formula. The Jaccard coefficient calculation formula is:
[0119]
[0120] Among them, the Sizeh function represents the number of different characters in the string, w is the query keyword, and e is the graph entity.
[0121] Optionally, edit distance similarity The calculation formula is:
[0122]
[0123] Where, is the edit distance between the search term and the node name, Refers to the length of the word with more characters in the query keyword and graph entity e, which is used to normalize the length of the two strings. It is used to reflect the degree of difference between the two, and refers to the minimum number of operations to convert the string w into e. Specifically, it is calculated by the dynamic programming algorithm, and the calculation formula is:
[0124]
[0125] in, i is the position of the character in the query term, j is the position of the character in the node.
[0126] By combining the Jaccard coefficient and edit distance similarity in a weighted manner, the purpose of improving the tolerance to synonyms, spelling errors and fuzzy matching is achieved.
[0127] The semantic matching algorithm improves the matching accuracy between query keywords and graph nodes by combining the Jaccard coefficient and edit distance, effectively dealing with fuzzy matching problems such as synonyms and spelling errors.
[0128] Step S300: Determine whether a graph entity is matched based on the similarity score and a preset similarity threshold.
[0129] In this embodiment, by quantitatively evaluating the semantic association strength between query keywords and graph nodes and combining it with a preset similarity threshold, accurate matching and fault-tolerant retrieval are achieved to ensure that the query results are highly consistent with the user's intentions, and problems caused by terminology differences and spelling errors are avoided through threshold boundary judgment.
[0130] It should be noted that the preset similarity threshold can be adjusted according to the actual needs of different application scenarios. For example, in a medical atlas, a higher preset similarity threshold is required for disease names to ensure strict matching and avoid misdiagnosis.
[0131] Step S400: If yes, obtain the graph node corresponding to the query keyword and its directly related nodes; if no, determine the graph node with the highest matching degree based on the similarity score;
[0132] In this embodiment, different execution strategies are adopted based on the matching results. When the query keyword matches a graph node, the graph node and its directly related nodes are returned. When the query keyword does not match the graph node, the most relevant node is selected as the "anchor" based on the similarity score ranking for subsequent expanded queries.
[0133] When the query keyword does not match the graph node, that is, when the similarity scores of each graph node are less than the preset similarity threshold, the graph node with the highest matching degree, that is, the graph node with the highest similarity score, is selected as the benchmark for subsequent expanded queries to ensure that the expansion starting point has semantic relevance.
[0134] Step S500: Based on the graph node with the highest matching degree, an extended query action is performed to obtain graph nodes and attribute information related to the query keyword.
[0135] In this embodiment, based on the graph node with the highest matching degree, an extended query action is performed to expand the query scope and obtain more relevant information.
[0136] Optionally, step S500 includes performing a multi-hop path search based on the graph node with the highest matching degree to obtain an expanded result, wherein the expanded result includes graph nodes and relationships on all paths; and determining, based on the expanded result, graph nodes and attribute information related to the query keyword. It should be noted that the maximum depth of the path search can be specified by the user.
[0137] As you can understand, the basic process of multi-hop path search includes anchor point positioning, path expansion, and result screening. In anchor point positioning, the graph node with the highest similarity is used as the starting point. In path expansion, starting from the anchor point, the edges of the knowledge graph are traversed hop by hop, where one-hop neighbors are directly connected nodes, and two-hop neighbors are neighbors of neighbors. In result screening, irrelevant nodes are filtered out based on path weight, node type, or semantic relevance. It should be noted that when performing a multi-hop path search, path depth control can be performed, that is, limiting the maximum number of hops to, for example, 3 hops, to avoid search space explosion.
[0138] Multi-hop path search expands the search scope while ensuring efficiency by traversing the graph with a limited step length, so as to solve the problems of semantic gap and annotation sparsity in knowledge graphs.
[0139] Furthermore, the step of performing an expanded query action based on the graph node with the highest matching degree to obtain graph nodes and attribute information related to the query keyword also includes performing a type classification operation on the query keyword to obtain a classification result corresponding to the query keyword; then, determining a corresponding query path based on the classification result; and, performing a query action based on the query path to obtain a query result; then, gradually performing expansion actions based on the query result to obtain graph nodes and attribute information related to the query keyword. It should be noted that there are multiple groups of graph nodes and attribute information related to the query keyword for the user to select.
[0140] Specifically, the formula used for the extended query is:
[0141]
[0142] Where, is a node The set of neighbor nodes of is a node For Node The attention coefficient, It is The weight matrix of the layer, is a node In the Through recursive expansion, the relevance of the query node is gradually improved to ensure that highly relevant query results are returned.
[0143] Alternatively, the optimization process of path search can be expressed as:
[0144]
[0145] Where, Represents the path extension result, are the nodes on the path, is the path depth. The path depth can be adjusted based on the query type entered by the user and the number of nodes that need to be returned.
[0146] Through the path search strategy, the query scope can be flexibly expanded, and relevant nodes and their attribute information can be dynamically returned to achieve the purpose of improving the coverage and accuracy of the retrieval.
[0147] As an optional implementation method, the improved semi-supervised classification model sorts the query results according to the node type and node attribute information during the query process to ensure that the returned graph nodes are more semantically relevant to the query keywords, further improving the accuracy of the retrieval.
[0148] As another optional implementation method, the query results finally returned are output in JSON format, including matching graph nodes, expansion nodes and their triple relationships, and attached classification label information of the graph nodes, to facilitate front-end display and user interaction.
[0149] In the technical solution provided in this embodiment, by combining the improved semi-supervised classification model of GCN, GAT and JK mechanism, the graph nodes are pre-processed and classified, and the node features of the graph nodes are determined. The node features formed in the classification stage not only contain the original attributes, but also integrate the contextual semantics inferred by label propagation, making the node feature expression more comprehensive and enhancing the model's classification ability for sparse or long-tail nodes, thereby achieving the purpose of improving the node classification accuracy.
[0150] Through the semantic matching algorithm that combines the Jaccard coefficient and Levenshtein distance similarity, the similarity score between the query keywords and the node features is calculated to reduce the mismatch caused by terminology differences; and low-quality matches are filtered out by a preset similarity threshold, and then the node expansion query is performed by determining the graph node with the highest matching degree, avoiding the retrieval omissions caused by strict matching in traditional methods, thereby achieving the purpose of improving query matching accuracy.
[0151] By improving the semi-supervised classification model and pre-processing the graph nodes, the classification task is converted into iterative calculation on the graph, reducing the computational burden of real-time retrieval. The extraction of directly associated graph nodes and attribute information in extended queries fully utilizes the topological connectivity of the knowledge graph. Even if the query keyword completely matches an entity, the results can still be expanded through associated nodes, thereby improving the retrieval recall rate and thus improving the efficiency and coverage of the retrieval.
[0152] In other words, this embodiment provides a knowledge graph retrieval and classification method based on an improved semi-supervised classification model, which uses graph structure information to complete insufficient annotations and improve classification robustness; integrates multi-dimensional semantic similarity to solve the problem of terminology differences; and uses an extended query mechanism to break through strict matching restrictions, taking into account both efficiency and coverage.
[0153] In an embodiment, Figure 3 As shown, step S100 also includes:
[0154] Step S110: Based on the graph convolutional network, perform feature aggregation on the graph nodes to capture the global information of the graph nodes;
[0155] Step S120: passing the global information to the graph attention network to determine the attention weights corresponding to the node neighbors of each graph node; and
[0156] Step S130: Based on the jumping mechanism, the node information of different levels in the global information is integrated to determine the node features of each of the graph nodes.
[0157] In this embodiment, a graph convolutional network is used to aggregate node information of each graph node's node neighbors, thereby updating the node's features. The basic operation of GCN is a message passing mechanism, that is, a graph node aggregates information based on the features of its node neighbors. In each layer of graph convolution, the feature vector of the graph node is obtained by weighted summation of the feature vectors of its node neighbors. The feature update formula for each node is:
[0158]
[0159] In the formula Represents a graph node In the Feature representation of the layer. Is a graph node The node neighbor set. and Node and its neighboring nodes degree. It is The weight matrix of the layer, Is a node neighbor In the Characteristics of the layer. is the activation function ReLU. This formula indicates that the features of each graph node are updated by aggregating the node features of its node neighbors and using a regularization factor To adjust the impact of node degree on information dissemination.
[0160] The attention mechanism is introduced through the graph attention network, so that each graph node can give different weights to different node neighbors according to the node characteristics of its node neighbors. This mechanism can adaptively adjust the influence of node neighbors on the current node information update. and its node neighbors , graph node The representation is updated to:
[0161]
[0162] Where, Is a graph node Updated feature representation. Is a node neighbor characteristics. is the weight matrix. is the weight calculated by the attention mechanism, representing the graph node Node neighbors Attention weight Calculated as follows:
[0163]
[0164] Where, is a parameter used to calculate the attention coefficient. LeakyReLU() is an activation function. When the input is positive, the output is the same as the input; when the input is negative, the output is the negative value of the input multiplied by a very small constant (taken as 0.01). Represents the concatenation operation of feature vectors. The function ensures that the weight coefficients are normalized. Through this attention mechanism, GAT can adaptively adjust the weights according to the characteristics of each node's neighbors, allowing the model to capture important structural information in the graph data.
[0165] In this embodiment, the skip connection mechanism is used to fuse node features from different layers, thereby enhancing the representation capability of graph nodes. Traditional GNNs can usually only use node features from the current layer for classification, while skip connections aggregate node features from multiple layers together, improving the model's representation capability. The final feature representation of the graph node can be calculated as follows:
[0166]
[0167] Where, 、 、 、 Is a graph node In the feature representation of layers 1 to L, Concat means concatenating these feature vectors. The role of skip connections is to merge feature information from different layers, allowing nodes to obtain contextual information from different depths, which is particularly important for complex graph data.
[0168] During the node classification process, the optimization goal of the GCN-GAT-JK model is to improve the accuracy of node classification by minimizing the cross entropy loss function. The optimization objective function of the model is as follows:
[0169]
[0170] Where, is the cross entropy function of node i, is the true label of the node, is the predicted label of the node, is a regularization term used to avoid overfitting. is the regularization coefficient, which is used to adjust the strength of regularization. N is the total number of nodes, and M is the number of model parameters. By minimizing this loss function, the model can learn the optimal feature representation of the nodes and improve the accuracy of node classification.
[0171] In the technical solution provided in this embodiment, the improved semi-supervised classification model can perform efficient node classification on graph data, and in a semi-supervised learning environment, it can use a small amount of labeled data and a large amount of unlabeled data for training, thereby improving the classification effect.
[0172] In an embodiment, Figure 4 As shown in the figure, the overall process of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model is as follows: first, the knowledge graph is constructed; then, the improved semi-supervised classification model (GAT-GCN-JK) classifies the nodes; then, a fuzzy matching algorithm (semantic matching algorithm) is used to determine whether a graph node matches. If so, the matched graph node and its information are returned, and the process ends. If not, an extended query is performed. In the extended query, the extended query action is executed based on the path depth. After the extended query is completed, the query results (relevant nodes and attributes) are returned, and the process ends.
[0173] In this embodiment, if Figure 5As shown in the figure, the process of determining whether a graph node is matched using the fuzzy matching algorithm is as follows: after receiving the query keyword input by the user, the similarity between the query keyword and the graph node is calculated; then, a determination is made as to whether the similarity score reaches a preset similarity threshold. If so, the matching graph node and its information are returned, and the query result is output. If not, an expanded query is performed, and the query result after the expanded node is calculated is output.
[0174] Furthermore, if Figure 6 As shown, the process of the above-mentioned extended query and path search is as follows: after obtaining the query keyword type input by the user, the query type is determined and the query path is selected; then, the query path is expanded, the path depth is dynamically adjusted, and after returning more nodes according to user needs, the results of the extended query (graph nodes and their attribute information related to the query keyword) are returned.
[0175] The present invention also provides a computer-readable storage medium, which stores a knowledge graph retrieval and classification program based on an improved semi-supervised classification model. When the knowledge graph retrieval and classification program based on the improved semi-supervised classification model is executed by a processor, it implements the various steps of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model described in the above embodiment.
[0176] The computer-readable storage medium may be any computer-readable storage medium that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.
[0177] It should be noted that since the storage medium provided in the embodiments of this application is the storage medium used to implement the method of the embodiments of this application, based on the method described in the embodiments of this application, those skilled in the art will be able to understand the specific structure and deformation of the storage medium, and therefore will not be described in detail here. All storage media used in the method of the embodiments of this application fall within the scope of protection to be provided by this application.
[0178] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0179] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0180] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0181] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0182] It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several distinct components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second and third etc. does not indicate any order. These words may be interpreted as names.
[0183] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0184] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A knowledge graph retrieval and classification method based on an improved semi-supervised classification model, characterized in that: The method comprises the following steps: Based on the improved semi-supervised classification model, a pre-processing classification operation is performed on the graph nodes in the knowledge graph to determine the node features of the graph nodes; When a query keyword is received, a similarity score between the query keyword and the node feature is calculated based on a semantic matching algorithm combining the Jaccard coefficient and the Levenshtein distance similarity; Determining whether a graph entity is matched based on the similarity score and a preset similarity threshold; If yes, obtain the graph node corresponding to the query keyword and its directly related nodes; if no, determine the graph node with the highest matching degree based on the similarity score; According to the graph node with the highest matching degree, an extended query action is performed to obtain graph nodes and attribute information related to the query keyword; The improved semi-supervised classification model refers to the GAT-GCN-JK model, where GAT refers to the graph attention network, GCN refers to the graph convolutional network, and JK refers to the skip connection mechanism; The graph convolutional network is used to aggregate the node information of the node neighbors of each graph node, thereby updating the node features. In each layer of graph convolution, the feature vector of the graph node is obtained by weighted summation of the feature vectors of its node neighbors. The feature update formula for each node is: ; In the formula Represents a graph node In the The feature representation of the layer, Is a graph node The node neighbor set, and Node and its neighboring nodes The degree, It is The weight matrix of the layer, Is a node neighbor In the Layer characteristics, is the activation function ReLU, which means that the features of each graph node are updated by aggregating the node features of its node neighbors and using a regularization factor To adjust the impact of node degree on information dissemination; The attention mechanism is introduced through the graph attention network, so that each graph node can give different weights to different node neighbors according to the node characteristics of its node neighbors. and its node neighbors , graph node The representation is updated to: ; Where, Is a graph node The updated feature representation, Is a node neighbor Features, is the weight matrix, is the weight calculated by the attention mechanism, representing the graph node Node neighbors Attention weight Calculated as follows: ; Where, is the parameter used to calculate the attention coefficient, represents the concatenation operation of feature vectors, The function ensures that the weight coefficients are normalized; The skip connection mechanism is used to fuse node features from different layers, thereby enhancing the representation capability of graph nodes. The final feature representation of graph nodes can be calculated as follows: ; Where, 、 、 、 Is a graph node In the feature representation of the 1st to the Lth layer, Concat means splicing these feature vectors together.
2. The knowledge graph retrieval and classification method based on the improved semi-supervised classification model according to claim 1, characterized in that: The graph nodes include labeled nodes and unlabeled nodes. The step of performing a preprocessing classification operation on the graph nodes in the knowledge graph based on the improved semi-supervised classification model and determining the node features of the graph nodes further includes: Based on the label propagation mechanism, the information of the labeled nodes is diffused to the unlabeled nodes.
3. The knowledge graph retrieval and classification method based on the improved semi-supervised classification model according to claim 1, characterized in that: Before the step of performing a preprocessing classification operation on the graph nodes in the knowledge graph based on the improved semi-supervised classification model and determining the node features of the graph nodes, the method further includes: training the improved semi-supervised classification model; The step of training the improved semi-supervised classification model comprises: Performing supervised learning on the improved semi-supervised classification model based on labeled data, and performing unsupervised learning on the improved semi-supervised classification model based on unlabeled data; The amount of the labeled data is less than the amount of the unlabeled data.
4. The knowledge graph retrieval and classification method based on the improved semi-supervised classification model according to claim 1, characterized in that: The step of performing an extended query action based on the graph node with the highest matching degree to obtain graph nodes and attribute information related to the query keyword includes: Perform a multi-hop path search based on the graph node with the highest matching degree to obtain an extended result, wherein the extended result includes graph nodes and relationships on all paths; Based on the expansion result, the graph nodes and attribute information related to the query keyword are determined.
5. The knowledge graph retrieval and classification method based on the improved semi-supervised classification model according to claim 1, characterized in that: The step of performing an extended query action based on the graph node with the highest matching degree to obtain graph nodes and attribute information related to the query keyword includes: Performing a type classification operation on the query keyword to obtain a classification result corresponding to the query keyword; Determining a corresponding query path according to the classification result; Execute a query action based on the query path to obtain a query result; Expanding actions are performed step by step according to the query results to obtain graph nodes and attribute information related to the query keywords.
6. The knowledge graph retrieval and classification method based on the improved semi-supervised classification model according to claim 1, characterized in that: The step of performing a preprocessing classification operation on the graph nodes in the knowledge graph based on the improved semi-supervised classification model and determining the node features of the graph nodes also includes: Acquire target data and store the target data in a graph database in the form of triples; In the graph database, an inverted index structure based on node attributes and relationships is established to form the knowledge graph.
7. The knowledge graph retrieval and classification method based on the improved semi-supervised classification model according to claim 6, characterized in that: The step of establishing an inverted index structure based on node attributes and relationships in the graph database to form the knowledge graph includes: Obtaining the node name, node type, node attributes of each of the graph nodes and the relationship information between the graph nodes; Based on the node name, node type, node attributes and the relationship information between the graph nodes, the inverted index structure based on node attributes and relationships is established to form the knowledge graph.
8. A retrieval and classification device, characterized in that: The retrieval and classification device includes: a memory, a processor, and a knowledge graph retrieval and classification program based on an improved semi-supervised classification model stored in the memory and runnable on the processor. The knowledge graph retrieval and classification program based on the improved semi-supervised classification model is configured to implement the steps of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model as described in any one of claims 1 to 7.
9. A readable storage medium, characterized in that The readable storage medium stores a knowledge graph retrieval and classification program based on an improved semi-supervised classification model. When the knowledge graph retrieval and classification program based on the improved semi-supervised classification model is executed by the processor, the steps of the knowledge graph retrieval and classification method based on the improved semi-supervised classification model as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Node relation graph processing method and device, equipment and storage medium
CN112989134A
Project evaluation and review method and system fused with natural language processing
CN118780767A