A node classification method, apparatus, electronic device, and storage medium
By generating enhanced feature representations through topology-aware graph processing and semantic-aware processing, the problem of aligning graph data with the space of a large language model is solved, and the model's cross-domain node classification ability is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-23
- Publication Date
- 2026-03-06
AI Technical Summary
The spatial differences between graph data and large language models make direct fusion difficult, resulting in low model generalization ability in node classification tasks.
The node feature representations are fused by topology-aware graph processing and semantic-aware processing to generate enhanced feature representations, and then classified using a large language model.
Alignment between the graph and the language space was achieved, improving the model's generalization ability and classification accuracy in cross-domain node classification tasks.
Smart Images

Figure CN120523944B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a node classification method, apparatus, electronic device, and storage medium. Background Technology
[0002] Currently, the spatial alignment between graph data and language models is a core challenge. Specifically, graph data is essentially a non-Euclidean space, defined by adjacency matrices and node interactions; while large language models process sequential text based on optimized Euclidean vector spaces. Therefore, this structural difference leads to representational incompatibility between graph data and language models.
[0003] It is evident that due to their spatial differences, it is difficult to directly integrate graph data with the language space of a large language model. Consequently, spatial alignment issues exist in node classification tasks, resulting in low generalization ability of the model. Summary of the Invention
[0004] This application provides a node classification method, apparatus, electronic device, and storage medium to align graph data with the language space in node classification tasks, effectively improving the model's cross-domain generalization ability.
[0005] In a first aspect, embodiments of this application provide a node classification method, including:
[0006] Obtain the text attribute graph to be processed, the text attribute graph including multiple nodes;
[0007] Each of the plurality of nodes is subjected to topology-aware graph processing to obtain a topology-aware graph representation of each node, and each of the nodes is subjected to semantic-aware processing to obtain a semantic-aware representation of each node. The topology-aware graph representation is used to map each node to a unified latent space.
[0008] The topology-aware graph representation and the semantic-aware representation of each node are fused to obtain the enhanced feature representation of each node;
[0009] The enhanced feature representation of each node is classified using a large language model to obtain the classification result for each node.
[0010] Optionally, the step of performing topology-aware graph processing on each of the plurality of nodes to obtain a topology-aware graph representation of each node includes:
[0011] The text attribute graph is processed to obtain the first adjacency matrix corresponding to the text attribute graph;
[0012] The first adjacency matrix is Laplace normalized to obtain the second adjacency matrix;
[0013] The second adjacency matrix is subjected to singular value decomposition to obtain a topology-aware graph representation of each node.
[0014] Optionally, the step of performing semantic awareness processing on each node to obtain a semantic awareness representation of each node includes:
[0015] The text information corresponding to each node is processed to obtain the embedding vector of each word corresponding to each node;
[0016] The semantic embedding of each node is obtained by calculating the embedding vector of each word corresponding to each node using the inverse document frequency algorithm.
[0017] The semantic embedding of each node is subjected to graph encoding to obtain the semantic-aware representation of each node.
[0018] Optionally, processing the text information corresponding to each node to obtain the embedding vector of each word corresponding to each node includes:
[0019] The large language model uses a word segmenter to convert the text information corresponding to each node into a word sequence corresponding to each node.
[0020] The word sequence corresponding to each node is processed by the embedding layer of the large language module to obtain the embedding vector of each word corresponding to each node.
[0021] Optionally, the large language model is obtained through the following steps:
[0022] Obtain the true classification results, graph embedding matrix, text embedding matrix, and summary embedding matrix corresponding to the training text attribute graph;
[0023] Based on the graph embedding matrix, the text embedding matrix, and the summary embedding matrix, a first similarity between the graph embedding matrix and the text embedding matrix, a second similarity between the graph embedding matrix and the summary embedding matrix, and a third similarity between the text embedding matrix and the summary embedding matrix are determined.
[0024] The model is trained based on the first similarity, the second similarity, the third similarity, and the true classification result, and the large language model is obtained after training.
[0025] Optionally, determining the first similarity between the graph embedding matrix and the text embedding matrix, the second similarity between the graph embedding matrix and the summary embedding matrix, and the third similarity between the text embedding matrix and the summary embedding matrix based on the graph embedding matrix, the text embedding matrix, and the summary embedding matrix includes:
[0026] Based on the graph embedding matrix and the text embedding matrix, a first cosine similarity matrix is calculated between the graph embedding matrix and the text embedding matrix, and the first cosine similarity matrix is used to indicate the first similarity;
[0027] Based on the graph embedding matrix and the summary embedding matrix, a second cosine similarity matrix is calculated between the graph embedding matrix and the summary embedding matrix, and the second cosine similarity matrix is used to indicate the second similarity;
[0028] Based on the text embedding matrix and the summary embedding matrix, a third cosine similarity matrix is calculated between the text embedding matrix and the summary embedding matrix, and the third cosine similarity matrix is used to indicate the third similarity.
[0029] Optionally, the step of training the model based on the first similarity, the second similarity, the third similarity, and the true classification result, to obtain the large language model after training, includes:
[0030] The first loss value is determined using the cross-entropy loss function, based on the first cosine similarity matrix and the true classification result.
[0031] The second loss value is determined using the cross-entropy loss function, based on the second cosine similarity matrix and the true classification result.
[0032] The third loss value is determined using the cross-entropy loss function, based on the third cosine similarity matrix and the true classification result.
[0033] The model is trained based on the first loss value, the second loss value, and the third loss value, and the large language model is obtained after training.
[0034] Secondly, embodiments of this application provide a node classification device, including:
[0035] The data acquisition module is used to acquire a text attribute graph to be processed, wherein the text attribute graph includes multiple nodes;
[0036] The perception processing module is used to perform topology perception graph processing on each of the plurality of nodes to obtain a topology perception graph representation of each node, and to perform semantic perception processing on each node to obtain a semantic perception representation of each node, wherein the topology perception graph representation is used to map each node to a unified latent space.
[0037] The fusion processing module is used to fuse the topology-aware graph representation and the semantic-aware representation of each node to obtain the enhanced feature representation of each node.
[0038] The node classification module is used to classify the enhanced feature representation of each node using a large language model, and obtain the classification result of each node.
[0039] Thirdly, embodiments of this application provide an electronic device, the device including: a processor, a memory, and a system bus;
[0040] The processor and the memory are connected via the system bus;
[0041] The memory is used to store a program, which includes instructions that, when executed by the processor, cause the processor to perform any of the implementation steps of the node classification method described above.
[0042] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the implementation steps of the node classification method described above.
[0043] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0044] In this embodiment, after obtaining a text attribute graph containing multiple nodes, topology-aware graph processing is performed on each node to obtain its topology-aware graph representation. Semantic perception processing is then performed on each node to obtain its semantic perception representation. Subsequently, the topology-aware graph representation and the semantic perception representation of each node are fused to obtain an enhanced feature representation for each node. This enhanced feature representation is then classified using a large language model to obtain the classification result for each node. It is evident that topology-aware graph processing captures the topological relationships of the graph data and maps each node to a unified latent space; semantic perception processing captures textual information related to the nodes in the graph, generating a semantic perception representation that reflects the semantics of the text. Thus, the enhanced feature representation obtained by fusing the topology-aware graph representation and the semantic perception representation is a spatially consistent representation. Therefore, alignment between the graph and the language space can be achieved, effectively solving the spatial alignment problem and enabling the model to achieve stronger generalization capabilities across different domains, thereby obtaining accurate classification results in cross-domain node classification tasks. Attached Figure Description
[0045] Figure 1 A flowchart illustrating a node classification method provided in an embodiment of this application;
[0046] Figure 2 A schematic diagram illustrating the overall framework of a node classification method provided in an embodiment of this application;
[0047] Figure 3 A schematic diagram of the overall framework of another node classification method provided in the embodiments of this application;
[0048] Figure 4 This is a schematic diagram of the structure of a node classification device provided in an embodiment of this application. Detailed Implementation
[0049] As mentioned earlier, in practical applications, due to the spatial differences between graph data and language models, it is difficult to directly integrate graph data with the language space of a large language model. Therefore, there is a spatial alignment problem in node classification tasks, resulting in low generalization ability of the model.
[0050] Based on this, to solve the above problems, embodiments of this application provide a node classification method, including: after obtaining a text attribute graph to be processed comprising multiple nodes, performing topology-aware graph processing on each of the multiple nodes to obtain a topology-aware graph representation for each node, and performing semantic awareness processing on each node to obtain a semantic awareness representation for each node. Then, fusing the topology-aware graph representation and the semantic awareness representation of each node to obtain an enhanced feature representation for each node, and classifying the enhanced feature representation of each node using a large language model to obtain a classification result for each node.
[0051] As can be seen, topology-aware graph processing can capture the topological relationships of graph data and map each node to a unified latent space; semantic-aware processing can capture textual information related to nodes in the graph and generate semantic-aware representations that reflect the semantics of the text. Thus, the enhanced feature representation obtained by fusing the topology-aware graph representation and the semantic-aware representation is a spatially consistent representation. Therefore, it can achieve alignment between the graph and the language space, effectively solving the spatial alignment problem. This enables the model to achieve stronger generalization ability across different domains, thereby obtaining accurate classification results in cross-domain node classification tasks.
[0052] It should be noted that the implementation subject of this node classification method is not limited in this application embodiment. For example, the node classification method of this application embodiment can be applied to data processing devices such as terminal devices or servers. The terminal device can be an electronic device such as a smartphone, computer, personal digital assistant (PDA), or tablet computer. The server can be a standalone server, a cluster server, or a cloud server.
[0053] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0054] Figure 1 This is a flowchart illustrating a node classification method provided in an embodiment of this application. (In conjunction with...) Figure 1 As shown, the node classification method provided in this application embodiment may include the following steps S101-S104.
[0055] S101: Obtain the text attribute graph to be processed. The text attribute graph includes multiple nodes.
[0056] In this embodiment of the application, the text attribute map to be processed can be directly input by the user or pre-stored in a database, and the text attribute map can be retrieved from the database when performing the node classification task.
[0057] In a text attribute graph, each node represents a text entity, such as a document or a sentence. The attributes of a node include text information related to that entity, such as the content and title of a document.
[0058] To facilitate understanding, a text attribute graph can be used as an example to represent a paper citation network. In this network, each node represents a paper, and the attributes of the node can include textual information such as the paper's title, abstract, and keywords. Edges represent the citation relationships between papers, and the attributes of the edges can include textual information such as the reason for the citation and the context of the citation.
[0059] S102: Perform topology-aware graph processing on each of the multiple nodes to obtain a topology-aware graph representation for each node, and perform semantic awareness processing on each node to obtain a semantic awareness representation for each node. The topology-aware graph representation is used to map each node to a unified latent space.
[0060] For ease of understanding, combined with Figure 2 and Figure 3 As shown, when performing topology-aware graph processing on each node, a topology-aware graph representation module can be used. This module includes a Laplace normalization module and a singular value decomposition module. In this way, the Laplace normalization module can be used to perform Laplace normalization on the first adjacency matrix corresponding to the text attribute graph, and then singular value decomposition can be performed on the second adjacency matrix obtained after normalization. This captures the global topological relationships of the graph data and generates a structured graph representation, solving the problem of global topological blind spots.
[0061] Accordingly, the process of performing topology-aware graph processing on each of the multiple nodes may include the following steps 21-23:
[0062] Step 21: Process the text attribute graph to obtain the first adjacency matrix corresponding to the text attribute graph.
[0063] In the embodiments of this application, the specific implementation method for processing the text attribute graph into a first adjacency matrix is not specifically limited, and any existing or future algorithm for converting graph data into an adjacency matrix can be used.
[0064] Step 22: Perform Laplace normalization on the first adjacency matrix to obtain the second adjacency matrix.
[0065] Here, by applying Laplace normalization to the first adjacency matrix, the sum of the weights of each node's neighboring nodes is made equal to 1. This eliminates the influence of differences in node degree on the graph representation, making the graph data representation more stable and uniform, and avoiding representational biases caused by different node degrees in higher-order adjacency matrices. It can better reflect the relative relationships between nodes and improve the representation quality of graph data.
[0066] Next, the Laplace-normalized matrices are superimposed to form a higher-order adjacency matrix. This higher-order adjacency matrix can capture higher-order connection patterns between nodes, that is, consider the connection relationship between nodes through multi-step paths, thereby more comprehensively describing the topological structure of the graph and capturing the global topological relationship of the graph data, rather than just the local adjacency relationship.
[0067] In this embodiment of the application, the process of performing Laplace normalization on the first adjacency matrix and superimposing it into a higher-order adjacency matrix can be shown by the following formula (1):
[0068] (1)
[0069] in, Let be the first adjacency matrix of order k after Laplace normalization. This is the second adjacency matrix.
[0070] In this way, the second adjacency matrix becomes the higher-order adjacency matrix. This method of adding multiple first adjacency matrices that have been Laplace-normalized can capture various connection relationships between nodes, including one-hop connections (direct connections) and multi-hop connections (connections through intermediate nodes), thus preserving the global topological structure of the graph data.
[0071] Step 23: Perform singular value decomposition on the second adjacency matrix to obtain the topology-aware graph representation of each node.
[0072] Here, singular value decomposition (SVD) is a matrix factorization technique that decomposes a matrix into the product of three matrices, which contains information such as singular values and singular vectors. In this embodiment, taking node i as an example, the process of performing SVD on the second adjacency matrix can be shown by the following formula (2):
[0073] (2)
[0074] in, Let U be the topological encoding of node i, and let U and V be orthogonal matrices. It is a diagonal matrix. is a higher-order adjacency function of layer l.
[0075] Singular value decomposition can map nodes into a unified latent space, allowing the node representation in this space to better capture the global topological features of the graph data. It also has better compatibility with the language space, enabling nodes from different graph datasets to be compared and processed in the same space, thus solving the spatial alignment problem.
[0076] Furthermore, still combined Figure 2 and Figure 3 As shown, semantic awareness processing for each node can be implemented using a semantic awareness module. This module can include a large language model word segmenter and embedding layer, a Term Frequency-Inverse Document Frequency (TF-IDF) module, and a graph encoder module. In this way, the word segmenter module converts the text description into a word sequence, the embedding layer of the large language model processes the word sequence to obtain the embedding vector for each word, the TF-IDF module measures the importance of words in the document to ensure the generated node representation accurately captures the semantic information of the text, and finally, the graph encoder module extracts the structured information of the nodes.
[0077] Accordingly, the process of performing semantic awareness processing on each of the multiple nodes may include the following steps 24-26:
[0078] Step 24: Process the text information corresponding to each node to obtain the embedding vector of each word corresponding to each node.
[0079] In practice, firstly, the text information corresponding to each node can be converted into a word sequence corresponding to each node using the word segmenter of the large language model. Next, these word sequences are input into the embedding layer of the large language model, where the word sequence corresponding to each node is processed to obtain the embedding vector for each word at each node.
[0080] In this application, the implementation method for obtaining word sequences through a word segmenter is not specifically limited, and any existing or future word segmentation algorithm can be used. Similarly, the implementation method for obtaining word embedding vectors through the embedding layer of a large language model is not specifically limited, and any existing or future embedding vector acquisition algorithm can be used.
[0081] Step 25: Calculate the embedding vector of each word corresponding to each node using the TF-IDF algorithm to obtain the semantic embedding of each node.
[0082] In this embodiment, to ensure that the semantic embedding of each node has rich semantics, different weighted aggregation methods can be used to sum the word embedding vectors. Accordingly, in specific implementations, the TF-IDF algorithm can be further utilized to measure the importance of each word in the document, thereby helping the generated node semantic embeddings to accurately capture the semantic information of the text. Specifically, the process of calculating the semantic embedding using the TF-IDF algorithm can be shown in the following formulas (3-1), (3-2), and (3-3):
[0083] (3-1)
[0084] (3-2)
[0085] , (3-3)
[0086] in, For the semantic embedding of node i, Let be the embedding vector of the nth word at node i. For the entry , For the entry In the document The number of times it appears in For document The number of all terms in the text. For the entry In the document The inverse text frequency index, For the total number of documents, For including entries The number of documents.
[0087] Step 26: Perform graph encoding on the semantic embedding of each node to obtain the semantic-aware representation of each node.
[0088] Here, the graph encoding process can be implemented using a graph encoder module, which can be implemented using different graph neural networks, such as multi-layer graph convolutional networks or graph attention networks. In this way, by aggregating neighbor information layer by layer through the graph encoder, complex relationships and structural information in graph data can be captured.
[0089] In practical implementation, a multi-layer graph convolutional network can be used to extract the structured information of each node. In each layer, the multi-layer graph convolutional network aggregates the information of neighboring nodes through graph convolution operations, thereby gradually enhancing the expressive power of node features. For ease of understanding, the process of graph encoding for the semantic embedding of each node is described below in conjunction with formula (4):
[0090] (4)
[0091] in, Let i be the semantic perception representation of node i. Let i be the feature vector of node i in the l-th layer. Let i be the set of neighboring nodes of node i. The normalization coefficient is... These are the trainable parameters for the l-th layer.
[0092] S103: The topology-aware graph representation and the semantic-aware representation of each node are fused to obtain the enhanced feature representation of each node.
[0093] Here, combined Figure 2 As shown, the topology-aware graph representation and semantic-aware representation of each node can be fused using a feature fusion module. Accordingly, the implementation of the feature fusion module in this embodiment is not specifically limited, and any existing or future feature fusion algorithm can be used.
[0094] In this way, the outputs of the topology-aware graph representation module and the graph encoder module can be fused, enabling textual information to be effectively combined with graph structure information, thereby generating enhanced feature representations for each node and providing powerful feature support for cross-domain node classification tasks.
[0095] S104: Classify the enhanced feature representation of each node using a large language model to obtain the classification result for each node.
[0096] In the embodiments of this application, after obtaining a large language model that can accurately classify each node, since the enhanced feature representation of each node is a feature aligned between the graph and the language space, the large language model can accurately classify each node, demonstrating the model's powerful generalization ability and accuracy.
[0097] Accordingly, for the training process of a large language model, self-supervised contrastive learning alignment can be used to maximize the similarity between graph embeddings and text embeddings, thereby achieving effective alignment between the graph and the language space. Based on this, for ease of understanding, the process of obtaining a large language model will be illustrated first. As an example, a large language model can be obtained through the following steps 41-43:
[0098] Step 41: Obtain the true classification results, graph embedding matrix, text embedding matrix, and summary embedding matrix corresponding to the training text attribute graph.
[0099] Here, the training text attribute map, as the training data for the large language model, can be pre-stored in the corresponding database. When performing the model training task, the training text attribute map and the corresponding real classification result are retrieved from the database.
[0100] Accordingly, this scheme can design three contrastive learning strategies to maximize the similarity between graph embeddings and text embeddings, graph embeddings and summary embeddings, and text embeddings and summary embeddings, respectively. Thus, in practical applications, after obtaining the training text attribute map, the graph embedding matrix S, text embedding matrix E, and summary embedding matrix Q corresponding to the training text attribute map can be defined accordingly.
[0101] Step 42: Based on the graph embedding matrix, text embedding matrix, and summary embedding matrix, determine the first similarity between the graph embedding matrix and the text embedding matrix, the second similarity between the graph embedding matrix and the summary embedding matrix, and the third similarity between the text embedding matrix and the summary embedding matrix.
[0102] As an example, the similarity between the three types of matrices mentioned above can be represented by the corresponding cosine similarity matrix. That is, the cosine similarity matrix can indicate the similarity between the corresponding matrices.
[0103] Based on this, in this embodiment, a first cosine similarity matrix between the graph embedding matrix and the text embedding matrix can be calculated based on the graph embedding matrix and the text embedding matrix; a second cosine similarity matrix between the graph embedding matrix and the summary embedding matrix can be calculated based on the graph embedding matrix and the summary embedding matrix; and a third cosine similarity matrix between the text embedding matrix and the summary embedding matrix can be calculated based on the text embedding matrix and the summary embedding matrix. The first cosine similarity matrix indicates a first similarity, the second cosine similarity matrix indicates a second similarity, and the third cosine similarity matrix indicates a third similarity.
[0104] Accordingly, the calculation method of the cosine similarity matrix in this application embodiment is not specifically limited, and any existing or future matrix calculation algorithm can be used.
[0105] Step 43: Train the model based on the first similarity, second similarity, third similarity and the true classification results. After training, a large language model is obtained.
[0106] In practical applications, the parameters of large language models can be optimized using loss functions, such as the cross-entropy loss function. The cross-entropy loss function performs well in classification problems, effectively reflecting the difference between predicted and true values, thus helping the model to classify accurately. Furthermore, the cross-entropy loss function converges faster, thereby shortening the model's training time.
[0107] Based on this, during the model training process, firstly, according to the following formula (5), the first loss value can be determined by the cross-entropy loss function based on the first cosine similarity matrix and the true classification result.
[0108] (5)
[0109] in, Let CE be the first loss value, and CE be the cross-entropy loss function. This is the first cosine similarity matrix. For the true classification result, T represents transpose.
[0110] Meanwhile, as shown in the following formula (6), the second loss value can be determined by the cross-entropy loss function based on the second cosine similarity matrix and the true classification result.
[0111] (6)
[0112] in, Here, CE represents the cross-entropy loss function. This is the second cosine similarity matrix. For the true classification result, T represents transpose.
[0113] Furthermore, as shown in the following formula (7), the third loss value can be determined based on the third cosine similarity matrix and the true classification result using the cross-entropy loss function.
[0114] (7)
[0115] in, Here are three loss values, where CE is the cross-entropy loss function. The third cosine similarity matrix, For the true classification result, T represents transpose.
[0116] Finally, the model can be trained based on the first loss value, the second loss value, and the third loss value, and the large language model is obtained after training.
[0117] This self-supervised contrastive learning alignment method not only enhances the model's ability to jointly understand graph and text data but also maintains the zero-shot generalization ability of large language models. This contrastive learning mechanism ensures that the model can achieve knowledge transfer across different domains, improving its generalization ability and adaptability in cross-domain tasks.
[0118] As can be seen from the above steps S101-S104, in this embodiment, after obtaining the text attribute graph to be processed, which includes multiple nodes, topology-aware graph processing can be performed on each of the multiple nodes to obtain the topology-aware graph representation of each node. Semantic perception processing can then be performed on each node to obtain its semantic perception representation. Subsequently, the topology-aware graph representation and the semantic perception representation of each node can be fused to obtain the enhanced feature representation of each node. Finally, the enhanced feature representation of each node can be classified using a large language model to obtain the classification result for each node. Therefore, topology-aware graph processing can capture the topological relationships of graph data and map each node to a unified latent space; semantic perception processing can capture textual information related to nodes in the graph and generate a semantic perception representation that reflects the semantics of the text. In this way, the enhanced feature representation obtained by fusing the topology-aware graph representation and the semantic-aware representation is a spatially consistent representation. Therefore, it can achieve alignment between the graph and the language space, thus effectively solving the spatial alignment problem. This enables the model to achieve stronger generalization ability across different domains, and thus obtain accurate classification results in cross-domain node classification tasks.
[0119] Furthermore, based on the node classification method provided in the above embodiments, this application embodiment can also provide a node classification device. The node classification device will now be described in conjunction with the embodiments and accompanying drawings.
[0120] Figure 4 This is a schematic diagram of a node classification device provided in an embodiment of this application. (Combined with...) Figure 4 As shown, the node classification device 400 provided in this application embodiment may include:
[0121] Data acquisition module 401 is used to acquire a text attribute graph to be processed, the text attribute graph including multiple nodes;
[0122] The perception processing module 402 is used to perform topology perception graph processing on each of the plurality of nodes to obtain a topology perception graph representation of each node, and to perform semantic perception processing on each node to obtain a semantic perception representation of each node, wherein the topology perception graph representation is used to map each node to a unified latent space.
[0123] The fusion processing module 403 is used to fuse the topology-aware graph representation and the semantic-aware representation of each node to obtain the enhanced feature representation of each node.
[0124] The node classification module 404 is used to classify the enhanced feature representation of each node using a large language model to obtain the classification result of each node.
[0125] Optionally, the sensing processing module 402 is specifically used for:
[0126] The text attribute graph is processed to obtain the first adjacency matrix corresponding to the text attribute graph;
[0127] The first adjacency matrix is Laplace normalized to obtain the second adjacency matrix;
[0128] The second adjacency matrix is subjected to singular value decomposition to obtain a topology-aware graph representation of each node.
[0129] Optionally, the sensing processing module 402 specifically includes:
[0130] In the text information processing module, Yang Hongyu processes the text information corresponding to each node to obtain the embedding vector of each word corresponding to each node;
[0131] The embedding vector calculation module is used to calculate the embedding vector of each word corresponding to each node using the inverse document frequency algorithm to obtain the semantic embedding of each node.
[0132] The graph encoding processing module is used to perform graph encoding processing on the semantic embedding of each node to obtain the semantic-aware representation of each node.
[0133] Optionally, the embedded vector calculation module is specifically used for:
[0134] The large language model uses a word segmenter to convert the text information corresponding to each node into a word sequence corresponding to each node.
[0135] The word sequence corresponding to each node is processed by the embedding layer of the large language module to obtain the embedding vector of each word corresponding to each node.
[0136] Optionally, the large language model is obtained through the following modules:
[0137] The training data acquisition module is used to acquire the true classification results, graph embedding matrix, text embedding matrix and summary embedding matrix corresponding to the training text attribute graph;
[0138] A similarity determination module is used to determine, based on the graph embedding matrix, the text embedding matrix, and the summary embedding matrix, a first similarity between the graph embedding matrix and the text embedding matrix, a second similarity between the graph embedding matrix and the summary embedding matrix, and a third similarity between the text embedding matrix and the summary embedding matrix;
[0139] The model training module is used to train the model based on the first similarity, the second similarity, the third similarity, and the true classification result, and the large language model is obtained after the training is completed.
[0140] Optionally, the similarity determination module is specifically used for:
[0141] Based on the graph embedding matrix and the text embedding matrix, a first cosine similarity matrix is calculated between the graph embedding matrix and the text embedding matrix, and the first cosine similarity matrix is used to indicate the first similarity;
[0142] Based on the graph embedding matrix and the summary embedding matrix, a second cosine similarity matrix is calculated between the graph embedding matrix and the summary embedding matrix, and the second cosine similarity matrix is used to indicate the second similarity;
[0143] Based on the text embedding matrix and the summary embedding matrix, a third cosine similarity matrix is calculated between the text embedding matrix and the summary embedding matrix, and the third cosine similarity matrix is used to indicate the third similarity.
[0144] Optionally, the model training module is specifically used for:
[0145] The first loss value is determined using the cross-entropy loss function, based on the first cosine similarity matrix and the true classification result.
[0146] The second loss value is determined using the cross-entropy loss function, based on the second cosine similarity matrix and the true classification result.
[0147] The third loss value is determined using the cross-entropy loss function, based on the third cosine similarity matrix and the true classification result.
[0148] The model is trained based on the first loss value, the second loss value, and the third loss value, and the large language model is obtained after training.
[0149] Furthermore, embodiments of this application also provide an electronic device, including: a processor, a memory, and a system bus;
[0150] The processor and the memory are connected via the system bus;
[0151] The memory is used to store one or more programs, the one or more programs including instructions that, when executed by the processor, cause the processor to perform any of the implementation steps of the node classification method described above.
[0152] Furthermore, embodiments of this application also provide a computer-readable storage medium storing instructions that, when executed on an electronic device, cause any of the above-described steps of the node classification method to be implemented.
[0153] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application. It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on describing the differences from other embodiments. The same or similar parts between the various embodiments can be referred to mutually.
[0154] The system disclosed in the embodiments is described in a relatively simple manner because it corresponds to the method disclosed in the embodiments. For relevant details, please refer to the method section.
[0155] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0156] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method of classifying nodes, characterized by, The method comprises the following steps: obtaining a text attribute graph to be processed, the text attribute graph comprising a plurality of nodes; performing topology-aware graph processing on each node in the plurality of nodes to obtain a topology-aware graph representation of the each node, and performing semantic-aware processing on the each node to obtain a semantic-aware representation of the each node, the topology-aware graph representation being used to map the each node to a unified latent space; performing fusion processing on the topology-aware graph representation of the each node and the semantic-aware representation of the each node to obtain an enhanced feature representation of the each node; classifying the enhanced feature representation of the each node by a large language model to obtain a classification result of the each node; wherein the topology-aware graph processing on each node in the plurality of nodes to obtain a topology-aware graph representation of the each node comprises: processing the text attribute graph to obtain a first adjacency matrix corresponding to the text attribute graph; performing Laplacian normalization on the first adjacency matrix to obtain a second adjacency matrix; performing singular value decomposition processing on the second adjacency matrix to obtain the topology-aware graph representation of the each node.
2. The node classification method of claim 1, wherein, The semantic-aware processing on the each node to obtain a semantic-aware representation of the each node comprises: processing text information corresponding to the each node to obtain an embedding vector of each word corresponding to the each node; calculating the embedding vector of each word corresponding to the each node by a term frequency-inverse document frequency algorithm to obtain a semantic embedding of the each node; performing graph encoding processing on the semantic embedding of the each node to obtain the semantic-aware representation of the each node.
3. The node classification method of claim 2, wherein, The processing of the text information corresponding to the each node to obtain an embedding vector of each word corresponding to the each node comprises: converting the text information corresponding to the each node into a word sequence corresponding to the each node by a tokenizer of the large language model; processing the word sequence corresponding to the each node by an embedding layer of the large language model to obtain an embedding vector of each word corresponding to the each node.
4. The node classification method according to any one of claims 1 to 3, characterized in that, The large language model is obtained by the following steps: obtaining real classification results, a graph embedding matrix, a text embedding matrix and an abstract embedding matrix corresponding to a training text attribute graph; determining a first similarity between the graph embedding matrix and the text embedding matrix, a second similarity between the graph embedding matrix and the abstract embedding matrix, and a third similarity between the text embedding matrix and the abstract embedding matrix based on the graph embedding matrix, the text embedding matrix and the abstract embedding matrix; performing model training based on the first similarity, the second similarity, the third similarity and the real classification results, and obtaining the large language model after the training is completed.
5. The node classification method of claim 4, wherein, The determination of the first similarity between the graph embedding matrix and the text embedding matrix, the second similarity between the graph embedding matrix and the abstract embedding matrix, and the third similarity between the text embedding matrix and the abstract embedding matrix based on the graph embedding matrix, the text embedding matrix and the abstract embedding matrix comprises: calculating, based on the graph embedding matrix and the text embedding matrix, a first cosine similarity matrix between the graph embedding matrix and the text embedding matrix, the first cosine similarity matrix being used to indicate the first similarity; calculating, based on the graph embedding matrix and the summary embedding matrix, a second cosine similarity matrix between the graph embedding matrix and the summary embedding matrix, the second cosine similarity matrix being used to indicate the second similarity; calculating, based on the text embedding matrix and the summary embedding matrix, a third cosine similarity matrix between the text embedding matrix and the summary embedding matrix, the third cosine similarity matrix being used to indicate the third similarity.
6. The node classification method of claim 5, wherein, The model training based on the first similarity, the second similarity, the third similarity and the true classification result, and the large language model obtained after the training is ended, includes: determining a first loss value based on the first cosine similarity matrix and the true classification result through a cross-entropy loss function; determining a second loss value based on the second cosine similarity matrix and the true classification result through the cross-entropy loss function; determining a third loss value based on the third cosine similarity matrix and the true classification result through the cross-entropy loss function; training a model based on the first loss value, the second loss value and the third loss value, and obtaining the large language model after the training is ended.
7. A node classification apparatus characterized by comprising: It includes: a data acquisition module configured to acquire a text attribute graph to be processed, the text attribute graph including a plurality of nodes; a perception processing module configured to perform topology-aware graph processing on each node in the plurality of nodes to obtain a topology-aware graph representation of the each node, and perform semantic perception processing on the each node to obtain a semantic perception representation of the each node, the topology-aware graph representation being used to map the each node to a unified latent space; a fusion processing module configured to perform fusion processing on the topology-aware graph representation of the each node and the semantic perception representation of the each node to obtain an enhanced feature representation of the each node; a node classification module configured to classify the enhanced feature representation of the each node through a large language model to obtain a classification result of the each node; The perception processing module is specifically configured to: process the text attribute graph to obtain a first adjacency matrix corresponding to the text attribute graph; perform Laplacian normalization on the first adjacency matrix to obtain a second adjacency matrix; perform singular value decomposition processing on the second adjacency matrix to obtain the topology-aware graph representation of the each node.
8. An electronic device, comprising: The device includes a processor, a memory, and a system bus; The processor and the memory are connected through the system bus; The memory is used to store a program, the program including instructions, which, when executed by the processor, cause the processor to perform the steps of the node classification method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the node classification method of any one of claims 1 to 6.
Citation Information
Patent Citations
Financial risk early warning method and device based on knowledge graph
CN114282003A