Node classification method, device and terminal device for dynamic graph data
By obtaining the node characteristics and graph topology of dynamic graph data, the graph neural network model outputs a potential distribution and performs Laplacian distribution sampling, combined with the dense target encoding and comprehensive detection strategy of the open node classifier, it solves the existing technology problem Addresses the accuracy and applicability issues of mid-dynamic graph data node classification, achieving high-accuracy and robust classification in real-world environments.
Patent Information
- Application Number
- CN202311641393.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-01
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-12-01
AI Technical Summary
It is difficult for the existing technology to accurately detect unoccurred classes and correctly classify seen classes in the real-world environment in dynamic graph data node classification, and the integrated dynamic graph neural network requires information from all nodes and is not suitable for data flow scenarios. .
By acquiring dynamic graph data, determining the node characteristics and graph topology, inputting it into the graph neural network model to obtain the potential distribution, sampling the truncated Laplacian distribution, generating a probability distribution, and utilizing the open node classifier and dense target encoding and comprehensive detection strategies for classification.
It achieves more accurate detection of classes that have not appeared during the training process and correctly classifies seen classes in dynamic graph data. It is suitable for data flow scenarios and improves the accuracy and robustness of node classification.
Smart Images

Figure CN117668653B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of open learning technology, and in particular, relates to a node classification method, device and terminal device for dynamic graph data. Background Art
[0002] Early graph node classification problems mainly focused on static graphs at a single moment. However, graph data in practical applications often evolve over time, which requires taking time into account in graph node classification problems. For example, in social networks, the friendships between users and the behavioral attributes of users themselves will change over time.
[0003] Most of the existing research on the problem of node classification of dynamic graph data adopts the strategy of combining GNN (Graph Neural Network) with RNN (Recurrent Neural Network). That is, GNN is used to obtain the graph network topology information and node feature information at the current moment, and then RNN is used to process the time series information. According to the combination of GNN and RNN, the existing dynamic graph neural network DGNN (Dynamic Graph Neural Network) can be generally divided into two categories: stacked dynamic graph neural network and integrated dynamic graph neural network. The stacked dynamic graph neural network uses GNN alone to extract the topology information and node feature information of the static graph, and then uses the features extracted at all times as the input of RNN to process the time series information. The dynamic self-attention network is one of the classic stacked dynamic graph neural networks. It calculates the node representation through the self-attention mechanism in two dimensions: spatial domain structure and temporal dynamics, so that the node can retain the local structure information and obtain the output features at each moment. Integrated dynamic graph neural networks integrate GNN and RNN in a single network layer, extracting static graph features and processing time series information at the same time. However, these methods require information from all nodes and are not applicable in data stream scenarios. Therefore, existing technologies have defects in learning dynamically evolving information in dynamic graph data, accurately detecting classes that have not appeared in the training process, and correctly classifying seen classes in real-world environments. Summary of the invention
[0004] The embodiments of the present application provide a node classification method, apparatus and terminal device for dynamic graph data, which can learn the dynamically evolving information in the dynamic graph data, and more accurately detect classes that have not appeared in the training process and correctly classify seen classes in a real-world environment.
[0005] A first aspect of an embodiment of the present application provides a node classification method for dynamic graph data, the node classification method comprising:
[0006] Get dynamic graph data;
[0007] According to the dynamic graph data, determining node features and graph topology in the dynamic graph data;
[0008] The node features and graph topology are input into the graph neural network model, which then outputs the potential distribution of each node.
[0009] The potential distribution of each node is sampled using a truncated Laplace distribution to generate a probability distribution for each node.
[0010] The probability distribution of each node is input into an open node classifier, which outputs the seen or unseen category to which each node belongs. The open node classifier is trained on a node training set of known classifications using dense object coding and a comprehensive detection strategy.
[0011] A second aspect of an embodiment of the present application provides a node classification device for dynamic graph data, the node classification device comprising:
[0012] A data acquisition module, used to acquire dynamic graph data;
[0013] A first determination module is used to determine node features and graph topology in the dynamic graph data according to the dynamic graph data;
[0014] The potential distribution output module is used to input node features and graph topology into the graph neural network model, and the graph neural network model outputs the potential distribution of each node;
[0015] A generation module, used to sample the truncated Laplace distribution of the potential distribution of each node to generate the probability distribution of each node;
[0016] The classification module is used to input the probability distribution of each node into the open node classifier, and the open node classifier outputs the seen category or unseen category to which each node belongs. The open node classifier is trained on a node training set of known classifications using dense target encoding and a comprehensive detection strategy.
[0017] A third aspect of an embodiment of the present application provides a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the node classification method for dynamic graph data of the first aspect when executing the computer program.
[0018] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the node classification method for dynamic graph data of the first aspect is implemented.
[0019] A fifth aspect of an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the node classification method for dynamic graph data of the first aspect.
[0020] In an embodiment of the present application, dynamic graph data is first acquired, and node features and graph topology in the dynamic graph data are determined based on the dynamic graph data. Secondly, the node features and graph topology are input into a neural network model, and the graph neural network model outputs the potential distribution of each node, that is, the dynamically evolving information in the dynamic graph data. A truncated Laplace distribution is sampled for the potential distribution of each node to generate a probability distribution for each node. Finally, the probability distribution of each node is input into an open node classifier, and the open node classifier outputs the seen category or unseen category to which each node belongs. The open node classifier is trained on a node training set of known classifications using dense target encoding and comprehensive detection rules, and can more accurately detect classes that have not appeared during the training process and correctly classify seen classes. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0022] Figure 1 It is a flowchart of a node classification method for dynamic graph data provided by an embodiment of the present application;
[0023] Figure 2 is an example diagram of dynamic graph data provided by an embodiment of the present application;
[0024] Figure 3 is a flow chart of an open node classifier training process provided by another embodiment of the present application;
[0025] Figure 4 It is a structural schematic diagram of a node classification device for dynamic graph data provided by an embodiment of the present application;
[0026] Figure 5 It is a structural diagram of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0028] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0029] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0030] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0031] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0032] It should be understood that the size of the serial numbers of the steps in this embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0033] There are ever-changing environments in dynamic graph data, which easily generate new unknown classes. Although current node classification methods for dynamic graph data can perform node classification tasks in dynamic graph data, they are all based on closed assumptions and cannot work well in open environments in the real world. For example, integrated dynamic graph neural networks integrate GNN and RNN in a single layer of network, extracting static graph features and processing timing information at the same time. However, these methods require information from all nodes and are not applicable in data stream scenarios. It is necessary to propose a node classification method for dynamic graph data that can learn the dynamic evolution information of nodes based on node features, so as to accurately detect classes that have not appeared in the training process and correctly classify the defects of seen classes.
[0034] In order to achieve the above technical effects, the present application proposes a node classification method for dynamic graph data, which first obtains dynamic graph data, determines the node features and graph topology structure in the dynamic graph data according to the dynamic graph data, and then inputs the node features and graph topology structure into a neural network model, and the graph neural network model outputs the potential distribution of each node, that is, the dynamically evolving information in the dynamic graph data; a truncated Laplace distribution is sampled for the potential distribution of each node to generate a probability distribution for each node; finally, the probability distribution of each node is input into an open node classifier, and the open node classifier outputs the seen category or unseen category to which each node belongs, and the open node classifier is trained on a node training set of known classifications using dense target encoding and comprehensive detection rules, which can more accurately detect classes that have not appeared during the training process and correctly classify seen classes.
[0035] In order to illustrate the technical solution of the present application, specific embodiments are provided below.
[0036] See also Figure 1 , shows a schematic flow chart of a node classification method for dynamic graph data provided by an embodiment of the present application. Figure 1 As shown, the node classification method of dynamic graph data may include the following steps:
[0037] Step 101, obtaining dynamic image data.
[0038] It should be noted that the node classification method of the dynamic graph data of the embodiment of the present application can be executed by the node classification device of the dynamic graph data of the embodiment of the present application. The node classification device of the dynamic graph data of the embodiment of the present application can be configured in any terminal device to execute the node classification method of the dynamic graph data of the embodiment of the present application.
[0039] Dynamic graph data refers to data whose structure or properties change over a period of time. It should be noted that a graph is a network composed of nodes and edges, and dynamic graph data reflects the process of evolution and change of nodes and edges in the graph over time. For example, social networks are a common example of dynamic graph data. People establish new relationships, dissolve old relationships, or change their personal information in social networks. This change can be modeled through dynamic graph data. Each time point is a snapshot of the network, showing the status of nodes and edges at that time point.
[0040] In an embodiment of the present application, dynamic graph data consisting of the relationships between nodes (i.e., the edges of the network) can be obtained based on the information of each node and the relationships between nodes in the actual scenario. For example, the relationships, interactions, and information sharing between users at different time points can constitute a dynamic social network. The dynamic graph data can be obtained by obtaining the relationships, interactions, and information sharing between users corresponding to each time point in the social network.
[0041] For example, see Figure 2 The example diagram of dynamic graph data shown includes a network snapshot corresponding to time t-1 and a network snapshot at time t, where a, b, and c respectively represent nodes in the network, and the connection relationship between them represents the association relationship between the nodes. It can be seen that the connection relationship between the nodes in the network snapshot corresponding to time t-1 and the network snapshot corresponding to time t is different, so dynamic graph data is constituted. As time goes by, the structure or attributes of the graph will change.
[0042] It should be understood that the above actual scenarios are only examples and cannot be used as limitations on this application.
[0043] In a possible implementation, the dynamic graph data can be represented as a set of vectors, such as Among them, G1 to G T Respectively represent the network snapshots corresponding to time 1 to T.
[0044] Step 102: Determine the node features and graph topology structure in the dynamic graph data according to the dynamic graph data.
[0045] In the embodiment of the present application, since the dynamic graph data includes the network snapshot corresponding to each time point, showing the state of nodes and edges at that time point, the node features and graph topology corresponding to any time can be extracted from the dynamic graph data.
[0046] The node feature may refer to an attribute or information associated with each node, which is used to describe the nature, property or state of the node.
[0047] The graph topology structure may refer to the layout and shape of the connection relationships between nodes in the graph.
[0048] In the embodiment of the present application, node feature recognition and graph topology recognition can be used to determine the node features and graph topology in the dynamic graph data. Specifically, the node features of the node at each moment can be determined by viewing the node's attributes, categories, text descriptions, and timing information, and then the graph topology can be determined by identifying the information of the connected nodes.
[0049] In a possible implementation, when the dynamic graph data includes static graphs at multiple moments, determining node features and graph topology in the dynamic graph data according to the dynamic graph data includes:
[0050] According to the static graphs at multiple moments, a node set and an edge set in the static graph at each moment and node features in the static graph at each moment are extracted;
[0051] According to the node set and edge set in the static graph at each moment, the graph topology structure of the static graph at each moment is determined.
[0052] For example, taking the static graph at time t as an example, the node set V in the static graph at time t can be extracted. t and edge set E t And the node feature X at time t t , according to the node set V in the static graph at time t t and edge set E t , we can determine the node set V in the static graph at time t t and edge set E t The graph topology structure A t Therefore, the snapshot at time t in the dynamic graph data can be expressed as G t =(V t ,E t ,A t ,X t ), the node feature in the dynamic graph data is X t , the graph topology is A t , and t is a positive integer.
[0053] Step 103, input the node features and graph topology structure into the graph neural network model, and the graph neural network model outputs the potential distribution of each node.
[0054] The potential distribution of nodes usually refers to the representation of node embedding as a probability distribution in the latent space. In graph neural networks, node embedding is the representation of nodes learned by the model in a low-dimensional latent space. For each node, its probability distribution in the latent space reflects the uncertainty of the model about the node.
[0055] In an embodiment of the present application, the graph neural network model can gradually transfer the node information to the latent space by aggregating node features and graph topology to output the potential distribution of each node.
[0056] In a possible implementation, the graph neural network model may include a four-layer network. The node features and graph topology structure are input into the graph neural network model, and the graph neural network model outputs the potential distribution of each node, including:
[0057] Input the node features and graph topology of the static graph at time t into the first layer network to obtain the feature matrix output by the first layer network, where time t is any corresponding time in the dynamic graph data;
[0058] The feature matrix is input into the second layer network, and the deterministic feature matrix corresponding to the static graph at time t is obtained through recursive calculation. The deterministic feature matrix is used to represent the deterministic state of each node;
[0059] Based on the third layer network, the random state of each node at time t is determined according to the deterministic feature matrix at time t to describe the node features at time t;
[0060] The fourth layer network is used to model the random state of each node at time t to obtain the potential distribution of each node.
[0061] In an embodiment of the present application, the node features and graph topology of the static graph at each moment are input into the graph neural network. First, the first layer of the network is used to extract the features of the static graph at each moment. Secondly, in order to capture the dynamic change information of the dynamic graph data and model its uncertainty, modeling is performed according to the fourth layer of the network. The deterministic expression and random expression of the nodes are simultaneously learned through the second and third layers of the network, so that the dynamic changes of the potential distribution of the nodes can be learned while capturing the dynamic graph data information.
[0062] In a possible implementation, the first layer of the network is a graph convolutional network; the node features and graph topology of the static graph at time t are input into the first layer of the network to obtain a feature matrix output by the first layer of the network, including:
[0063] Input the node features and graph topology of the static graph at time t into the graph convolutional network;
[0064] A feature matrix is generated based on the network parameters of the graph convolutional network, the node features of the static graph at time t, and the graph topology.
[0065] Specifically, a graph convolutional network (GCN) is used to extract feature propagation information on the graph, that is, the feature propagation information on the graph is extracted according to the node features and graph topology of the static graph at time t, and a low-dimensional feature matrix is generated:
[0066]
[0067] in, is the identity matrix, and A is the matrix formed by the relationship between each node; for The degree matrix of t is the node feature at time t; ReLU() is the activation function; W (1) are the network parameters of the graph convolutional network.
[0068] In a possible implementation, the second layer network is a cyclic convolutional network; the feature matrix is input into the second layer network, and a deterministic feature matrix corresponding to the static graph at time t is obtained by recursive calculation, including:
[0069] The feature matrix is input into the circular convolutional network, and the deterministic feature matrix at time t is output according to the feature matrix corresponding to the static graph at time t and the deterministic feature matrix at time t-1 output by the circular convolutional network to represent the deterministic state at time t.
[0070] Specifically, this application recursively calculates the deterministic state at time t:
[0071]
[0072] in, It is a recurrent neural network (RNN). is the feature matrix at time t, d t-1 is the deterministic state of the node at time t-1. In this embodiment, LSTM can be used instead of node neighborhood aggregation to capture the timing information of the graph. The general expression we use for RNN is as follows:
[0073]
[0074] in, is the network parameter of RNN, is the deterministic state at time t, is the deterministic state at time t-1.
[0075] In a possible implementation, based on the third layer network, according to the deterministic feature matrix at time t and the node features at time t, the random state of each node at time t is determined, including:
[0076] By introducing a separate random layer in the recurrent convolutional network, a random state is determined;
[0077] Based on the dynamic variational autoencoder, an inference network is used to learn the posterior distribution of nodes to estimate the network parameters of the random layer;
[0078] According to the deterministic feature matrix at time t, the node characteristics at time t, and the network parameters of the random layer, the random state of each node at time t is determined.
[0079] Specifically, in the third layer of the network, we add a separate random layer to learn the random state z of the node during the iteration process. t , based on the structure of Dynamic Variational Autoencoder (DVAE), z t The posterior inference of is completed by a layer of inference network, which passes through the state a in the recurrent neural network t To estimate z t Nonlinear dependence of future observations, namely:
[0080]
[0081] in, is a nonlinear function, a t+1 is a random state z t The posterior estimate of .
[0082] Among them, a t The specific calculation is as follows:
[0083]
[0084] in, is the random state of the node at time t, is the random state of the node at time t+1, is the network parameter of the inferred network; a t For z t estimated status.
[0085] In one possible implementation, the fourth layer network is used to model the random state of each node at time t to obtain the potential distribution of each node, including:
[0086] The random state of each node at time t is modeled according to the multivariate Gaussian distribution, and the mean vector and standard deviation vector of the random state of each node at time t are obtained;
[0087] According to the mean vector and standard deviation vector of the random state of each node at time t, a reparameterization algorithm is used to generate the potential distribution of the nodes.
[0088] Specifically, the fourth layer network has a random state z for the node t We model the potential distribution of each node by assuming that the random state z of the node tis continuous and obeys a multivariate Gaussian distribution. According to the inference model, we can get:
[0089]
[0090] The above equation is a conditional probability formula. It means that the random state z at time t is known. t-1 and a t Under the probability distribution condition of t Here q() is a function that can be used to construct a random cyclic convolutional network. To represent this function.
[0091] Furthermore, embedding the above equation into a random cycle convolutional network structure, we can get:
[0092]
[0093] Right now:
[0094]
[0095] in, are the network parameters of the random recurrent convolutional network.
[0096] From this we can get:
[0097]
[0098] in, It is represented as the mean vector of the random state of node i at time t, Represents the standard deviation vector of the random state of node i at time t.
[0099] Finally, according to the reparameterization algorithm, we can calculate the potential distribution of nodes as:
[0100]
[0101] Here, ζ is random noise drawn from the standard normal distribution G(0,1).
[0102] In the embodiment of the present application, the normal distribution is used to simulate the noise existing in the real world, so that the distribution of the learned nodes can be closer to their actual distribution.
[0103] Step 104 , performing truncated Laplace distribution sampling on the potential distribution of each node to generate a probability distribution of each node.
[0104] In an embodiment of the present application, compared to the Gaussian distribution estimate, the Laplace distribution estimate is less sensitive to outliers, because outliers usually represent damaged observation data or real samples from heavy-tailed noise processes. Due to the heavy-tail feature of the Laplace distribution, it has better robustness to simple adversarial attacks and data outliers. In practical applications, research on robust learning usually uses the logarithmic density of the Laplace distribution as the objective function to obtain a robust estimate of the required parameters. Due to the widespread existence of noisy data in dynamic graph data, using the Laplace distribution for node representation can well reduce the impact of outliers on the model. Therefore, a truncated sampling is used to generate a probability distribution for each node using the Laplace distribution.
[0105] The Laplace distribution is a symmetric function that describes the difference between two independent variables with the same exponential distribution.
[0106] For example, its probability density function is:
[0107]
[0108] In a possible implementation, a truncated Laplace distribution is sampled for each node's potential distribution to generate a probability distribution for each node, including:
[0109] Using Laplace distribution to perform multiple truncated sampling on each node, and obtaining multiple truncated sampling results for each node;
[0110] Reparameterize multiple truncated sampling results of each node to generate multiple probability distributions corresponding to each node;
[0111] The multiple probability distributions corresponding to each node are averaged to obtain the probability distribution of each node.
[0112] Specifically, the probability distribution of a node can be obtained by reparameterizing any node using Laplace distribution, and it is expected that this probability distribution can be infinitely close to the true distribution of the node. Therefore, the sampling process is repeated multiple times (M times) to obtain M probability distributions of the node. Then the M probability distributions are averaged to represent the probability distribution of the node.
[0113] For example, through multiple sampling and reparameterization techniques, we generate M different versions of the feature vector for each node That is, each node corresponds to M probability distributions. By averaging the above M probability distributions (adding up the M probabilities and dividing by M), we can get the probability distribution of the corresponding node.
[0114] Then the node representation is obtained by the following formula:
[0115]
[0116] Here, L(0,1) refers to the Laplace distribution.
[0117] In one possible implementation, in order to improve sampling robustness, the tail probability can be discarded during the sampling process, that is, when the sampling position is outside the range of [-2σ, 2σ], the value will be discarded and resampled. In this way, the present application can utilize the uncertainty in the data stream and ensure that while being able to capture the evolution information of the dynamic graph data, it can better ensure the robustness of the node representation learning.
[0118] Step 105 , input the probability distribution of each node into an open node classifier, and the open node classifier outputs the seen category or unseen category to which each node belongs.
[0119] In an embodiment of the present application, an open node classifier is obtained by training a node training set of known classifications using dense target coding and a comprehensive detection strategy.
[0120] Among them, dense target encoding refers to encoding discrete targets or labels (usually category information) into continuous, dense vectors or representations.
[0121] In an embodiment of the present application, the open node classifier can perform dense target coding on the nodes according to their probability distribution, and based on the dense target coding of each node, identify whether each node belongs to a seen category or an unseen category according to a comprehensive detection strategy.
[0122] In a possible implementation, the comprehensive detection strategy is an unseen class detection strategy based on a combination of distance, reconstruction and probability; the probability distribution of each node is input into an open node classifier, and the open node classifier outputs the seen category or unseen category to which each node belongs, including:
[0123] The probability distribution of each node is input into the open node classifier, which encodes the probability distribution of each node through dense target encoding to generate a prototype representation of the seen category corresponding to each node;
[0124] Through a comprehensive detection strategy based on distance, reconstruction and probability, the seen or unseen category to which each node belongs is output.
[0125] Here, prototypes of seen categories are represented as corresponding dense target encodings.
[0126] In an embodiment of the present application, encoding the probability distribution of each node through dense target coding can maximize the reconstruction error of categories other than the true class to which it belongs, and according to the comprehensive detection strategy, the seen categories and unseen categories to which each node belongs can be output more accurately.
[0127] Specifically, the comprehensive detection strategy based on the combination of distance, reconstruction and probability includes detection based on the distance between nodes and seen classes, detection based on reconstruction error, and detection based on prediction probability.
[0128] In a possible implementation, an unseen class detection strategy based on distance, reconstruction and probability is used to output the seen or unseen class to which each node belongs, including:
[0129] Comparing the distance between the node and the prototype representation of the corresponding seen category with a distance threshold to obtain a first detection result;
[0130] Comparing the reconstruction error of the detection node with the reconstruction threshold to obtain a second detection result;
[0131] Compare the class prediction probability value of the node with the probability threshold to obtain a third detection result;
[0132] If the first detection result, the second detection result, and the third detection result all indicate that the node belongs to a seen category, outputting the seen category of the node;
[0133] If the first detection result, the second detection result, and the third detection result all indicate that the node belongs to an unseen category, then the node is output as an unseen category.
[0134] Specifically, the detection method may include the following:
[0135] First, use d(z i ,E j ) represents the distance between node x and seen class j. Following the unknown class detection method in the traditional learning vector quantization classifier, for node x, if it does not match any seen class, it is identified as an unseen class, otherwise it is classified as a seen class. The formula is expressed as follows:
[0136]
[0137] Where τ1 is the distance threshold based on distance detection. j is the jth dense target encoding. min represents the value with the smallest distance from the node embedding representation z to all dense target encodings. In this application, the distance threshold τ1 can be obtained by ensuring that 90% of the samples in the validation set are identified as known classes.
[0138] Second, the reconstruction error can constrain the generator so that it is t It has better reconstruction ability, but shows poor reconstruction ability for unseen classes. Therefore, the reconstruction error of the seen class of the input sample will be smaller than the reconstruction error of the unseen class sample. For node x, if its reconstruction error is large, that is:
[0139]
[0140] Node x will be identified as an unseen class, otherwise it will be classified as a seen class. Where r(x) represents the reconstruction error, and τ2 is the reconstruction threshold based on reconstruction detection. Similarly, the reconstruction threshold τ2 can be obtained by ensuring that 90% of the samples in the validation set are identified as known classes.
[0141] Third, since the label loss function in the open learning classifier minimizes the cross entropy between the true class label and the predicted probability of the labeled data, and the class uncertainty loss function makes the "pseudo unseen class" output in the training sample close to a uniform distribution. Therefore, for a given node x, if its maximum predicted probability value is lower than a certain value (such as ),Right now:
[0142]
[0143] We will mark it as an unseen class, otherwise it will be classified as the class with the largest probability. The threshold τ3 will be automatically determined in the validation set by the formula τ3 = (avg_known + avg_E_unknown) / 2, where avg_known is the average predicted probability of non-"pseudo-unseen classes" and avg_E_unknown is the average predicted probability of "pseudo-unseen classes" (the 10% samples with the largest entropy in the validation set).
[0144] When the above three detection results all indicate that the node belongs to a seen category, the seen category of the node is output; when the above three detection results all indicate that the node belongs to an unseen category, the node is output as an unseen category.
[0145] In an embodiment of the present application, dynamic graph data can be first obtained, and node features and graph topology in the dynamic graph data can be determined based on the dynamic graph data. Secondly, the node features and graph topology are input into a neural network model, and the graph neural network model outputs the potential distribution of each node, that is, the dynamically evolving information in the dynamic graph data; a truncated Laplace distribution is sampled for the potential distribution of each node to generate a probability distribution for each node; finally, the probability distribution of each node is input into an open node classifier, and the open node classifier outputs the seen category or unseen category to which each node belongs. The open node classifier is trained on a node training set of known classifications using dense target encoding and comprehensive detection rules, and can more accurately detect classes that have not appeared during the training process and correctly classify seen classes.
[0146] See also Figure 3 , shows a schematic diagram of the process of training an open node classifier provided by another embodiment of the present application. Figure 3As shown, the training of the open node classifier may include the following steps:
[0147] Step 301: Input the nodes in the node training set with known classification into an open node classifier to obtain the predicted category of the node.
[0148] In the implementation of this application, since the open node classifier includes dense target encoding and comprehensive detection strategies, the nodes of known classification can be first input into the classifier to obtain the predicted category, which is then compared with the known category of the node to determine the accuracy of the predicted category.
[0149] Step 302, determining the dynamic variational autoencoder loss value, label loss value, class uncertainty loss value, and dense object encoding loss value of the node according to the known category and the predicted category.
[0150] In an embodiment of the present application, based on the dynamic variational autoencoder loss function, label loss function, class uncertainty loss function and dense target coding loss function, the dynamic variational autoencoder loss value, label loss value, class uncertainty loss value and dense target coding loss value of the node can be determined according to known categories and predicted categories.
[0151] Among them, the dense target encoding loss function is expressed as:
[0152]
[0153] The dynamic variational autoencoder loss function is expressed as:
[0154]
[0155] in Indicates that the posterior distribution Variational approximation z t-1 The marginal distribution in . In particular, The expression is as follows:
[0156]
[0157] and Yes t Exact approximation with delta function.
[0158] The label loss function is expressed as:
[0159]
[0160] The class uncertainty loss function is expressed as:
[0161]
[0162] Among them, the label loss function minimizes the cross entropy between the true category label and the predicted probability of the labeled data, while the class uncertainty loss function makes the “pseudo unseen class” output in the training samples close to a uniform distribution.
[0163] Step 303, using the dynamic variational autoencoder loss value, label loss value, class uncertainty loss value and dense target encoding loss value, perform model back propagation.
[0164] In the embodiment of the present application, the above four loss functions can be used to form the final target learning function, and the total loss value of the target learning function can be obtained, so as to perform model back propagation according to the total loss value. For example, the target learning function can be
[0165]
[0166] Among them, λ1, λ2, λ3 are balance parameters.
[0167] By bringing the dynamic variational autoencoder loss value, label loss value, class uncertainty loss value and dense target encoding loss value into the target learning function, the total loss value can be obtained, and then the model backpropagation can be performed based on the total loss value.
[0168] Step 304, until the dynamic variational autoencoder loss value, the label loss value, the class uncertainty loss value and the dense target encoding loss value all meet the loss threshold, the model parameters are determined, and the training of the open node classifier is completed.
[0169] In an embodiment of the present application, when the total loss value of the dynamic variational autoencoder loss value, the label loss value, the class uncertainty loss value, and the dense target encoding loss value meets the loss threshold, the model parameters of the open node classifier are determined to complete the training of the open node classifier.
[0170] In an embodiment of the present application, an open node classifier is trained based on a dynamic variational autoencoder loss value, a label loss value, a class uncertainty loss value, and a dense target encoding loss value to determine model parameters, and the node representation of the input node can be learned more accurately to achieve correct classification of the node.
[0171] See also Figure 4 , shows a structural schematic diagram of a node classification device for dynamic graph data provided in an embodiment of the present application. For the sake of ease of explanation, only the parts related to the embodiment of the present application are shown.
[0172] The node classification device of dynamic graph data may specifically include:
[0173] The data acquisition module 401 is used to acquire dynamic image data;
[0174] A first determination module 402 is used to determine node features and graph topology in the dynamic graph data according to the dynamic graph data;
[0175] A potential distribution output module 403 is used to input node features and graph topology into the graph neural network model, and the graph neural network model outputs the potential distribution of each node;
[0176] A generation module 404, for performing truncated Laplace distribution sampling on the potential distribution of each node to generate a probability distribution of each node;
[0177] The classification module 405 is used to input the probability distribution of each node into the open node classifier, and the open node classifier outputs the seen category or unseen category to which each node belongs. The open node classifier is trained on a node training set of known classifications using dense target coding and a comprehensive detection strategy.
[0178] In the embodiment of the present application, the dynamic image data includes static images at multiple moments; the first determination module 402 may specifically include the following units:
[0179] A feature extraction unit, used to extract, based on the static graphs at multiple moments, a node set and an edge set in the static graph at each moment and node features in the static graph at each moment;
[0180] The structure determination unit is used to determine the graph topology structure of the static graph at each moment according to the node set and edge set in the static graph at each moment.
[0181] In the embodiment of the present application, the graph neural network model includes a four-layer network; the potential distribution output module 403 may specifically include the following units:
[0182] The first network execution unit is used to input the node features and the graph topology structure of the static graph at time t into the first layer network to obtain the feature matrix output by the first layer network, wherein time t is any corresponding time in the dynamic graph data;
[0183] The second network execution unit is used to input the feature matrix into the second layer network, and obtain the deterministic feature matrix corresponding to the static graph at time t by recursive calculation, and the deterministic feature matrix is used to represent the deterministic state of each node;
[0184] The third network execution unit is used to determine the random state of each node at time t based on the third layer network and according to the deterministic feature matrix at time t and the node characteristics at time t;
[0185] The fourth network execution unit is used to model the random state of each node at time t by using the fourth layer network to obtain the potential distribution of each node.
[0186] In the embodiment of the present application, the first layer network is a graph convolutional network; the first network execution unit can be specifically used for:
[0187] Input the node features and graph topology of the static graph at time t into the graph convolutional network;
[0188] A feature matrix is generated based on the network parameters of the graph convolutional network, the node features of the static graph at time t, and the graph topology.
[0189] In the embodiment of the present application, the second layer network is a cyclic convolutional network; the second network execution unit can be specifically used for:
[0190] The feature matrix is input into the circular convolutional network, and the deterministic feature matrix at time t is output according to the feature matrix corresponding to the static graph at time t and the deterministic feature matrix at time t-1 output by the circular convolutional network to represent the deterministic state at time t.
[0191] In the embodiment of the present application, the third network execution unit may be specifically used for:
[0192] By introducing a separate random layer in the recurrent convolutional network, a random state is determined;
[0193] Based on the dynamic variational autoencoder, an inference network is used to learn the posterior distribution of nodes to estimate the network parameters of the random layer;
[0194] According to the deterministic feature matrix at time t, the node characteristics at time t, and the network parameters of the random layer, the random state of each node at time t is determined.
[0195] In the embodiment of the present application, the fourth network execution unit may be specifically used for:
[0196] The random state of each node at time t is modeled according to the multivariate Gaussian distribution, and the mean vector and standard deviation vector of the random state of each node at time t are obtained;
[0197] According to the mean vector and standard deviation vector of the random state of each node at time t, a reparameterization algorithm is used to generate the potential distribution of the nodes.
[0198] In the embodiment of the present application, the generation module 404 may specifically include the following units:
[0199] A sampling unit, used for performing multiple truncated sampling on each node by using Laplace distribution, and obtaining multiple truncated sampling results for each node;
[0200] A probability distribution generating unit, used for re-parameterizing a plurality of truncated sampling results of each node to generate a plurality of probability distributions corresponding to each node;
[0201] The probability distribution determination unit is used to take the average value of multiple probability distributions corresponding to each node to obtain the probability distribution of each node.
[0202] In the embodiment of the present application, the classification module may specifically include the following units:
[0203] A prototype representation generation unit, used for inputting the probability distribution of each node into an open node classifier, and the open node classifier encodes the probability distribution of each node through dense target encoding to generate a prototype representation of the seen category corresponding to each node;
[0204] The category output unit is used to output the seen category or unseen category to which each node belongs through a comprehensive detection strategy based on distance, reconstruction and probability.
[0205] In the embodiment of the present application, the category output unit can be specifically used for:
[0206] Comparing the distance between the node and the prototype representation of the corresponding seen category with a distance threshold to obtain a first detection result;
[0207] Comparing the reconstruction error of the detection node with the reconstruction threshold to obtain a second detection result;
[0208] Compare the class prediction probability value of the node with the probability threshold to obtain a third detection result;
[0209] If the first detection result, the second detection result, and the third detection result all indicate that the node belongs to a seen category, outputting the seen category of the node;
[0210] If the first detection result, the second detection result, and the third detection result all indicate that the node belongs to an unseen category, then the node is output as an unseen category.
[0211] In the embodiment of the present application, the node classification device of dynamic graph data may further include the following modules:
[0212] A prediction acquisition module, used for inputting nodes in a node training set of known classifications into an open node classifier to obtain a predicted category of the node;
[0213] A loss determination module, used to determine a dynamic variational autoencoder loss value, a label loss value, a class uncertainty loss value, and a dense target encoding loss value of the node according to known categories and predicted categories;
[0214] The back-propagation module is used to perform model back-propagation using the dynamic variational autoencoder loss, label loss, class uncertainty loss, and dense object encoding loss.
[0215] The training module is used to determine the model parameters and complete the training of the open node classifier until the dynamic variational autoencoder loss value, label loss value, class uncertainty loss value and dense target encoding loss value all meet the loss threshold.
[0216] The node classification device for dynamic graph data provided in the embodiment of the present application can be applied in the aforementioned method embodiment. For details, please refer to the description of the aforementioned method embodiment, which will not be repeated here.
[0217] See also Figure 5 , Figure 5 FIG. 1 shows a schematic diagram of the structure of a terminal device provided by an embodiment of the present application. Figure 5 As shown, the terminal device 500 of this embodiment includes: at least one processor 510 ( Figure 5 Only one is shown), a memory 520 and a computer program 521 stored in the memory 520 and executable on the at least one processor 510, wherein the processor 510 implements the steps in any of the above-mentioned node classification method embodiments for dynamic graph data when executing the computer program 521.
[0218] The terminal device 500 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 510 and a memory 520. Those skilled in the art will appreciate that Figure 5 It is only an example of the terminal device 500 and does not constitute a limitation on the terminal device 500. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0219] The processor 510 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0220] In some embodiments, the memory 520 may be an internal storage unit of the terminal device 500, such as a hard disk or memory of the terminal device 500. In other embodiments, the memory 520 may also be an external storage device of the terminal device 500, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device 500. Further, the memory 520 may also include both an internal storage unit of the terminal device 500 and an external storage device. The memory 520 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 520 may also be used to temporarily store data that has been output or is to be output.
[0221] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0222] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0223] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0224] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0225] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0226] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0227] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0228] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0229] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A node classification method for dynamic graph data, It is characterized in that The node classification scheme includes: Get dynamic graph data; Determine, according to the dynamic graph data, node features and graph topology in the dynamic graph data; Inputting the node features and the graph topology into a graph neural network model, and having the graph neural network model output the potential distribution of each node; Performing truncated Laplace distribution sampling on the potential distribution of each node to generate a probability distribution of each node; Inputting the probability distribution of each node into an open node classifier, the open node classifier outputs the seen category or unseen category to which each node belongs, the open node classifier is trained on a node training set of known classifications using dense object coding and a comprehensive detection strategy; The step of inputting the probability distribution of each node into the open node classifier, and outputting the seen category or unseen category to which each node belongs by the open node classifier, comprises: Inputting the probability distribution of each node into the open node classifier, the open node classifier encodes the probability distribution of each node by dense object encoding to generate a prototype representation of the seen category corresponding to each node, wherein the dense object encoding refers to encoding discrete objects or labels into continuous, dense vectors or representations; Outputting the seen category or unseen category to which each node belongs through a comprehensive detection strategy based on a combination of distance, reconstruction and probability, wherein the comprehensive detection strategy based on a combination of distance, reconstruction and probability includes detection based on the distance between the node and the seen category, detection based on reconstruction error, and detection based on prediction probability; The comprehensive detection strategy based on distance, reconstruction and probability is used to output the seen or unseen category to which each node belongs, including: Comparing the distance between the node and the prototype representation of the corresponding seen category with a distance threshold to obtain a first detection result; Comparing the reconstruction error of the detection node with the reconstruction threshold to obtain a second detection result; Compare the class prediction probability value of the node with the probability threshold to obtain a third detection result; If the first detection result, the second detection result, and the third detection result all indicate that the node belongs to a seen category, outputting the seen category of the node; If the first detection result, the second detection result, and the third detection result all indicate that the node belongs to an unseen category, then the node is output as an unseen category.
2. The node classification method according to claim 1, It is characterized in that The dynamic graph data includes static graphs at multiple moments; determining node features and graph topology in the dynamic graph data according to the dynamic graph data includes: Extracting, according to the static graphs at the multiple moments, a node set and an edge set in the static graph at each moment and node features in the static graph at each moment; The graph topology structure of the static graph at each moment is determined according to the node set and the edge set in the static graph at each moment.
3. The node classification method according to claim 2, It is characterized in that The graph neural network model includes a four-layer network; the node features and the graph topology structure are input into the graph neural network model, and the graph neural network model outputs the potential distribution of each node, including: Input the node features and the graph topology of the static graph at time t into the first layer network to obtain a feature matrix output by the first layer network, wherein time t is any corresponding time in the dynamic graph data; The feature matrix is input into the second layer network, and a deterministic feature matrix corresponding to the static graph at time t is obtained by recursive calculation, wherein the deterministic feature matrix is used to represent the deterministic state of each node; Based on the third layer network, determining the random state of each node at the time t according to the deterministic feature matrix at the time t and the node features at the time t; The fourth layer network is used to model the random state of each node at time t to obtain the potential distribution of each node.
4. The node classification method according to claim 3, It is characterized in that The first network layer is a graph convolutional network, the second network layer is a cyclic convolutional network, the third network layer is a combination of a separated random layer and an inference network introduced in the cyclic convolutional network, and the fourth network layer is a potential distribution generation network.
5. The node classification method according to claim 1, It is characterized in that The truncated Laplace distribution sampling is performed on the potential distribution of each node to generate the probability distribution of each node, including: Perform multiple truncated sampling on each node using Laplace distribution to obtain multiple truncated sampling results of each node; Reparameterizing the multiple truncated sampling results of each node to generate multiple probability distributions corresponding to each node; The multiple probability distributions corresponding to each node are averaged to obtain the probability distribution of each node.
6. The node classification method according to claim 1, It is characterized in that The training process of the open node classifier is: Input the nodes in the node training set with known classification into the open node classifier to obtain the predicted category of the node; According to the known category and the predicted category, determine the dynamic variational autoencoder loss value, label loss value, class uncertainty loss value and dense target encoding loss value of the node; Perform model back propagation using the dynamic variational autoencoder loss value, the label loss value, the class uncertainty loss value, and the dense target encoding loss value; Until the dynamic variational autoencoder loss value, the label loss value, the class uncertainty loss value and the dense target encoding loss value all meet the loss threshold, the model parameters are determined and the training of the open node classifier is completed.
7. A node classification device for dynamic graph data, It is characterized in that The node classification device comprises: A data acquisition module, used to acquire dynamic graph data; A first determination module, configured to determine node features and a graph topology structure in the dynamic graph data according to the dynamic graph data; A potential distribution output module, used for inputting the node features and the graph topology structure into a graph neural network model, and the graph neural network model outputs the potential distribution of each node; A generation module, used for performing truncated Laplace distribution sampling on the potential distribution of each node to generate a probability distribution of each node; A classification module, used for inputting the probability distribution of each node into an open node classifier, and the open node classifier outputs the seen category or unseen category to which each node belongs, wherein the open node classifier is trained on a node training set of known classifications using dense object coding and a comprehensive detection strategy; The classification module comprises: A prototype representation generation unit, configured to input the probability distribution of each node into the open node classifier, and the open node classifier encodes the probability distribution of each node by dense object encoding to generate a prototype representation of the seen category corresponding to each node, wherein the dense object encoding refers to encoding discrete objects or labels into continuous, dense vectors or representations; A category output unit, used to output the seen category or unseen category to which each node belongs through a comprehensive detection strategy based on a combination of distance, reconstruction and probability, wherein the comprehensive detection strategy based on a combination of distance, reconstruction and probability includes detection based on the distance between the node and the seen category, detection based on reconstruction error, and detection based on prediction probability; The category output unit is used for: Comparing the distance between the node and the prototype representation of the corresponding seen category with a distance threshold to obtain a first detection result; Comparing the reconstruction error of the detection node with the reconstruction threshold to obtain a second detection result; Compare the class prediction probability value of the node with the probability threshold to obtain a third detection result; If the first detection result, the second detection result, and the third detection result all indicate that the node belongs to a seen category, outputting the seen category of the node; If the first detection result, the second detection result, and the third detection result all indicate that the node belongs to an unseen category, then the node is output as an unseen category.
8. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
