Graph structure data feature extraction method and device based on common neighbor perception

Through the graph structure data feature extraction method based on common neighbor perception, the problem of low node feature extraction accuracy in the prior art is solved, high-precision structural feature and node feature extraction are realized, and the representation ability of graph neural network is enhanced.

CN119397242APending Publication Date: 2025-02-07CHONGQING ENSHOWING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411557090.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the prior art, the node feature extraction accuracy is low, making it difficult to effectively integrate graph structure features and node features, resulting in insufficient ability of graph neural networks to characterize graph data.

Method used

A graph structure data feature extraction method based on common neighbor perception is proposed. By collecting network data, building a symmetric adjacency matrix, normalizing processing, obtaining node and graph structure features, calculating node attention scores, updating node feature representations, and using multiple uses The layer perceptron learns the node structure characteristics and iteratively optimizes through the likelihood loss function to output the graph structure data characteristics.

Benefits of technology

By effectively extracting the data features of graph structures, the accuracy and depth of node feature extraction are improved, the graph neural network's ability to characterize graph data is enhanced, and downstream tasks such as node classification are supported.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119397242A_ABST
    Figure CN119397242A_ABST
Patent Text Reader

Abstract

The invention provides a graph structure data feature extraction method and device based on common neighbor awareness, and the method comprises the steps: converting network data into network graph data, carrying out the coding of the network graph data, and obtaining a symmetric adjacent matrix which comprises an adjacent matrix and a feature matrix; normalizing the symmetric adjacent matrix; obtaining node structure features and graph structure features based on the normalized symmetric adjacent matrix, and calculating an attention score of the node by using graph joint attention based on the node structure features and the graph structure features; obtaining the feature representation of the updated node; based on the normalized symmetric adjacent matrix, the updated feature representation of the node and the attention score of the node, learning node structure features by using a multi-layer perceptron; iteratively optimizing the attention score of the node by using a likelihood loss function; judging whether the loss value of the likelihood loss function is converged or not or whether the number of iterations reaches an upper line or not; therefore, the accuracy of feature extraction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of feature extraction technology, and in particular to a method and device for extracting features from graph structure data based on common neighbor perception. Background Art

[0002] Graph neural network is an important research hotspot in computer science and engineering, and is also one of the frontier topics in machine learning and artificial intelligence. It combines knowledge from multiple fields such as graph theory, deep learning, and signal processing, and is mainly used to process and analyze graph structured data. With the emergence of large-scale graph data in fields such as social networks, bioinformatics, and transportation networks, graph neural networks have shown excellent performance and potential in these applications. Graph neural networks include several research and application problems, such as prediction or classification problems, among which the most important type of problem is node classification. Graph neural networks learn low-dimensional representations of nodes or graphs by iteratively aggregating features of neighbors using nonlinear transformations. Therefore, graph neural networks can be used to extract features from a specified graph data set to reveal the potential laws and meanings contained in the graph data. This is a major technology for achieving node classification.

[0003] In graph data, each node and edge can have a feature vector, such as the attributes of the node or the weight of the edge. Graph structure data is widely used in practical applications, such as user relationships in social networks, atoms and chemical bonds in molecular structures, intersections and roads in traffic networks, etc. Downstream tasks can be divided into node-level, edge-level and graph-level, which can be summarized as node classification, link prediction, graph classification, etc. Graph neural networks update node representations by aggregating feature information of nodes and their neighbors, thereby capturing complex relationships in graph structures. The core idea is to iteratively perform graph convolution operations, where each layer propagates the features of the node to its neighbors and performs nonlinear transformations, and finally obtains a high-level representation of each node. The main existing graph neural network models include graph convolution networks and graph attention networks. Graph convolution networks aggregate information of neighbor nodes through graph convolution operations, while graph attention networks assign weights to different neighbor nodes through attention mechanisms, thereby aggregating information more flexibly. At the same time, graph structural features describe the overall topological structure and connection pattern of the entire graph. These features are often used to understand the global properties and behaviors of graphs, including but not limited to node degree, clustering coefficient, etc. Graph node features describe the properties and characteristics of a single node in the graph. These features are usually used for tasks such as node classification and node regression, including but not limited to node labels, node attributes, etc.

[0004] The effective fusion of two different types of graph features can significantly improve the graph neural network model's ability to represent target graph data. In the era of data explosion, due to the dynamic and heterogeneous characteristics of massive graph data, high-precision structural feature and node feature extraction for complex graph data is a key technical problem that needs to be solved in the field of graph neural networks. Summary of the invention

[0005] The present invention aims to at least solve the technical problem of low accuracy in node feature extraction in the prior art, and in particular innovatively proposes a method and device for extracting features from graph structure data based on common neighbor perception.

[0006] In order to achieve the above-mentioned object of the present invention, the present invention provides a method for extracting features of graph structure data based on common neighbor perception, the method comprising:

[0007] S1. Collect network data, convert the network data into network graph data, and encode the network graph data to obtain a symmetric adjacency matrix, wherein the symmetric adjacency matrix includes an adjacency matrix and a characteristic matrix;

[0008] S2, normalizing the symmetric adjacency matrix;

[0009] S3. Obtaining node structure features and graph structure features based on the normalized symmetric adjacency matrix, and calculating the attention score of the node using graph joint attention based on the node structure features and graph structure features;

[0010] S4, updating the node based on the attention score of the node in combination with neighboring nodes, and obtaining a feature representation of the updated node;

[0011] S5. Based on the normalized symmetric adjacency matrix, the updated feature representation of the node and the attention score of the node, a multilayer perceptron is used to learn the node structure features;

[0012] S6. Iteratively optimize the attention score of the node using a likelihood loss function;

[0013] S7, judging whether the loss value of the likelihood loss function converges or whether the number of iteration rounds reaches an upper limit;

[0014] If so, output the graph structure data features;

[0015] If not, the loss value is iteratively optimized using a negative log-likelihood loss function.

[0016] As an optional embodiment of the present invention, optionally, the expression for obtaining the graph structure feature in step S3 is:

[0017]

[0018] H struct =diag(h struct )

[0019] in, represents the structural eigenvalues ​​of the neighbors of node y, represents the feature generator, represents the yth row of the normalized symmetric adjacency matrix, f node () represents the node MLP, x represents the neighbors of node y, N(y) represents the set of directly connected neighbors of node y, and f edge () represents edge MLP, represents the yth row and xth column of the normalized symmetric adjacency matrix, H struct Represents the diagonal structure characteristic matrix, diag() represents diagonalization, h struct Represents the structural feature vector.

[0020] As an optional embodiment of the present invention, optionally, in step S3, the graph structure feature is formed by aggregating the node structure features and overlapping neighbor node structure features.

[0021] As an optional embodiment of the present invention, optionally, the expression for constructing the graph structure feature is:

[0022]

[0023]

[0024] Among them, Z represents the node representation matrix, represents the adjacency matrix, H struct represents the diagonal structural characteristic matrix, G θ represents a multilayer perceptron, L represents a total of L layers, l represents the lth layer, ξ l-1 represents the hyperparameters controlling the weights of the nearest and distant neighbors, A l represents the lth power of the adjacency matrix, H struct Represents the diagonal structured characteristic matrix.

[0025] As an optional embodiment of the present invention, optionally, calculating the attention score of the node in step S3 includes:

[0026] S301, using the combined attention layer to calculate the attention score of the node;

[0027] S302: The attention score based on the correlation between nodes uses the learning parameters to evaluate the correlation between the node structure features and the graph structure.

[0028] As an optional embodiment of the present invention, optionally, the expression for calculating the attention score of the node is:

[0029]

[0030]

[0031]

[0032]

[0033]

[0034]

[0035] Among them, C ij The representation structural feature scores of nodes i and j, represents the transpose of the vector in the Z matrix, z j represents the vector in the Z matrix, n ij represents the structural coefficient, softmax() represents the activation function, exp() represents the exponential function, k represents a directly connected neighbor of node i, Ni(i) represents the set of directly connected neighbors of node i, C ik represents the structural feature score of node i and node k, m ij represents the attention coefficient, LeakyReLU() represents the nonlinear activation function, represents the weight vector, W represents the weight matrix, and h i represents the node feature of node i, ( / / ) represents splicing, h j represents the node feature of node j, h k represents the node feature of node k, p m ,q n represents the normalized structural importance, g m , g n represents the learnable parameter, α ij represents the joint attention score, m ik represents the node feature attention score, n ik represents the node structure attention score, h i ′ represents the node feature of node i after update, α ii represents the attention score of node i itself, and ε represents the hyperparameter for improving the expressiveness of the model.

[0036] As an optional embodiment of the present invention, optionally, the expression of the likelihood loss function in step S6 is:

[0037] L=L predict +λ||Θ|| 2

[0038] Among them, L represents the loss value, Lpredict represents the downstream task loss of node classification, λ represents the regularization coefficient, and |||| 2 represents L2 regularization, and Θ represents the learnable weight parameter.

[0039] In another aspect, the present invention further provides a graph structure data feature extraction device based on common neighbor perception, the device comprising a graph structure data feature extraction method based on common neighbor perception;

[0040] The device also includes:

[0041] A graph preprocessing module, used for converting the network data into network graph data, encoding the network graph data, obtaining a symmetric adjacency matrix, and normalizing the symmetric adjacency matrix;

[0042] A feature extraction module connected to the graph preprocessing module, configured to obtain node structure features and graph structure features based on the normalized symmetric adjacency matrix, calculate the attention score of the node using graph joint attention based on the node structure features and graph structure features; update the node based on the attention score of the node in combination with neighboring nodes to obtain a feature representation of the updated node;

[0043] A common neighbor perception module, connected to the feature extraction module, for learning node structural features using a multi-layer perceptron based on the normalized symmetric adjacency matrix, the updated feature representation of the node, and the attention score of the node;

[0044] A graph training module is connected to the feature extraction module and is used to iteratively optimize the attention scores of the nodes using a likelihood loss function.

[0045] As another optional embodiment of the present invention, optionally, the feature extraction module includes:

[0046] A node feature unit is used to obtain node structure features in network graph data;

[0047] A structural feature unit, used to obtain graph structural features in network graph data;

[0048] A graph joint attention unit is used to calculate the attention score of the node using graph joint attention based on the node structure features and graph structure features.

[0049] As another optional embodiment of the present invention, optionally, the graph training module includes:

[0050] An initialization unit, used to initialize parameters related to extracting node structural features;

[0051] A training unit, iteratively optimizing the attention score of the node using a likelihood loss function;

[0052] Output unit, used to output node structure features.

[0053] The beneficial effect of the present invention is that the present invention realizes effective feature extraction of network data by constructing an expression of graph structure features and calculating the attention scores of nodes. In a specific implementation, the present invention completes the feature extraction of graph structure data through a series of steps, including graph preprocessing, feature extraction, common neighbor perception and graph training. The graph preprocessing module is responsible for converting network data into network graph data, and performing encoding and normalization processing. The feature extraction module obtains node structure features and graph structure features based on the normalized symmetric adjacency matrix, and calculates the attention scores of nodes using graph joint attention. The common neighbor perception module uses a multi-layer perceptron to learn node structure features, while the graph training module iteratively optimizes the attention scores of nodes through a likelihood loss function to improve the accuracy of feature extraction. Through these steps, the present invention can effectively extract the features of graph structure data and provide strong support for downstream tasks such as node classification.

[0054] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0056] Figure 1 It is a flowchart of a method for extracting features of graph structure data based on common neighbor perception according to Embodiment 1 of the present invention.

[0057] Figure 2 It is a flow chart of graph structure data feature extraction according to embodiment 1 of the present invention.

[0058] Figure 3 It is a schematic diagram of comparing the node classification accuracy before and after applying the embodiment of the present invention in embodiment 1 of the present invention.

[0059] Figure 4 It is a structural diagram of embodiment 2 of the present invention. DETAILED DESCRIPTION

[0060] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0061] Example 1

[0062] like Figure 1 As shown, a method for extracting features from graph structure data based on common neighbor perception includes:

[0063] S1. Collect network data, convert the network data into network graph data, and encode the network graph data to obtain a symmetric adjacency matrix, wherein the symmetric adjacency matrix includes an adjacency matrix and a characteristic matrix;

[0064] It should be noted that in step S1, the collection of network data can be through a web crawler, API interface or other data acquisition methods. The conversion into network graph data involves mapping the original data into a graph structure, where nodes represent entities and edges represent the relationship between entities. The encoding adopts one-hot. The acquisition of the adjacency matrix is ​​a key step in feature extraction, which not only contains the connection information between nodes, but also contains the feature information of the nodes.

[0065] S2, normalizing the symmetric adjacency matrix;

[0066] It should be noted that feature extraction is performed on the normalized symmetric adjacency matrix to obtain the structural features of the nodes and the structural features of the graph. This step is achieved through the graph joint attention mechanism, which can effectively capture the interactions and dependencies between nodes. The graph joint attention unit uses the node structural features and graph structural features to calculate the attention score of each node. These scores reflect the importance of different neighbor nodes to the central node.

[0067] S3. Obtaining node structure features and graph structure features based on the normalized symmetric adjacency matrix, and calculating the attention score of the node using graph joint attention based on the node structure features and graph structure features;

[0068] It should be noted that in step S3, the node is updated based on the attention score of the node in combination with the neighboring nodes to obtain the feature representation of the updated node; specifically, in this step, the feature representation of each node is updated according to the features of its neighboring nodes and the calculated attention score. This means that the node will not only consider the directly connected neighbors, but also the importance of the neighboring nodes, so as to obtain a more comprehensive and accurate feature representation. This process is iterative and can be performed multiple times to ensure that the feature representation of each node fully reflects its position and role in the graph.

[0069] S4, updating the node based on the attention score of the node in combination with neighboring nodes, and obtaining a feature representation of the updated node;

[0070] It should be noted that in step S4, updating the feature representation of the node is achieved by multiplying the attention score with the features of the neighboring nodes and summing them. This process takes into account the influence of the neighboring nodes on the central node, and weights them by the attention score so that more important neighboring nodes contribute more to the feature update of the central node. In this way, each node can obtain a feature representation that integrates its neighbor information, which helps capture the complex relationship between nodes.

[0071] S5. Based on the normalized symmetric adjacency matrix, the updated feature representation of the node and the attention score of the node, a multilayer perceptron is used to learn the node structure features;

[0072] It should be noted that in step S5, the multilayer perceptron further extracts deeper feature representations by learning the structural features of the nodes. This step is crucial for understanding the intrinsic properties of the nodes and their roles in the graph. Through the nonlinear transformation of the multilayer perceptron, the model can capture the complex relationship between node features, thereby improving the depth and accuracy of feature extraction.

[0073] S6. Iteratively optimize the attention score of the node using a likelihood loss function;

[0074] It should be noted that in step S6, the negative log-likelihood loss function is a commonly used loss function that can effectively measure the difference between the probability distribution predicted by the model and the true label. By minimizing this loss function, the model can adjust the parameters so that the predicted attention score is closer to the actual situation. The iterative optimization process usually involves a gradient descent algorithm or its variants, which continuously adjusts the parameters to gradually reduce the loss value, thereby improving the performance of the model.

[0075] S7, judging whether the loss value of the likelihood loss function converges or whether the number of iteration rounds reaches an upper limit;

[0076] If so, output the graph structure data features;

[0077] If not, the loss value is iteratively optimized using a negative log-likelihood loss function.

[0078] It should be noted that in step S7, if the loss value of the loss function has converged or the number of iterations has reached the upper limit, the graph structure data features are output; otherwise, the negative log-likelihood loss function is continued to be used to iteratively optimize the loss value. During the iterative optimization process, the model will continuously adjust parameters in order to achieve better performance.

[0079] like Figure 1 and 2As shown, in summary, this embodiment of the present invention first collects network data and converts it into network graph data, and then encodes these data to obtain a symmetric adjacency matrix. This matrix not only contains the connection information between nodes, but also contains the feature information of the nodes. Next, this symmetric adjacency matrix is ​​normalized to eliminate the impact of different network sizes. The normalized matrix is ​​used to extract the structural features of the nodes and the structural features of the graph. This step is achieved through the graph joint attention mechanism, which can effectively capture the interactions and dependencies between nodes.

[0080] After feature extraction, the target node is updated based on the node's attention score and combined with neighbor nodes to obtain the feature representation of the updated node. This process takes into account the impact of neighbor nodes on the central node, and weights them by attention scores so that more important neighbor nodes contribute more to the feature update of the central node. In this way, each node can obtain a feature representation that integrates its neighbor information, which helps capture the complex relationships between nodes.

[0081] Then, a multi-layer perceptron is used to learn the node structure features and further extract deeper feature representations. This step is crucial for understanding the intrinsic properties of nodes and their roles in the graph. Through the nonlinear transformation of the multi-layer perceptron, the model is able to capture the complex relationship between node features, thereby improving the depth and accuracy of feature extraction.

[0082] Finally, the attention score of the node is iteratively optimized using the loss function. The negative log-likelihood loss function is a commonly used loss function that can effectively measure the difference between the probability distribution predicted by the model and the true label. By minimizing this loss function, the model can adjust the parameters so that the predicted attention score is closer to the actual situation. The iterative optimization process usually involves the gradient descent algorithm or its variants, which continuously adjusts the parameters to gradually reduce the loss value, thereby improving the performance of the model.

[0083] As an optional embodiment of the present invention, optionally, the expression for obtaining the graph structure feature in step S3 is:

[0084]

[0085] H struct =diag(h struct )

[0086] in, Represents the structural eigenvalues ​​of the neighbors of node y;

[0087] represents a feature generator;

[0088] represents the y-th row of the normalized symmetric adjacency matrix;

[0089] f node () represents node MLP;

[0090] x represents the neighbors of node y;

[0091] N(y) represents the set of directly connected neighbors of node y;

[0092] f edge () indicates edge MLP;

[0093] represents the yth row and xth column of the normalized symmetric adjacency matrix;

[0094] H struct represents the diagonal structural characteristic matrix;

[0095] diag() means diagonalization;

[0096] h struct Represents the structural feature vector.

[0097] It should be noted that in order to fully capture the available information in the structural features and reduce the potential interference caused by the graph structure, this embodiment adopts two multi-layer perceptrons (MLP), f node and f edge Compositional structural feature generator To model these features, they use the unique normalized adjacency matrix in the graph Generate structural features for each node.

[0098] As an optional embodiment of the present invention, optionally, in step S3, the graph structure feature is formed by aggregating the node structure features and overlapping neighbor node structure features.

[0099] It should be noted that the extraction of graph structural features is achieved by aggregating the structural features of overlapping neighbor nodes. This aggregation method can capture the complex interactions between nodes, thereby enhancing the model's understanding of the graph data structure. In this way, each node can not only obtain information about its direct neighbors, but also indirectly obtain information about its neighbors' neighbors, which helps the model better understand the topological structure of the entire network.

[0100] In practical applications, this feature extraction method can be effectively applied to various graph data, including but not limited to social networks, bioinformatics networks, traffic networks, etc. For example, in social networks, the method of this embodiment can be used to identify influential key users or predict potential connections between users. In the field of bioinformatics, this method can be used to analyze protein interaction networks and discover new drug targets or disease-related genes. In addition, in traffic network analysis, this embodiment can help optimize traffic flow and predict traffic congestion points, thereby providing a scientific basis for urban planning and traffic management.

[0101] As an optional embodiment of the present invention, optionally, the expression for constructing the graph structure feature is:

[0102]

[0103]

[0104] Among them, Z represents the node representation matrix;

[0105] represents the adjacency matrix;

[0106] H struct represents the diagonal structural characteristic matrix;

[0107] G θ represents a multi-layer perceptron;

[0108] L means there are L layers in total;

[0109] l represents the lth layer;

[0110] ξ l-1 represents the hyperparameters that control the weights of nearest and distant neighbors;

[0111] A l represents the lth power of the adjacency matrix;

[0112] H struct Represents the diagonal structured characteristic matrix.

[0113] It should be noted that after the construction of the structural features of each node is completed, the aggregation strategy of overlapping neighbors is modeled. Considering the number of overlapping neighbors, the aggregation strategy is to multiply the normalized adjacency matrix

[0114] As an optional embodiment of the present invention, optionally, calculating the attention score of the node in step S3 includes:

[0115] S301, using the combined attention layer to calculate the attention score of the node;

[0116] It should be noted that when using the combined attention layer to calculate the attention score of the node in step S301, it is first necessary to define the parameters of the attention layer, including the attention weight and the bias term. These parameters are learned and optimized by the back propagation algorithm during the model training process. The attention layer generates attention scores by calculating the similarity between the node and its neighbor nodes. These scores reflect the importance of different neighbor nodes to the central node. The calculated attention scores will be used to weight the features of the neighbor nodes, thereby updating the feature representation of the central node.

[0117] In practical applications, this feature extraction method based on the attention mechanism can effectively capture the complex relationships between nodes and improve the model's ability to understand the graph data structure. For example, in social network analysis, the method of the present invention can identify influential key users or predict potential connections between users. In the field of bioinformatics, this method can be used to analyze protein interaction networks and discover new drug targets or disease-related genes. In addition, in traffic network analysis, the present invention can help optimize traffic flow and predict traffic congestion points, thereby providing a scientific basis for urban planning and traffic management.

[0118] S302: The attention score based on the correlation between nodes uses the learning parameters to evaluate the correlation between the node structure features and the graph structure.

[0119] It should be noted that in step S302, the attention score based on the correlation between nodes uses learning parameters to evaluate the correlation between node structure features and graph structure. In this process, the model takes into account the interactions between nodes and evaluates the correlation between them through learning parameters. This step is crucial to understanding the complex patterns in graph data because it can reveal the intrinsic connection between node features and the overall graph structure. In this way, the model can more accurately identify key nodes and important connections, which is of great significance for downstream tasks such as node classification. After completing the correlation evaluation, the parameters of the model will be fine-tuned based on the evaluation results. This step ensures that the model can better adapt to specific data sets and task requirements. Through continuous iteration and optimization, the performance of the model will be further improved, thereby showing higher accuracy and efficiency in practical applications.

[0120] As an optional embodiment of the present invention, optionally, the expression for calculating the attention score of the node is:

[0121]

[0122]

[0123]

[0124]

[0125]

[0126]

[0127] Among them, C ij The representation structural feature scores of node i and node j;

[0128] represents the transpose of the i-th row vector in the Z matrix;

[0129] z j represents the j-th row vector in the Z matrix;

[0130] n ij represents the structural coefficient;

[0131] softmax() represents the activation function;

[0132] exp() represents the exponential function;

[0133] k represents a directly connected neighbor of node i;

[0134] Ni(i) represents the set of directly connected neighbors of node i;

[0135] C ik Represents the structural feature scores of node i and node k;

[0136] m ij represents the attention coefficient;

[0137] LeakyReLU() represents a nonlinear activation function;

[0138] represents the weight vector;

[0139] W represents the weight matrix;

[0140] h i represents the node characteristics of node i;

[0141] ( / / ) indicates splicing;

[0142] h j represents the node features of node j;

[0143] h k represents the node features of node k;

[0144] p m ,q n represents the normalized structural importance;

[0145] g m , gn represents a learnable parameter;

[0146] α ij represents the joint attention score;

[0147] m ik Represents the node feature attention score;

[0148] n ik Represents the node structure attention score;

[0149] h i ′ represents the node feature of node i after update;

[0150] α ii Represents the attention score of node i itself;

[0151] ε represents a hyperparameter that improves the expressiveness of the model.

[0152] It should be noted that neighbor nodes are crucial for learning representations of target nodes. However, previous attention-based graph neural networks only focused on the node embeddings inside the neural network, ignoring the fact that the original graph structure still contains a lot of useful structural information. Therefore, we choose to use a general graph attention mechanism that can take into account structural properties such as neighbor node correlations. Specifically, adaptively combining structural features and node embeddings can result in an effective method for calculating attention coefficients. Therefore, combined attention layers are adopted, which are more sensitive to neighbors with similar embeddings in hierarchical aggregations; the attention scores of the correlations between nodes are calculated, and each combined layer can automatically obtain their relative importance. To achieve this, the combined layer introduces two learnable parameters g respectively. m and g n , to evaluate the relative importance of node features and structural correlations; where p m or q n represents the normalized structural importance, which can be back-propagated and dynamically updated. Different from the previous work on directly calculating the attention coefficient in the feature-based attention mechanism, we use the attention coefficient m ij and structural coefficient n ij Combined to get the combination coefficient α ij Therefore, α ij We propose an alternative approach to normalized weighted attention that simultaneously considers graph structure information and node features.

[0153] As an optional embodiment of the present invention, optionally, the expression of the likelihood loss function in step S6 is:

[0154] L=L predict +λ||Θ|| 2

[0155] Where L represents the loss value;

[0156] L predict represents the downstream task loss for node classification;

[0157] λ represents the regularization coefficient;

[0158] |||| 2 represents L2 regularization;

[0159] Θ represents the learnable weight parameter.

[0160] It should be noted that due to the structural correlation C ij Derived from MLP, so the weights in MLP are learnable and can be updated after the back-propagation process.

[0161] like Figure 3 As shown, Figure 3 The accuracy of common neighbor-aware graph structure data feature extraction is compared before and after applying this embodiment. Figure 3 After applying this embodiment, when performing common neighbor-aware graph structure data feature extraction and node classification, different graph data feature extractions have different extraction accuracy. The first case represents the classification result using the standard graph attention neural network (GAT), the second, third, and fourth cases represent the classification results using the heuristic method, and the fifth case represents that after applying this embodiment, the node classification results are better than other methods. From the above, it can be seen that this embodiment provides a graph structure data feature extraction method based on common neighbor perception, which specializes in high-precision structural feature and node feature extraction to solve the dynamic, heterogeneous, and complex characteristics of massive graph data.

[0162] Example 2

[0163] like Figure 4 As shown, a graph structure data feature extraction device based on common neighbor perception, the device includes a graph structure data feature extraction method based on common neighbor perception;

[0164] The device also includes:

[0165] A graph preprocessing module, used for converting the network data into network graph data, encoding the network graph data, obtaining a symmetric adjacency matrix, and normalizing the symmetric adjacency matrix;

[0166] It should be noted that conversion into network graph data means representing the network data through nodes and edges, where nodes represent entities and edges represent the relationship between nodes; the specific encoding is one-hot encoding. Normalizing the symmetric adjacency matrix in the encoded network graph data (adjacency matrix) is to ensure the standardized processing of the data for subsequent feature extraction and analysis. Normalization can reduce the scale differences between different network graph data, making model training more stable and efficient. After completing the preprocessing of the network graph data, the model will perform feature extraction, and extract vector representations that can represent the structural features of the graph by learning the complex relationships between nodes.

[0167] A feature extraction module connected to the graph preprocessing module, configured to obtain node structure features and graph structure features based on the normalized symmetric adjacency matrix, calculate the attention score of the node using graph joint attention based on the node structure features and graph structure features; update the node based on the attention score of the node in combination with neighboring nodes to obtain a feature representation of the updated node;

[0168] It should be noted that the feature extraction module is used to obtain node structural features and structural features for the calculation of graph joint attention, and the obtained node attention score is used as a standard to measure the importance of nodes to each other to achieve better neighbor aggregation and node information propagation; including node feature units, which are used to obtain the connection relationship between nodes in the graph data, the feature information of the nodes, and the label information of each node; structural feature units, which extract node structural features in complex graph data, combined with various structural interventions, such as high-order structural correlations that can be learned outside the graph neural network. The graph joint attention unit is used to combine the data of the node feature unit and the data of the structural feature unit, calculate the joint attention score, apply it to the weighted average of the features of the neighboring nodes, and then update the feature representation of the node.

[0169] A common neighbor perception module, connected to the feature extraction module, for learning node structural features using a multi-layer perceptron based on the normalized symmetric adjacency matrix, the updated feature representation of the node, and the attention score of the node;

[0170] It should be noted that in the common neighbor perception module, the model further uses a multi-layer perceptron to learn the node structure features, so as to have a deeper understanding of the interactions between nodes and the global structure of the graph. Through this module, the model can identify the complex relationship between node features and graph structure, which is crucial for downstream tasks such as node classification and link prediction. For example, in social network analysis, this module helps to identify key users and potential connections, while in the field of bioinformatics, it helps to discover new drug targets or disease-related genes.

[0171] A graph training module is connected to the feature extraction module and is used to iteratively optimize the attention scores of the nodes using a likelihood loss function.

[0172] It should be noted that the graph training module is also used to initialize graph training hyperparameters, load graph data, define optimizers, specify the optimization target as the semi-supervised node classification task, and reduce the loss function by intensive training on training units, backpropagation and optimization methods to update parameters. Finally, the validation set is used to perform model selection and hyperparameter adjustment processes to prevent overfitting.

[0173] As another optional embodiment of the present invention, optionally, the feature extraction module includes:

[0174] A node feature unit is used to obtain node structure features in network graph data;

[0175] It should be noted that the node feature unit is used to obtain the connection relationship between nodes in the graph data, the feature information of the nodes, and the label information of each node.

[0176] A structural feature unit, used to obtain graph structural features in network graph data;

[0177] It should be noted that the structural feature unit can extract graph structural features in complex network graph data, combined with various structural interventions, such as high-order structural correlations that can be learned outside of graph neural networks.

[0178] A graph joint attention unit is used to calculate the attention score of the node using graph joint attention based on the node structure features and graph structure features.

[0179] It should be noted that the graph joint attention unit is used to combine the data of the node feature unit and the data of the structural feature unit, calculate the joint attention score, apply it to the weighted average of the features of the neighboring nodes, and then update the feature representation of the node.

[0180] As another optional embodiment of the present invention, optionally, the graph training module includes:

[0181] An initialization unit, used to initialize parameters related to extracting node structural features;

[0182] It should be noted that the initialization parameters involved in the process of extracting features from graph data nodes include the initialization node feature matrix h (matrix h m,n Represents a matrix with a total of m rows and n columns, where m represents the number of nodes and n represents the feature dimension) and node labels are one-hot encoded to obtain the node label matrix l (matrix l m,b Represents a total of m rows and b columns in the matrix, where b represents the number of label types), and constructs a symmetric adjacency matrix A (matrix A m,mRepresents the data of a total of m rows and m columns in the matrix), normalize the feature matrix h and the adjacency matrix A, initialize the hidden layer dimension d, initialize the number of attention heads Head, initialize the upper limit of the number of training rounds e, the learning rate is lr, the regularization coefficient is λ, the weight decay penalty is τ, and the optimizer is opt; among them, the node feature matrix h is the input sparse matrix, and the initial value in the matrix is ​​0 or 1; the node label matrix l is a matrix of a rows and b columns established according to the number of nodes a and the number of label types b, in which only one element in each row is initialized to 1, and the rest are 0; the adjacency matrix A is a square matrix of m rows and m columns established according to the number of nodes m; the initial hidden layer dimension d is the number of nodes in each node after The dimension of the feature vector after the graph attention neural network layer; the number of initial attention heads Head is how many attention heads are used independently in each layer. Each attention head will independently calculate the attention weights between nodes and update the node features; the upper limit of the initial training rounds e is the variable that controls the upper limit of the number of iterative training times; the learning rate lr is a constant that controls the step size of the optimization training for A, h and l during graph training; the regularization coefficient λ is the regularization constant that controls the calculation of the regularization loss during graph training; the weight decay penalty is τ, which is a penalty term to limit the complexity of the model and prevent overfitting; the optimizer is opt, which minimizes the loss function by changing the weight parameters of the neural network.

[0183] A training unit, iteratively optimizing the attention score of the node using a likelihood loss function;

[0184] Output unit, used to output node structure features.

[0185] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A graph structure data feature extraction method based on common neighbor perception, characterized in that: The method comprises: S1. Collect network data, convert the network data into network graph data, and encode the network graph data to obtain a symmetric adjacency matrix, wherein the symmetric adjacency matrix includes an adjacency matrix and a characteristic matrix; S2, normalizing the symmetric adjacency matrix; S3. Obtaining node structure features and graph structure features based on the normalized symmetric adjacency matrix, and calculating the attention score of the node using graph joint attention based on the node structure features and graph structure features; S4, updating the node based on the attention score of the node in combination with neighboring nodes, and obtaining a feature representation of the updated node; S5. Based on the normalized symmetric adjacency matrix, the updated feature representation of the node and the attention score of the node, a multilayer perceptron is used to learn the node structure features; S6. Iteratively optimize the attention score of the node using a likelihood loss function; S7, judging whether the loss value of the likelihood loss function converges or whether the number of iteration rounds reaches an upper limit; If so, output the graph structure data features; If not, the loss value is iteratively optimized using a negative log-likelihood loss function.

2. A graph structure data feature extraction method based on common neighbor perception as claimed in claim 1, characterized in that: The expression for obtaining the graph structure feature in step S3 is: H struct =diag(h struct ) in, represents the structural eigenvalues ​​of the neighbors of node y, represents the feature generator, represents the yth row of the normalized symmetric adjacency matrix, f node () represents the node MLP, x represents the neighbors of node y, N(y) represents the set of directly connected neighbors of node y, and f edge () represents edge MLP, represents the yth row and xth column of the normalized symmetric adjacency matrix, H struct represents the diagonal structure characteristic matrix, diag() represents diagonalization, h struct Represents the structural feature vector.

3. A graph structure data feature extraction method based on common neighbor perception as claimed in claim 1, characterized in that: In step S3, the graph structure feature is formed by aggregating the node structure feature and the overlapping neighbor node structure feature.

4. A graph structure data feature extraction method based on common neighbor perception as claimed in claim 3, characterized in that: The expression for constructing graph structure features is: Among them, Z represents the node representation matrix, represents the adjacency matrix, H struct represents the diagonal structural characteristic matrix, G θ represents a multilayer perceptron, L represents a total of L layers, l represents the lth layer, ξ l-1 represents the hyperparameters controlling the weights of the nearest and distant neighbors, A l represents the lth power of the adjacency matrix, H struct Represents the diagonal structured characteristic matrix.

5. The method for extracting features from graph structure data based on common neighbor perception according to claim 1, characterized in that: Calculating the attention score of a node in step S3 includes: S301, using the combined attention layer to calculate the attention score of the node; S302: The attention score based on the correlation between nodes uses the learning parameters to evaluate the correlation between the node structure features and the graph structure.

6. A method for extracting features from graph structure data based on common neighbor perception as claimed in claim 5, characterized in that: The expression for calculating the attention score of a node is: Among them, C ij The representation structural feature scores of nodes i and j, represents the transpose of the vector in the Z matrix, z j represents the vector in the Z matrix, n ij represents the structural coefficient, softmax() represents the activation function, exp() represents the exponential function, k represents a directly connected neighbor of node i, Ni(i) represents the set of directly connected neighbors of node i, C ik represents the structural feature score of node i and node k, m ij represents the attention coefficient, LeakyReLU() represents the nonlinear activation function, represents the weight vector, W represents the weight matrix, and h i represents the node feature of node i, ( / / ) represents splicing, h j represents the node feature of node j, h k represents the node feature of node k, p m ,q n represents the normalized structural importance, g m , g n represents the learnable parameter, α ij represents the joint attention score, m ik represents the node feature attention score, n ik represents the node structure attention score, h i ′ represents the node feature of node i after update, α ii represents the attention score of node i itself, and ε represents the hyperparameter for improving the expressiveness of the model.

7. The method for extracting features from graph structure data based on common neighbor perception according to claim 1, characterized in that: In step S6, the expression of the likelihood loss function is: L=L predict +λ||Θ|| 2 Among them, L represents the loss value, L predict represents the downstream task loss of node classification, λ represents the regularization coefficient, || || 2 represents L2 regularization, and Θ represents the learnable weight parameter.

8. A graph structure data feature extraction device based on common neighbor perception, characterized in that: The device comprises a graph structure data feature extraction method based on common neighbor perception as described in any one of claims 1 to 7; The device also includes: A graph preprocessing module, used for converting the network data into network graph data, encoding the network graph data, obtaining a symmetric adjacency matrix, and normalizing the symmetric adjacency matrix; A feature extraction module connected to the graph preprocessing module, configured to obtain node structure features and graph structure features based on the normalized symmetric adjacency matrix, calculate the attention score of the node using graph joint attention based on the node structure features and graph structure features; update the node based on the attention score of the node in combination with neighboring nodes to obtain a feature representation of the updated node; A common neighbor perception module, connected to the feature extraction module, for learning node structural features using a multi-layer perceptron based on the normalized symmetric adjacency matrix, the updated feature representation of the node, and the attention score of the node; A graph training module is connected to the feature extraction module and is used to iteratively optimize the attention scores of the nodes using a likelihood loss function.

9. The graph structure data feature extraction device based on common neighbor perception according to claim 8, characterized in that: The feature extraction module comprises: A node feature unit is used to obtain node structure features in network graph data; A structural feature unit, used to obtain graph structural features in network graph data; A graph joint attention unit is used to calculate the attention score of the node using graph joint attention based on the node structure features and graph structure features.

10. The graph structure data feature extraction device based on common neighbor perception according to claim 8, characterized in that: The graph training module includes: An initialization unit, used to initialize parameters related to extracting node structural features; A training unit, iteratively optimizing the attention score of the node using a likelihood loss function; Output unit, used to output node structure features.