A method, apparatus, device, and storage medium for cross-network edge classification
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-19
- Publication Date
- 2026-08-14
AI Technical Summary
然而,图结构数据显然违背了独立同分布的假设,因为图中的不同节点不是独立的,而是通过复杂的网络拓扑结构相联系
Smart Images

Figure CN116383736B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph neural networks, and in particular to a method, apparatus, device, and storage medium for cross-network edge classification. Background Technology
[0002] Graph Neural Networks (GNNs) are currently the most advanced network feature learning methods. They learn the features of each node by aggregating the attributes of the node itself and those of its neighbors, and have been widely applied in fields such as social networks, biomedicine, and e-commerce. In graph-structured data, edges play a crucial role. However, most existing GNNs focus only on learning the features of nodes, neglecting the features of edges. Furthermore, existing GNNs are based on the homogeneity assumption, which assumes that two connected nodes typically have the same label or similar features. Ideally, aggregating information from similar neighbors does indeed help learn node features. However, real-world graph-structured data often contains noisy edges, meaning an edge may connect two nodes with different labels (noisy edges are also called heterophilic edges; conversely, if an edge connects two nodes with the same label, it is called homophilic edges). Aggregating neighbor information through noisy edges can lead to the oversmoothing problem, where the features of nodes with different labels eventually become indistinguishable. The oversmoothing problem significantly degrades the performance of downstream graph machine learning tasks (such as node classification, edge classification, etc.). To mitigate the negative impact of noisy edges, several algorithms for identifying noisy edges (heterophilic edges) in single networks have recently been proposed. These algorithms utilize multilayer perceptrons (MLPs) to predict edges and output results, filtering out noisy edges or reducing their weights during the aggregation of neighbor node features. However, research on algorithms for classifying homophilic and heterophilic edges across networks is currently lacking.
[0003] Graph Convolutional Networks (GCNs) are among the most representative graph neural networks, and many variant models based on GCNs have been proposed. GCNs, in particular, use fixed edge weights during neighbor aggregation, treating all neighbor nodes as equal. This can easily lead to oversmoothing and is not conducive to distinguishing between like-and-dislike edges. Graph Attention Networks (GATs) are also a representative graph neural network. They can automatically learn adaptive edge weights to capture the importance of different neighbors, rather than using fixed edge weights, thus mitigating the negative impact of noisy edges on node and edge feature learning to some extent. However, in the original GAT, the supervision of graph attention weights is limited and indirect, which results in a limited ability to distinguish between like-and-dislike edges.
[0004] Furthermore, most current graph neural networks (GNNs) are designed based on a single network, and the distributional differences between different networks hinder the direct application of GNN models trained on the source network to new target networks. Therefore, current GNN models based on a single network cannot be directly applied to cross-network edge classification problems. Domain adaptation is an effective method to reduce the distributional differences between the source and target domains. Although domain adaptation has achieved significant success in computer vision and natural language processing, applying it to graph-structured data is not easy. This is because traditional domain adaptation algorithms assume that each sample is independent and identically distributed within the domain. However, graph-structured data clearly violates the assumption of independence and identical distribution, because different nodes in the graph are not independent but connected through complex network topology. Therefore, traditional domain adaptation algorithms based on the assumption of independence and identical distribution cannot be directly applied to cross-network edge classification problems.
[0005] The current challenges in cross-network edge classification are as follows: 1) Existing graph neural network models for single-network edge classification often only use simple graph dynamic programming (MLP) for edge classification. However, MLP does not consider the structural information of the graph and cannot learn node and edge features suitable for cross-network homophilic and heterophilic edge classification tasks; 2) Existing graph neural network-based cross-network classification node algorithms typically use graph neural networks (GCNs) as graph encoders to learn node features. However, GCNs are prone to oversmoothing and cannot learn node and edge features suitable for cross-network homophilic and heterophilic edge classification tasks; 3) Existing GAT algorithms can alleviate the negative impact of heterophilic edges on the node and edge feature learning process to some extent. The existing graph neural network-based cross-network classification algorithms only address cross-network node classification problems and cannot guarantee the learning of effective edge features. The existing graph neural network-based cross-network classification algorithms ignore the negative impact of noisy edges (heterophilic edges) on feature learning and downstream tasks. The existing edge classification algorithms for a single network do not consider the distribution differences between the source and target networks and cannot guarantee that nodes of the same category have similar features in different networks. Therefore, they cannot be directly applied to cross-network homophilic and heterophilic edge classification problems. Summary of the Invention
[0006] In view of this, the purpose of this invention is to provide a cross-network edge classification method, apparatus, device, and storage medium that can improve the accuracy of target network edge identification and classification. The specific solution is as follows:
[0007] Firstly, this application discloses a cross-network edge classification method, including:
[0008] The information set corresponding to the network is input into the cross-network edge classification model to obtain all node features; the all node features include source network node features and target network node features;
[0009] The node classification loss function is calculated based on the source network node features and the preset node classification loss function formula.
[0010] The source network attention edge weights are learned based on the source network node features, and the supervised attention loss function is calculated based on the source network attention edge weights and a preset supervised attention loss function formula.
[0011] Construct corresponding edge features based on all node features, and obtain corresponding edge classification loss functions and domain classification loss functions based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula.
[0012] The overall loss function is determined based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, and it is determined whether the overall loss function satisfies the preset condition of descent and convergence.
[0013] If the overall loss function satisfies the preset condition of decreasing and converging, then the adjusted cross-network edge classification model corresponding to the current set of learnable parameters at the time of convergence is obtained, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edges.
[0014] Optionally, inputting the information set corresponding to the network into the cross-network edge classification model to obtain all node features includes:
[0015] Obtain a first information set corresponding to the source network and a second information set corresponding to the target network; both the first information set and the second information set contain the node attributes and adjacency matrix of the corresponding nodes in the network; the first information set contains the actual label information of the nodes;
[0016] The first information set and the second information set are defined as the information set;
[0017] The first processing layer of the graph encoder of the cross-network edge classification model is determined as the current processing layer;
[0018] The information set is input into the current processing layer so that the first node feature is calculated based on the information set, the preset function, the first attention edge weight, and the preset node feature calculation formula.
[0019] Determine whether the current processing layer is the last layer of the graph encoder;
[0020] If the current processing layer is not the last layer of the graph encoder, then the next processing layer after the first processing layer is determined as the current processing layer;
[0021] The first node feature is input to the current processing layer so that the second node feature is calculated based on the first node feature, the adjacency matrix corresponding to the current processing layer, the second attention edge weight, and the preset node feature calculation formula, and then the step of determining whether the current processing layer is the last layer of the graph encoder is re-entered.
[0022] If the current processing layer is the last layer of the graph encoder, then the node features output by the current processing layer are determined as all node features.
[0023] Optionally, the step of learning the source network attention edge weights based on the source network node features, and calculating the supervised attention loss function based on the source network attention edge weights and a preset supervised attention loss function formula, includes:
[0024] Determine the current processing layer corresponding to the current source network node features, and learn the current source network attention edge weights based on the current source network node features;
[0025] The supervised attention loss function is calculated based on the current source network attention edge weights, the first real label information, preset parameters, and the preset supervised attention loss function formula.
[0026] The supervised attention loss function output by each processing layer in the graph encoder is summed to obtain the total supervised attention loss function.
[0027] Optionally, obtaining the corresponding edge classification loss function and domain classification loss function based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula includes:
[0028] Obtain the edge features corresponding to the source network and the target network to obtain the current edge features;
[0029] The current source network edge features in the current edge features are input into the edge classifier of the cross-network edge classification model so as to calculate the edge classification loss function based on the current source network edge features and the preset edge classification loss function formula;
[0030] The current edge features are input into the domain discriminator of the cross-network edge classification model so that the domain classification loss function can be calculated based on the current edge features and the preset domain classification loss function formula.
[0031] Optionally, the step of inputting the current source network edge features from the current edge features into the edge classifier of the cross-network edge classification model, so as to calculate the edge classification loss function based on the current source network edge features and the preset edge classification loss function formula, includes:
[0032] The current source network edge features are input into the edge classifier of the cross-network edge classification model so as to calculate the source network edge type prediction probability based on the current source network edge features, the second learnable parameter and the second preset prediction probability formula; the source network edge type prediction probability is the prediction probability that the edge corresponding to the current source network edge features is a homozygous edge.
[0033] The edge classification loss function is calculated based on the predicted probability of the source network edge type, the first real label information, and the preset edge classification loss function formula.
[0034] Optionally, the step of inputting the current edge features into the domain discriminator of the cross-network edge classification model, so as to calculate the domain classification loss function based on the current edge features and the preset domain classification loss function formula, includes:
[0035] Obtain the current source network edge features and the current target network edge features from the current edge features;
[0036] The current source network edge features and the current target network edge features are input into the domain discriminator of the cross-network edge classification model so as to calculate the domain prediction probability based on the current source network edge features, the current target network edge features, the third learnable parameter and the third preset prediction probability formula; the domain prediction probability includes the source network domain prediction probability and the target network domain prediction probability.
[0037] The domain classification loss function is calculated based on the source network domain prediction probability, the target network domain prediction probability, the second true label information, and the preset domain classification loss function formula.
[0038] Optionally, the step of calculating the node classification loss function based on the source network node features and a preset node classification loss function formula includes:
[0039] All node features are input into the node classifier of the cross-network edge classification model to obtain all predicted label probability vectors based on a preset first learnable parameter and a first preset prediction probability formula; the all predicted label probability vectors include the source network predicted label probability vector and the target network predicted label probability vector.
[0040] The node classification loss function is calculated based on the source network predicted label probability vector, the third real label information, and the preset node classification loss function formula.
[0041] Secondly, this application discloses a cross-network edge classification device, comprising:
[0042] The node feature acquisition module is used to input the information set corresponding to the network into the cross-network edge classification model to obtain all node features; the all node features include source network node features and target network node features;
[0043] The first loss function calculation module is used to calculate the node classification loss function based on the source network node features and a preset node classification loss function formula.
[0044] The second loss function calculation module is used to learn the source network attention edge weights based on the source network node features, and to calculate the supervised attention loss function based on the source network attention edge weights and a preset supervised attention loss function formula.
[0045] The third loss function calculation module is used to construct corresponding edge features based on all node features, and to obtain the corresponding edge classification loss function and domain classification loss function based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula.
[0046] The overall loss function calculation module is used to determine the overall loss function based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, and to determine whether the overall loss function satisfies the preset conditions of descent and convergence.
[0047] The model acquisition module is used to acquire the adjusted cross-network edge classification model corresponding to the current set of learnable parameters at the time of convergence if the overall loss function satisfies the preset condition of decreasing and converging, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edges.
[0048] Thirdly, this application discloses an electronic device, including:
[0049] Memory, used to store computer programs;
[0050] A processor is configured to execute the computer program to implement the steps of the cross-network edge classification method disclosed above.
[0051] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the cross-network edge classification method disclosed above.
[0052] As can be seen, this application provides a cross-network edge classification method, including: inputting the information set corresponding to the network into a cross-network edge classification model to obtain all node features; the all node features include source network node features and target network node features; calculating a node classification loss function based on the source network node features and a preset node classification loss function formula; learning source network attention edge weights based on the source network node features, and calculating a supervised attention loss function based on the source network attention edge weights and a preset supervised attention loss function formula; constructing corresponding edge features based on the all node features, and calculating a supervised attention loss function based on the edge features and the preset edge features. The application obtains the corresponding edge classification loss function and domain classification loss function using the classification loss function formula and the preset domain classification loss function formula. Based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, the overall loss function is determined, and it is judged whether the overall loss function satisfies the preset condition of descent and convergence. If the overall loss function satisfies the preset condition of descent and convergence, the adjusted cross-network edge classification model corresponding to the current learnable parameter set at convergence is obtained, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on network edges. Therefore, this application uses multiple loss function values to adjust the current learnable parameters of the model, learns edge features with class discrimination and network invariance, learns more meaningful edge features through multiple loss function values, and determines the final parameters when the final function value satisfies the preset condition, thereby obtaining the adjusted cross-network edge classification model and improving the accuracy of target network edge classification. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0054] Figure 1 This is a flowchart of a cross-network edge classification method disclosed in this application;
[0055] Figure 2 This is a schematic diagram of the model structure disclosed in this application;
[0056] Figure 3 This is a flowchart of a specific cross-network edge classification method disclosed in this application;
[0057] Figure 4 This is a schematic diagram of the DGASN function disclosed in this application;
[0058] Figure 5 This is a schematic diagram of cross-network edge classification disclosed in this application;
[0059] Figure 6 A schematic diagram of the cross-network edge classification device provided in this application;
[0060] Figure 7 This application provides a structural diagram of an electronic device. Detailed Implementation
[0061] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0062] Currently, existing graph neural network (Graph Neural Network) models for single-network edge classification often employ simple machine learning algorithms (MLPs) for edge classification, failing to learn node and edge features suitable for cross-network homophile and heterophile edge classification tasks. Existing cross-network classification node algorithms based on Graph Neural Networks typically use graph neural networks (GCNs) as graph encoders to learn node features, but GCNs are prone to oversmoothing, failing to learn node and edge features suitable for cross-network homophile and heterophile edge classification tasks. In the original GAT algorithm, the supervision information for graph attention weights is limited and indirect, easily leading to overfitting and oversmoothing problems. Existing cross-network classification algorithms based on Graph Neural Networks only address cross-network node classification problems and cannot guarantee the learning of effective edge features. Existing cross-network classification algorithms based on Graph Neural Networks ignore the negative impact of noisy edges (heterophile edges) on feature learning and downstream tasks. Existing edge classification algorithms for single networks do not consider the distribution differences between the source and target networks, failing to guarantee that nodes of the same category have similar features in different networks, thus making them unsuitable for direct application to cross-network homophile and heterophile edge classification problems. Therefore, this application provides a cross-network edge classification method that can improve the accuracy of edge recognition.
[0063] This invention discloses a cross-network edge classification method, see [link to relevant documentation]. Figure 1 As shown, the method includes:
[0064] Step S11: Input the information set corresponding to the network into the cross-network edge classification model to obtain the features of all nodes.
[0065] In this embodiment, the information set corresponding to the network is input into the cross-network edge classification model to obtain all node features; the all node features include source network node features and target network node features. Specifically, a first information set corresponding to the source network and a second information set corresponding to the target network are obtained; both the first and second information sets contain the node attributes and adjacency matrices of the corresponding nodes in the network; the first information set contains the node's true label information; the first and second information sets are determined as the information set; the information set is input into the current processing layer to calculate the first node feature (i.e., the node feature output by the first processing layer) based on the information set, a preset function, a first attention edge weight, and a preset node feature calculation formula; it is then determined whether the current processing layer is the graph coding. The first processing layer is the last layer of the graph encoder; if the current processing layer is not the last layer of the graph encoder, then the next processing layer of the first processing layer is determined as the current processing layer; the first node features are input to the current processing layer so that the second node features are calculated based on the first node features, the adjacency matrix corresponding to the current processing layer, the second attention edge weights, and the preset node feature calculation formula, and the process re-enters the step of determining whether the current processing layer is the last layer of the graph encoder; if the current processing layer is the last layer of the graph encoder, then the node features output by the current processing layer are determined as the all node features; wherein, the all node features include source network node features and target network node features. For example, the information set corresponding to the network includes the data information of the source network and the data information of the target network; the data information of the source network (i.e., the first information set) includes source network node attributes, adjacency matrix, and true labels, and the data information of the target network (i.e., the second information set) includes target network node attributes and adjacency matrix. Accordingly, the obtained all node features include source network node features and target network node features. In addition, the source network and the target network use the same learnable parameters MultiHead-GAT to learn node features.
[0066] It should be noted that the above cross-network edge classification model is the unprocessed cross-network edge classification model. The model after inputting the data from the two graph structures into the above cross-network edge classification model is called the adjusted cross-network edge classification model. That is, the cross-network edge classification model and the adjusted cross-network edge classification model are the same model, and no new model is generated. The two graph structures are the graph structure data of the source network and the graph structure data of the target network. The ultimate goal of the adjusted cross-network edge classification model is to predict the category of edges in the target network, that is, to predict whether the edges in the target network are homophilic or heterophilic edges.
[0067] Understandably, while research on cross-network homophilic and heterophilic edge classification algorithms is currently lacking, cross-network edge classification can be achieved by combining graph neural networks and domain adaptation. On one hand, graph neural networks can be used to learn node features that capture network topology and node attributes, and edge features can be constructed from these node features to solve the edge classification problem. On the other hand, domain adaptation can be used to learn edge features with network invariance to solve cross-network problems. This application employs a domain-adaptive graph attention supervised network model, named DGASN, to address the problems existing in the prior art. Figure 2 As shown, DGASN mainly consists of the following 5 parts: graph neural network (improved GAT encoder), node classifier, edge feature constructor, edge classifier, and domain discriminator.
[0068] Furthermore, DGASN employs an improved Multi-head GAT as its graph encoder. The Multi-head GAT is implemented by concatenating multiple independent GATs, and DGASN directly supervises the attention weights learned by each GAT layer. Specifically, based on the known edge labels of the source network, DGASN designs a supervised attention loss function to ensure that homophilic edges have larger attention weights and heterophilic edges have smaller attention weights. Therefore, heterophilic edges with smaller attention weights have less negative impact on neighbor aggregation, ultimately learning node and edge features that can distinguish between homophilic and heterophilic edges. In addition to using an improved attention-supervised GAT as the graph encoder to minimize the negative impact of heterophilic edges on neighbor aggregation, DGASN also designs an edge classifier and a node classifier based on the known node and edge labels of the source network. By simultaneously minimizing the loss functions of these two classifiers, they are jointly trained, enabling the graph encoder to learn not only label-discriminating node features but also edge features that distinguish between homophilic and heterophilic edges. An improved version of GAT is used as the graph encoder, jointly training the node classifier and edge classifier, thereby learning effective edge features without ignoring the negative impact of noisy edges (heterophilic edges) on feature learning and downstream tasks. DGASN constructs a domain discriminator whose input is the edge features. DGASN trains the domain discriminator to distinguish edge features from those of the source and target networks as much as possible. DGASN trains the graph encoder to learn network-invariant edge features to deceive the domain discriminator. By allowing the domain discriminator and graph encoder to undergo adversarial training and reach a balance, DGASN enables edges from different networks to possess network-invariant features.
[0069] Step S12: Calculate the node classification loss function based on the source network node features and the preset node classification loss function formula.
[0070] In this embodiment, the information set corresponding to the network is input into the cross-network edge classification model to obtain all node features. Then, based on the source network node features and a preset node classification loss function formula, a node classification loss function is calculated. Specifically, all node features are input into the node classifier of the cross-network edge classification model to obtain all predicted label probability vectors based on a preset first learnable parameter and a first preset prediction probability formula. These all predicted label probability vectors include the source network predicted label probability vector and the target network predicted label probability vector. The node classification loss function is calculated based on the source network predicted label probability vector, third true label information, and the preset node classification loss function formula. It can be understood that the preset first learnable parameter is θ. y The learnable parameters of the node classifier are: the first preset prediction probability formula is Equation 7; the probability vector of all predicted labels is: That is, node v i The predicted label probability vector; the predicted label probability vector of the source network is the same as the predicted label probability vector of the source network. The target network's predicted label probability vector is the target network's corresponding... The preset node classification loss function is Equation 8; the third true label information is... That is, the true label of the i-th node in the source network with respect to the c-th class.
[0071] Step S13: Learn the source network attention edge weights based on the source network node features, and calculate the supervised attention loss function based on the source network attention edge weights and the preset supervised attention loss function formula.
[0072] In this embodiment, the attention edge weights of the source network are learned based on the features of the source network nodes, and the supervised attention loss function is calculated based on the source network attention edge weights and a preset supervised attention loss function formula. It can be understood that the information sets corresponding to the source and target networks are input into the GNN encoder, i.e., the Multi-head GAT (Multi-head Graph Attention Network). This multi-head GAT learns the feature representations of the nodes of the source and target networks, obtaining all node features, and the source and target networks share learnable parameters. The Multi-head GAT can adaptively obtain edge weights; that is, the attention edge weights are automatically learned by the Multi-head GAT. A loss function, i.e., the preset supervised attention loss function, is applied to these edge weights to guide the edge weights of like-interested edges to tend to be larger, and the edge weights of dislike-interested edges to tend to be smaller, which helps to ultimately predict the labels of the target network edges. It is important to note that Multi-GAT is implemented by stacking multiple GAT hidden layers. In each GAT hidden layer, an attention loss function is calculated. This loss function is derived from the cross-entropy calculated by Multi-head GAT adaptively obtaining the edge weights and the true values of the edges. Furthermore, the aforementioned pre-defined supervised attention loss function is only applied to the source network and is not applied to the target network.
[0073] Step S14: Construct corresponding edge features based on all node features, and obtain the corresponding edge classification loss function and domain classification loss function based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula.
[0074] In this embodiment, source network attention edge weights are learned based on the source network node features, and a supervised attention loss function is calculated based on the source network attention edge weights and a preset supervised attention loss function formula. Then, corresponding edge features are constructed based on all node features, and the corresponding edge classification loss function and domain classification loss function are obtained based on the edge features, a preset edge classification loss function formula, and a preset domain classification loss function formula. Specifically, the edge features corresponding to the source network and the target network are obtained to obtain the current edge features; the current source network edge features in the current edge features are input to the edge classifier of the cross-network edge classification model to calculate the edge classification loss function based on the current source network edge features and the preset edge classification loss function formula; the current edge features are input to the domain discriminator of the cross-network edge classification model to calculate the domain classification loss function based on the current edge features and the preset domain classification loss function formula. Understandably, the current source network edge features are input to the edge classifier of the cross-network edge classification model to calculate the source network edge type prediction probability based on the current source network edge features, the second learnable parameter, and the second preset prediction probability formula; the source network edge type prediction probability is the prediction probability that the edge corresponding to the current source network edge feature is a homozygous edge; the edge classification loss function is calculated based on the source network edge type prediction probability, the first true label information, and the preset edge classification loss function formula; the current source network edge features and the current target network edge features are obtained from the current edge features; the current source network edge features and the current target network edge features are input to the domain discriminator of the cross-network edge classification model to calculate the domain prediction probability based on the current source network edge features, the current target network edge features, the third learnable parameter, and the third preset prediction probability formula; the domain prediction probability includes the source network domain prediction probability and the target network domain prediction probability; the domain classification loss function is calculated based on the source network domain prediction probability, the target network domain prediction probability, the second true label information, and the preset domain classification loss function formula.
[0075] It should be noted that the predicted probability of the source network edge type is the probability of the source network edge type. That is, the edges (v) in the source network i ,v j ) represents the predicted probability of the same-favorite edge; the first true label information is the source network corresponding to That is, the edge (v) in the source network i ,v j The true label; the preset edge classification loss function is Equation 11; the predicted probability of the source network domain is the value corresponding to the source network. That is, the edge (v) in the source network i ,v jThe probability of belonging to the prediction domain of the target network; the second learnable parameter is θ. z That is, all learnable parameters of the edge classifier; the second preset prediction probability formula is Formula 10; the target network domain prediction probability is the target network corresponding to The second set of real label information consists of the real domain labels in the source and target networks; the third learnable parameter is θ. d , that is, the learnable parameters of the domain discriminator; the third preset prediction probability formula is Formula 12.
[0076] Step S15: Determine the overall loss function based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, and determine whether the overall loss function satisfies the preset condition of descent and convergence.
[0077] In this embodiment, after obtaining the corresponding edge classification loss function and domain classification loss function based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula, the overall loss function is determined based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula. It is then determined whether the overall loss function satisfies the preset condition of descent and convergence. It is understood that when calculating the overall loss function, it is necessary to calculate all four functions obtained above—the node classification loss function, the supervised attention loss function, the edge classification loss function, and the domain classification loss function—and determine whether the preset condition of descent and convergence is satisfied based on the change in the calculated overall loss function.
[0078] Step S16: If the overall loss function satisfies the preset condition of decreasing and converging, then obtain the adjusted cross-network edge classification model corresponding to the current set of learnable parameters at the time of convergence, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edges.
[0079] In this embodiment, after determining whether the overall loss function satisfies the preset condition of decreasing and converging, if the overall loss function satisfies the preset condition of decreasing and converging, the adjusted cross-network edge classification model corresponding to the current learnable parameter set at the time of convergence is obtained, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edges. It can be understood that determining whether the overall loss function decreases and converges: if the overall loss function decreases and converges, the current learnable parameter set is obtained and the corresponding adjusted cross-network edge classification model is obtained based on the current learnable parameter set; if the overall loss function does not converge, multiple iterations are performed until the overall loss function converges. That is, if the overall loss function decreases and converges, the current learnable parameter set is obtained and the corresponding adjusted cross-network edge classification model is obtained based on the current learnable parameter set, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edges.
[0080] It is understandable that GCN uses fixed edge weights during neighbor aggregation, making it difficult to distinguish between homophilic and heterophilic edges. The GAT algorithm employs an attention mechanism to automatically learn adaptive edge weights, which can mitigate the negative impact of heterophilic edges on neighbor aggregation to some extent. However, the original GAT model has limited and indirect supervision information for graph attention weights. This application proposes a Domain Adaptive Graph Attention Supervision Network (DGASN), an algorithm that effectively solves the problem of classifying homophilic and heterophilic edges across networks. The proposed DGASN model uses an improved version of GAT, namely, a directly supervised graph attention network as the graph encoder, and designs a supervised attention loss to guide homophilic edges to have larger attention weights and heterophilic edges to have smaller attention weights, thereby effectively reducing the negative impact of heterophilic edges on the neighborhood aggregation process. The node classifier and edge classifier are jointly trained, and by minimizing the loss functions of these two classifiers, the graph encoder is driven to learn node features with label discriminative capabilities and edge features that easily distinguish between homophilic and heterophilic edges. The DGASN model employs a domain discriminator to perform adversarial training with the graph encoder, enabling the graph encoder to learn edge features with network invariance, effectively solving the problem of cross-network edge classification.
[0081] As can be seen, this application provides a cross-network edge classification method, including: inputting the information set corresponding to the network into a cross-network edge classification model to obtain all node features; the all node features include source network node features and target network node features; calculating a node classification loss function based on the source network node features and a preset node classification loss function formula; learning source network attention edge weights based on the source network node features, and calculating a supervised attention loss function based on the source network attention edge weights and a preset supervised attention loss function formula; constructing corresponding edge features based on the all node features, and calculating a supervised attention loss function based on the edge features and the preset edge features. The application obtains the corresponding edge classification loss function and domain classification loss function using the classification loss function formula and the preset domain classification loss function formula. Based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, the overall loss function is determined, and it is judged whether the overall loss function satisfies the preset condition of descent and convergence. If the overall loss function satisfies the preset condition of descent and convergence, the adjusted cross-network edge classification model corresponding to the current learnable parameter set at convergence is obtained, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on network edges. Therefore, this application uses multiple loss function values to adjust the current learnable parameters of the model, learns edge features with class discrimination and network invariance, learns more meaningful edge features through multiple loss function values, and determines the final parameters when the final function value satisfies the preset condition, thereby obtaining the adjusted cross-network edge classification model and improving the accuracy of target network edge classification.
[0082] See Figure 3 As shown, this embodiment of the invention discloses a cross-network edge classification method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0083] Step S21: Input the information set corresponding to the network into the cross-network edge classification model to obtain the features of all nodes.
[0084] In this embodiment, as Figure 4 As shown, the DGASN model comprises five key modules: a graph encoder, an edge feature constructor, a node classifier, an edge classifier, and a domain discriminator. The graph encoder (an improved attention-supervised GAT model) takes node attributes and the graph's adjacency matrix (each layer's input adjacency matrix is a new matrix representing a reference relationship) as input. It uses a multi-head GAT as the graph encoder to learn node features and obtains the attention edge weights learned in each GAT hidden layer. Based on the attention edge weights learned in each GAT layer of the source network and the known edge labels of the source network, the attention-supervised loss function value is calculated, resulting in L... aNode classifier: The node features output by the graph encoder (i.e., graph neural network) are used as input to the node classifier to predict node labels. Based on the predicted node labels output by the node classifier and the known node labels of the source network, the node classification loss function value is calculated to obtain L. n Edge Feature Constructor: Based on the node features output by the graph encoder, the features of the two nodes on each edge are concatenated using a preset concatenation method to obtain the corresponding edge features. Edge Classifier: The obtained edge features are used as input to the edge classifier to predict edge labels. Based on the edge labels predicted by the edge classifier and the known edge labels of the source network, the edge classification loss function value is calculated to obtain L. e Domain Discriminator: Edge features are used as input to the domain discriminator. The domain discriminator undergoes adversarial training against the graph encoder, and the domain classification loss function value is calculated to obtain L. d The process involves obtaining the attention weights of each GAT hidden layer, then calculating the supervised attention loss function using the attention weights of each GAT hidden layer in the source network, the labels of the edges in the source network (homophile edges and heterophile edges), and a pre-defined loss function. For example... Figure 5 As shown, in this application, the source network has known labels, while the target network has no labels. That is, the label information of nodes, node attributes, and the label information of each edge in the source network are all known information, while the label information of nodes, node attributes, and edge labels in the target network are all unknown information. Therefore, when calculating the domain classification loss function in the model, the information corresponding to the source network and the information corresponding to the target network are used for calculation; when calculating other classification loss functions, the information corresponding to the source network is used for calculation. In the cross-network homophilic and heterophilic edge classification problem, the nodes and edges of the source network all have known category labels, while the nodes and edges of the target network have no category labels. The purpose of cross-network homophilic and heterophilic edge classification is to transfer knowledge learned from the source network to help the target network identify whether a certain edge belongs to homophilic or heterophilic edges.
[0085] Understandably, the node attributes and adjacency matrix of each network (including the source and target networks) are input into the graph encoder, and the output is the node features of the source network and the node features of the target network (features of all nodes). Specifically, the feature representation of each node is obtained by adaptively aggregating its own and its first-order neighbors' feature representations using a GAT layer, as shown in the following formula:
[0086]
[0087] in, It is the node v learned by the l-th layer GAT. i eigenvectors, W is the input attribute vector of the node. (l) It is the learnable weight matrix corresponding to the l-th layer GAT. It is node vi The set of first-order neighbors, ELU is a non-linear activation function.
[0088] The edge (v) learned by the l-th layer GAT i ,v j The attention edge weights are calculated using the following formula:
[0089]
[0090]
[0091] Where LeakyReLU is a non-linear activation function, and [·‖·] represents the concatenation operation. T Represents the transpose operation, a (l) It is the learnable weight vector of the l-th layer GAT.
[0092] To make the graph attention mechanism more stable, a Multi-head GAT (Graph Attention Network) is used to concatenate the node features learned from multiple independent GATs as the final node features. It should be noted that since the Multi-head GAT is implemented by concatenating multiple independent GATs, it contains multiple layers of independent GATs. The input of each GAT layer is the node features output from the previous layer. Therefore, the node features output from the last layer of the Multi-head GAT are the final target node features output by the graph neural network.
[0093] Let the above graph encoder be denoted as f. h (·;θ h ), where θ h This is the set of all learnable parameters of the graph encoder. It's worth noting that the source and target networks use the same learnable parameters for the graph encoder:
[0094]
[0095]
[0096] in, Indicates the number of nodes in the source network. This indicates the number of nodes in the target network. Representing nodes in the source network Feature representation, Represents nodes in the target network The characteristics are represented.
[0097] Step S22: Determine the current processing layer corresponding to the current source network node features, learn the current source network attention edge weights based on the current source network node features, and calculate the supervised attention loss function based on the current source network attention edge weights, the first real label information, preset parameters, and the preset supervised attention loss function formula.
[0098] In this embodiment, the current processing layer corresponding to the current source network node features is determined, and the current source network attention edge weights are learned based on the current source network node features. The supervised attention loss function is calculated based on the current source network attention edge weights, the first real label information, preset parameters, and the preset supervised attention loss function formula.
[0099] It should be noted that the current attention edge weights and all the aforementioned attention edge weights are automatically learned through Multihead-GAT; the first true label information is... It is an edge (v) i ,v j The true label; the preset parameter is γ in Formula 5.
[0100] Understandably, in the original GAT model, the supervision of graph attention weights is indirect and limited. To improve upon the limitations of the original GAT, the proposed DGASN model provides more supervisory information for the learning process of graph attention weights. The supervisory signals come not only from node classification loss but also from edge classification loss, supervised attention loss, and domain classification loss. The supervised attention loss proposed in the DGASN algorithm directly supervises the attention edge weights based on the known edge labels of the source network, as shown in the following formula:
[0101]
[0102] Where, |ε s | represents the number of edges in the source network. Before normalization (v) i ,v j The attention edge weights learned by the GAT in the l-th layer (derived from Equation 2). It is an edge (v) i The true label of j) Indicates (v) i ,v j ) is the same as the side of the same preference. Indicates (v) i ,v j () represents heterophilic edges. σ is the sigmoid activation function; the value after processing by the sigmoid function will fall within the interval (0, 1). By minimizing... This will result in larger weights for homophilic edges (i.e., tending to 1) and smaller weights for heterophilic edges (i.e., tending to 0).
[0103] Furthermore, in graph datasets based on the homogeneity assumption, the number of homophilic edges is much greater than that of heterophilic edges. This means that directly minimizing Equation 4 will cause the model to be biased towards accurately learning the weights of homophilic edges. To make the model more biased towards accurately learning the weights of the sparse heterophilic edges, Equation 4 is improved by introducing a parameter γ (i.e., the preset parameter mentioned above, the value range of γ can be customized, for example, γ>1), resulting in the following formula:
[0104]
[0105] Step S23: Sum the supervised attention loss functions output by each processing layer in the graph encoder to obtain the total supervised attention loss function.
[0106] In this embodiment, the supervised attention loss functions output by each processing layer in the graph encoder are summed to obtain the total supervised attention loss function. It can be understood that Formula 5 is applied to each independent GAT layer in the Multi-head GAT, and the supervised attention loss function results output by each layer are summed to obtain the total supervised attention loss function result. The specific formula is as follows:
[0107]
[0108] Where L represents the total number of layers in the GAT. By minimizing It is possible to learn more meaningful attention edge weights, that is, to make the weight of homophilic edges greater and the weight of heterophilic edges lower in each layer of GAT.
[0109] Step S24: Calculate the node classification loss function based on the source network node features and the preset node classification loss function formula.
[0110] In this embodiment, the node classification loss function is calculated based on the source network node features and a preset node classification loss function formula. It can be understood that, let f... y (·;θ y ) represents a node classifier, which is constructed from a multilayer perceptron (MLP). The obtained node features h i Input to node classifier f y (·;θ y ),available:
[0111]
[0112] Where, θ y These are the learnable parameters of the node classifier. Represents node v i The predicted label probability vector. Based on the predicted label probability and the true label of each node in the source network, the node classification loss function is calculated as follows, with the specific formula as follows:
[0113]
[0114] in, It is the true label of the i-th node in the source network with respect to the c-th class. When it truly belongs to class c, otherwise By minimizing We learn node features that are class-discriminative, meaning that nodes of different classes have different feature representations.
[0115] Step S25: Construct corresponding edge features based on all node features, and obtain the corresponding edge classification loss function and domain classification loss function based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula.
[0116] In this embodiment, after obtaining all node features, an edge feature constructor is used to construct corresponding edge features based on all node features. It can be understood that the methods for constructing edge features include the following:
[0117]
[0118] in, Representing the edge (v) i ,v j The characteristics of ) and h i and h j Representing the edge (v) i ,v j The features of the two nodes can be constructed using any of the above formulas.
[0119] Furthermore, based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula, the corresponding edge classification loss function and domain classification loss function are obtained. It can be understood that, let f... z (·;θ z ) represents the edge classifier, θ z These are all the learnable parameters of the edge classifier. The edge classifier is constructed using a multilayer perceptron (MLP). The constructed edge features are input into the edge classifier, and the output is the predicted probability that each edge belongs to the same-favorite edge, as shown in the following formula:
[0120]
[0121] in, It is an edge (v) i ,v j ) represents the predicted probability of the same-favorite edge.
[0122] Then, based on the predicted probability of each edge in the source network and the true label of each edge in the source network, the edge classification loss function is calculated. The specific formula is as follows:
[0123]
[0124] in, It is an edge (v) i ,v j ) the real label, Represents an edge (v) i ,v j ) is the same as the side of the same preference. Represents an edge (v) i ,v j () represents heterophilic edges. By simultaneously minimizing L n and L e DGASN can train node classifiers and edge classifiers in one go, thereby learning node features with label discrimination, and then obtaining edge features with homophilic and heterophilic edge discrimination.
[0125] Let f d (·;θ d ) represents the domain discriminator, θ d These are the learnable parameters of the domain discriminator. The domain discriminator is composed of a multilayer perceptron (MLP). The constructed edge features are input into the edge classifier, and the output is the predicted domain probability of each edge belonging to the target network, as shown in the following formula:
[0126]
[0127] in, It is an edge (v) i ,v j This refers to the probability of the prediction domain belonging to the target network. It should be noted that the domain prediction results include both the source network and the target network.
[0128] Then, based on the predicted domain probabilities and true domain labels of all edges in the source and target networks, the domain classification loss function is calculated, as shown in the following formula:
[0129]
[0130] in Represents an edge (v) i ,v j (From the target network) Represents an edge (v) i ,v j ) from the source network, |εs | represents the number of edges in the source network, |ε t | represents the number of edges in the target network. f d (·;θ d ) will be with the graph encoder f h (·;θ h (Confrontational training) Make the domain discriminator f d (·;θ d Try to distinguish whether an edge comes from the source network or the target network. This allows the graph encoder to learn edge features that are indistinguishable from the network, thus deceiving the domain discriminator. Once the adversarial training between the domain discriminator and the graph encoder reaches equilibrium, DGASN can learn edge features that are invariant to the network.
[0131] Step S26: Determine the overall loss function based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, and determine whether the overall loss function satisfies the preset condition of descent and convergence.
[0132] In this embodiment, the overall loss function is determined based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula. It is then determined whether the overall loss function satisfies the preset condition of decreasing and converging. The overall loss function calculation formula is Equation 14. It can be understood that the supervised attention loss obtained from Equation 6... The node classification loss obtained from Formula 8 The edge classification loss obtained from Formula 11 and the domain classification loss obtained from Formula 13 Input the formula for calculating the overall loss function to perform the calculation. The specific formula for calculating the overall loss function is as follows:
[0133]
[0134] Where η, ξ, λ represent the weights corresponding to different losses.
[0135] In one specific embodiment, for example, a citation network is used as a practical application scenario to conduct experimental verification on the classification problem of cross-network homophile edges and heterophile edges. The citation network dataset used is shown in Table 1 below:
[0136] Table 1
[0137]
[0138]
[0139] In this context, a self-adjacent edge refers to an edge connecting a node to itself. Six sets of cross-network homophile and heterophile edge classification tasks were performed using three citation network datasets: Citationv1, DBLPv7, and ACMv9. Specifically: 1) Citationv1 as the source network, DBLPv7 as the target network; 2) DBLPv7 as the source network, Citationv1 as the target network; 3) Citationv1 as the source network, ACMv9 as the target network; 4) ACMv9 as the source network, Citationv1 as the target network; 5) DBLPv7 as the source network, ACMv9 as the target network; 6) ACMv9 as the source network, DBLPv7 as the target network. In the Citationv1, DBLPv7, and ACMv9 citation networks, each node represents a paper, and each edge represents the citation relationship between two papers. Each node has an attribute vector, whose attributes are keywords extracted from the paper titles. Each node also has a category label representing the research field to which the paper belongs. In the source network, each node has a known category label, meaning each paper has a known research field. However, in the target network, each node has no category label, meaning the research field of each paper is unknown. The DGASN algorithm proposed in this application can transfer knowledge learned from the source citation network to predict whether two citation-related papers in the target citation network belong to the same research field.
[0140] The proposed DGASN model was compared extensively with 10 state-of-the-art algorithms on the aforementioned 6 sets of cross-network same-favorite and dissimilar-favorite edge classification tasks. The experimental results show that the DGASN model achieves the highest accuracy among the 11 algorithms, as shown in Table 2 below:
[0141] Table 2
[0142]
[0143]
[0144] Where A represents the dataset ACMv9, C represents Citationv1, and D represents DBLPv7. A→C means the source network is ACMv9 and the target network is Citationv1, and so on. The numbers in parentheses represent the variance. The edge feature construction method used in the above experiment is the concatenate edge feature construction method.
[0145] Step S27: If the overall loss function satisfies the preset condition of decreasing and converging, then obtain the adjusted cross-network edge classification model corresponding to the current set of learnable parameters at the time of convergence, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edges.
[0146] For details regarding step S27, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0147] As can be seen, this embodiment of the application obtains all node features by inputting the information set corresponding to the network into a cross-network edge classification model; determining the current processing layer corresponding to the current source network node features, and learning the current source network attention edge weights based on the current source network node features; calculating the supervised attention loss function based on the current source network attention edge weights, the first true label information, preset parameters, and a preset supervised attention loss function formula; summing the supervised attention loss functions output by each processing layer in the graph encoder to obtain the total supervised attention loss function; calculating the node classification loss function based on the source network node features and a preset node classification loss function formula; and constructing a corresponding [model / system] based on all node features. The system calculates edge features and obtains corresponding edge classification loss functions and domain classification loss functions based on these features, a preset edge classification loss function formula, and a preset domain classification loss function formula. It then determines the overall loss function based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, and judges whether the overall loss function satisfies the preset condition of descent and convergence. If the overall loss function satisfies the preset condition of descent and convergence, it obtains the adjusted cross-network edge classification model corresponding to the current learnable parameter set at convergence, so as to use the adjusted cross-network edge classification model to perform preset classification operations on network edges, thereby improving the accuracy of target network edge classification.
[0148] See Figure 6 As shown, this application also discloses a cross-network edge classification device, including:
[0149] The node feature acquisition module 11 is used to input the information set corresponding to the network into the cross-network edge classification model to obtain all node features; the all node features include source network node features and target network node features;
[0150] The first loss function calculation module 12 is used to calculate the node classification loss function based on the source network node features and the preset node classification loss function formula.
[0151] The second loss function calculation module 13 is used to learn the source network attention edge weights based on the source network node features, and to calculate the supervised attention loss function based on the source network attention edge weights and the preset supervised attention loss function formula.
[0152] The third loss function calculation module 14 is used to construct corresponding edge features based on all node features, and to obtain the corresponding edge classification loss function and domain classification loss function based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula.
[0153] The overall loss function calculation module 15 is used to determine the overall loss function based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function and the overall loss function calculation formula, and to determine whether the overall loss function satisfies the preset conditions of descent and convergence.
[0154] The model acquisition module 16 is used to acquire the adjusted cross-network edge classification model corresponding to the current set of learnable parameters at the time of convergence if the overall loss function satisfies the preset condition of decreasing and converging, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edge.
[0155] As can be seen, this application includes: inputting the information set corresponding to the network into a cross-network edge classification model to obtain all node features; the all node features include source network node features and target network node features; calculating a node classification loss function based on the source network node features and a preset node classification loss function formula; learning source network attention edge weights based on the source network node features, and calculating a supervised attention loss function based on the source network attention edge weights and a preset supervised attention loss function formula; constructing corresponding edge features based on the all node features, and obtaining corresponding edge classification loss functions and domain classification loss functions based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula; determining the overall loss function based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, and determining whether the overall loss function satisfies the preset condition of descent and convergence; if the overall loss function satisfies the preset condition of descent and convergence, then obtaining the adjusted cross-network edge classification model corresponding to the current learnable parameter set at the time of convergence, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edges. Therefore, this application utilizes multiple loss function values to adjust the current learnable parameters of the model, learns edge features with class discrimination and network invariance, learns more meaningful edge features through multiple loss function values, and determines the final parameters when the final function value meets the preset conditions, so as to obtain an adjusted cross-network edge classification model and improve the accuracy of target network edge classification.
[0156] In some specific embodiments, the node feature acquisition module 11 specifically includes:
[0157] The information acquisition unit is used to acquire a first information set corresponding to the source network and a second information set corresponding to the target network; both the first information set and the second information set contain the node attributes and adjacency matrix of the corresponding nodes in the network; the first information set contains the actual label information of the nodes;
[0158] An information set determination unit is configured to determine the first information set and the second information set as the information set;
[0159] The first current processing layer determination unit is used to determine the first processing layer of the graph encoder of the cross-network edge classification model as the current processing layer.
[0160] The first node feature calculation unit is used to input the information set into the current processing layer so as to calculate the first node feature based on the information set, the preset function, the first attention edge weight and the preset node feature calculation formula.
[0161] The current processing layer determination unit is used to determine whether the current processing layer is the last layer of the graph encoder;
[0162] The second current processing layer determination unit is used to determine the next processing layer of the first processing layer as the current processing layer if the current processing layer is not the last layer of the graph encoder.
[0163] The second node feature calculation unit is used to input the first node feature into the current processing layer so as to calculate the second node feature based on the first node feature, the adjacency matrix corresponding to the current processing layer, the second attention edge weight and the preset node feature calculation formula, and re-enter the step of determining whether the current processing layer is the last layer of the graph encoder.
[0164] The all node feature determination unit is used to determine the node features output by the current processing layer as the all node features if the current processing layer is the last layer of the graph encoder; wherein the all node features include source network node features and target network node features.
[0165] In some specific embodiments, the first loss function calculation module 12 specifically includes:
[0166] The unit for obtaining all predicted label probability vectors is used to input all node features into the node classifier of the cross-network edge classification model, so as to obtain all predicted label probability vectors based on a preset first learnable parameter and a first preset prediction probability formula; the all predicted label probability vectors include the source network predicted label probability vector and the target network predicted label probability vector.
[0167] The node classification loss function calculation unit is used to calculate the node classification loss function based on the source network predicted label probability vector, the third real label information, and the preset node classification loss function formula.
[0168] In some specific embodiments, the second loss function calculation module 13 specifically includes:
[0169] The third current processing layer determination unit is used to determine the current processing layer corresponding to the current source network node features;
[0170] The current source network attention edge weight learning unit is used to learn the current source network attention edge weights based on the current source network node features.
[0171] The supervised attention loss function calculation unit is used to calculate the supervised attention loss function based on the current source network attention edge weights, the first real label information, preset parameters, and a preset supervised attention loss function formula.
[0172] The overall supervised attention loss function calculation unit is used to sum the supervised attention loss functions output by each processing layer in the graph encoder to obtain the overall supervised attention loss function.
[0173] In some specific embodiments, the third loss function calculation module 14 specifically includes:
[0174] An edge feature construction unit is used to construct corresponding edge features based on all the node features;
[0175] The current edge feature acquisition unit is used to acquire the edge features corresponding to the source network and the target network to obtain the current edge features;
[0176] The source network edge type prediction probability calculation unit is used to input the current source network edge features into the edge classifier of the cross-network edge classification model, so as to calculate the source network edge type prediction probability based on the current source network edge features, the second learnable parameter and the second preset prediction probability formula; the source network edge type prediction probability is the prediction probability that the edge corresponding to the current source network edge features is a homozygous edge.
[0177] The edge classification loss function calculation unit is used to calculate the edge classification loss function based on the predicted probability of the source network edge type, the first real label information, and the preset edge classification loss function formula.
[0178] An edge feature acquisition unit is used to acquire the current source network edge feature and the current target network edge feature from the current edge features;
[0179] The domain prediction probability calculation unit is used to input the current source network edge features and the current target network edge features into the domain discriminator of the cross-network edge classification model, so as to calculate the domain prediction probability based on the current source network edge features, the current target network edge features, the third learnable parameter and the third preset prediction probability formula; the domain prediction probability includes the source network domain prediction probability and the target network domain prediction probability.
[0180] The domain classification loss function calculation unit is used to calculate the domain classification loss function based on the source network domain prediction probability, the target network domain prediction probability, the second true label information, and the preset domain classification loss function formula.
[0181] In some specific embodiments, the overall loss function calculation module 15 specifically includes:
[0182] The overall loss function calculation unit is used to determine the overall loss function based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula;
[0183] The overall loss function judgment unit is used to determine whether the overall loss function satisfies the preset conditions of decreasing and converging.
[0184] In some specific embodiments, the model acquisition module 16 specifically includes:
[0185] The adjusted cross-network edge classification model acquisition unit is used to acquire the adjusted cross-network edge classification model corresponding to the current learnable parameter set at the time of convergence if the overall loss function satisfies the preset condition of decreasing and converging.
[0186] The edge classification unit is used to perform a preset classification operation on network edges using the adjusted cross-network edge classification model.
[0187] Furthermore, embodiments of this application also provide an electronic device. Figure 7 The diagram of an electronic device 20 shown in an exemplary embodiment is not intended to limit the scope of this application.
[0188] Figure 7This application provides a schematic diagram of the structure of an electronic device 20. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the cross-network edge classification method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0189] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0190] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0191] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the cross-network edge classification method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0192] Furthermore, this application also discloses a storage medium storing a computer program, which, when loaded and executed by a processor, implements the cross-network edge classification method steps disclosed in any of the foregoing embodiments.
[0193] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0194] Finally, it should 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.
[0195] The present invention provides a detailed description of a cross-network edge classification method, apparatus, device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A cross-network edge classification method applied to citation networks, characterized in that, include: Input the information set corresponding to the citation network into the cross-network edge classification model to obtain the features of all nodes; The total node features include source citation network node features and target citation network node features; wherein, in the citation network, each node represents a paper, and each edge represents the citation relationship between two papers; each node has an attribute vector, and the corresponding attribute is a keyword extracted from the paper title; each node has a category label, representing the research field to which the corresponding paper belongs; furthermore, in the source citation network, each node and edge has a known category label, and the category label of the edge in the source citation network is either a homophile edge or a heterophile edge; in the target citation network, each node and edge has no category label; The node classification loss function is calculated based on the source citation network node features and the preset node classification loss function formula. The source citation network attention edge weights are learned based on the source citation network node features, and the supervised attention loss function is calculated based on the source citation network attention edge weights and a preset supervised attention loss function formula. Construct corresponding edge features based on all node features, and obtain corresponding edge classification loss functions and domain classification loss functions based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula. The overall loss function is determined based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, and it is determined whether the overall loss function satisfies the preset condition of descent and convergence. If the overall loss function satisfies the preset condition of decreasing and converging, then the adjusted cross-network edge classification model corresponding to the current set of learnable parameters at the time of convergence is obtained, so as to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edge, so as to predict whether two papers with citation relationship in the target citation network belong to the same research field. The step of learning source citation network attention edge weights based on the source citation network node features and calculating the supervised attention loss function based on the source citation network attention edge weights and a preset supervised attention loss function formula includes: determining the current processing layer corresponding to the current source citation network node features, and learning the current source citation network attention edge weights based on the current source citation network node features; calculating the supervised attention loss function based on the current source citation network attention edge weights, the first true label information, preset parameters, and a preset supervised attention loss function formula; and summing the supervised attention loss functions output by each processing layer in the graph encoder to obtain the total supervised attention loss function. The supervised attention loss function output by the processing layer is: ; Wherein, γ is the preset parameter. The number of edges in the source network. The unnormalized front edge obtained based on the objective formula In the The attention edge weights learned by layer GAT The first real label information is an edge The true label, express For the same taste, express For those with heterophilic tastes, It is the sigmoid activation function; Furthermore, the target formula is: ; Where LeakyReLU is a non-linear activation function. This represents a splicing operation. This represents the transpose operation. For the first Learnable weight vectors of layer GAT; For the first Nodes learned by layer GAT eigenvectors, It is the first The learnable weight matrix corresponding to the layer GAT.
2. The cross-network edge classification method applied to citation networks according to claim 1, characterized in that, The step of inputting the information set corresponding to the citation network into the cross-network edge classification model to obtain all node features includes: Obtain a first information set corresponding to the source citation network and a second information set corresponding to the target citation network; both the first information set and the second information set contain the node attributes and adjacency matrix of the corresponding nodes in the network; the first information set contains the actual label information of the nodes; The first information set and the second information set are defined as the information set; The first processing layer of the graph encoder of the cross-network edge classification model is determined as the current processing layer; The information set is input into the current processing layer so that the first node feature is calculated based on the information set, the preset function, the first attention edge weight, and the preset node feature calculation formula. Determine whether the current processing layer is the last layer of the graph encoder; If the current processing layer is not the last layer of the graph encoder, then the next processing layer after the first processing layer is determined as the current processing layer; The first node feature is input to the current processing layer so that the second node feature is calculated based on the first node feature, the adjacency matrix corresponding to the current processing layer, the second attention edge weight, and the preset node feature calculation formula, and then the step of determining whether the current processing layer is the last layer of the graph encoder is re-entered. If the current processing layer is the last layer of the graph encoder, then the node features output by the current processing layer are determined as all node features.
3. The cross-network edge classification method applied to citation networks according to claim 2, characterized in that, The process of obtaining the corresponding edge classification loss function and domain classification loss function based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula includes: Obtain the edge features corresponding to the source citation network and the target citation network to obtain the current edge features; The current source citation network edge features in the current edge features are input into the edge classifier of the cross-network edge classification model so as to calculate the edge classification loss function based on the current source citation network edge features and the preset edge classification loss function formula; The current edge features are input into the domain discriminator of the cross-network edge classification model so that the domain classification loss function can be calculated based on the current edge features and the preset domain classification loss function formula.
4. The cross-network edge classification method applied to citation networks according to claim 3, characterized in that, The step of inputting the current source citation network edge features from the current edge features into the edge classifier of the cross-network edge classification model, so as to calculate the edge classification loss function based on the current source citation network edge features and the preset edge classification loss function formula, includes: The current source citation network edge features are input into the edge classifier of the cross-network edge classification model, so as to calculate the source citation network edge type prediction probability based on the current source citation network edge features, the second learnable parameter, and the second preset prediction probability formula; the source citation network edge type prediction probability is the prediction probability that the edge corresponding to the current source citation network edge features is a homozygous edge. The edge classification loss function is calculated based on the predicted probability of the edge type in the source citation network, the first true label information, and the preset edge classification loss function formula.
5. The cross-network edge classification method applied to citation networks according to claim 4, characterized in that, The step of inputting the current edge features into the domain discriminator of the cross-network edge classification model, so as to calculate the domain classification loss function based on the current edge features and the preset domain classification loss function formula, includes: Obtain the current source citation network edge features and the current target citation network edge features from the current edge features; The current source citation network edge features and the current target citation network edge features are input into the domain discriminator of the cross-network edge classification model, so as to calculate the domain prediction probability based on the current source citation network edge features, the current target citation network edge features, the third learnable parameter, and the third preset prediction probability formula; the domain prediction probability includes the source citation network domain prediction probability and the target citation network domain prediction probability. The domain classification loss function is calculated based on the source citation network domain prediction probability, the target citation network domain prediction probability, the second true label information, and the preset domain classification loss function formula.
6. The cross-network edge classification method applied to citation networks according to any one of claims 1 to 5, characterized in that, The step of calculating the node classification loss function based on the source citation network node features and a preset node classification loss function formula includes: All node features are input into the node classifier of the cross-network edge classification model to obtain all predicted label probability vectors based on a preset first learnable parameter and a first preset prediction probability formula; the all predicted label probability vectors include the source citation network predicted label probability vector and the target citation network predicted label probability vector. The node classification loss function is calculated based on the predicted label probability vector of the source citation network, the third true label information, and the preset node classification loss function formula.
7. A cross-network edge classification device applied to citation networks, characterized in that, include: The node feature acquisition module is used to input the information set corresponding to the citation network into the cross-network edge classification model to obtain all node features; The total node features include source citation network node features and target citation network node features; wherein, in the citation network, each node represents a paper, and each edge represents the citation relationship between two papers; each node has an attribute vector, and the corresponding attribute is a keyword extracted from the paper title; each node has a category label, representing the research field to which the corresponding paper belongs; furthermore, in the source citation network, each node and edge has a known category label, and the category label of the edge in the source citation network is either a homophile edge or a heterophile edge; in the target citation network, each node and edge has no category label; The first loss function calculation module is used to calculate the node classification loss function based on the source citation network node features and the preset node classification loss function formula. The second loss function calculation module is used to learn the source citation network attention edge weights based on the source citation network node features, and to calculate the supervised attention loss function based on the source citation network attention edge weights and a preset supervised attention loss function formula. The third loss function calculation module is used to construct corresponding edge features based on all node features, and to obtain the corresponding edge classification loss function and domain classification loss function based on the edge features, the preset edge classification loss function formula, and the preset domain classification loss function formula. The overall loss function calculation module is used to determine the overall loss function based on the node classification loss function, the supervised attention loss function, the edge classification loss function, the domain classification loss function, and the overall loss function calculation formula, and to determine whether the overall loss function satisfies the preset conditions of descent and convergence. The model acquisition module is used to acquire the adjusted cross-network edge classification model corresponding to the current set of learnable parameters at the time of convergence if the overall loss function satisfies the preset condition of decreasing and converging. In order to use the adjusted cross-network edge classification model to perform a preset classification operation on the network edge, so as to predict whether two papers with citation relationship in the target citation network belong to the same research field. Specifically, the second loss function calculation module is used to: determine the current processing layer corresponding to the current source citation network node features, and learn the current source citation network attention edge weights based on the current source citation network node features; calculate the supervised attention loss function based on the current source citation network attention edge weights, the first true label information, preset parameters, and a preset supervised attention loss function formula; and sum the supervised attention loss functions output by each processing layer in the graph encoder to obtain the total supervised attention loss function. The supervised attention loss function output by the processing layer is: ; Wherein, γ is the preset parameter. The number of edges in the source network. The unnormalized front edge obtained based on the objective formula In the The attention edge weights learned by layer GAT The first real label information is an edge The true label, express For the same taste, express For those with heterophilic tastes, It is the sigmoid activation function; Furthermore, the target formula is: ; Where LeakyReLU is a non-linear activation function. This represents a splicing operation. This represents the transpose operation. For the first Learnable weight vectors of layer GAT; For the first Nodes learned by layer GAT eigenvectors, It is the first The learnable weight matrix corresponding to the layer GAT.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the cross-network edge classification method applied to a citation network as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein, when the computer program is executed by a processor, it implements the cross-network edge classification method applied to a citation network as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Visual emotion recognition method fusing self-supervised learning and attention mechanism
CN114626454A
Social network node classification method and system based on multi-channel graph convolutional network
CN114757271A