Graph anomaly detection method for enhancing effect by utilizing graph data under random configuration network
By combining the random configuration network, graph convolution network and graph attention network in graph data anomaly detection, random node embedding and data enhancement are achieved, the problem of insufficient model robustness and generalization capabilities is solved, and detection accuracy is improved and robustness, and accelerates model convergence.
Patent Information
- Application Number
- CN202411031665.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-15
AI Technical Summary
The prior art faces challenges such as complex connection patterns between nodes and high-dimensional feature representation in graph data anomaly detection, resulting in insufficient model robustness and generalization capabilities, especially lacking effective combination methods in randomly configured network applications.
A random configuration network with a serial mix of the convolutional network and the graph attention network are designed. Through random node embedding and random data enhancement, the diversity of graph data is improved, and the convergence of the model is accelerated by random initialization of weight parameters. , combine the graph convolution network and graph attention network to fully understand patterns and exceptions in graph data.
Improve the accuracy and robustness of abnormal detection of graph data nodes, enhance the generalization ability of the model, can capture key features in the data faster, improve the detection ability of unknown abnormal nodes, and accelerate the convergence of the model. speed.
Smart Images

Figure CN118968164A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet big data and graph anomaly detection, and in particular to a graph anomaly detection method that utilizes graph data enhancement effects under a randomly configured network. Background Art
[0002] Graph data is often used to represent complex relationships between different individuals. In graph data, objects are interrelated, nodes represent objects, and edges represent relationships between them. Graph node anomaly detection is to identify abnormal nodes in the graph. Node anomalies include two aspects: one is node feature anomalies, that is, node features are very different from most other node features in the graph; the other is structural anomalies. A common assumption in graph theory is that the node features of two connected nodes are similar. Structural anomalies are manifested as large differences in the features of two connected nodes.
[0003] Traditional methods face many challenges such as complex connection patterns between nodes and high-dimensional feature representation. For this reason, graph anomaly detection algorithms based on neural networks have emerged in the prior art. For example, Chinese patent publication number CN113822313A discloses "A method and device for detecting anomalies in graph nodes". This method inputs the graph to be detected into a pre-trained anomaly detection model based on a generative adversarial network, determines the anomaly value that characterizes the degree of abnormality of each node in the graph to be detected, and then determines the abnormal nodes in the graph to be detected based on the anomaly value of each node in the graph to be detected.
[0004] In the field of graph data anomaly detection, traditional methods face many challenges such as complex connection patterns between nodes and high-dimensional feature representation. In order to solve these problems, node embedding technology has gradually become a research hotspot in recent years. Node embedding technology can map the nodes in the graph into a low-dimensional continuous vector space, thereby preserving the structural information between the nodes.
[0005] However, when the method based on node embedding technology is applied to graph data anomaly detection, there are still problems with insufficient model robustness and generalization ability. The applicant found that the core idea of the random configuration network is to introduce randomness into the network. By introducing the random configuration network, the robustness and generalization ability of the model can be enhanced. The most notable feature of the random configuration network is that its input weights and hidden biases are randomly generated according to certain rules and remain unchanged throughout the training process, while the output weights are obtained through analysis. The introduction of this randomness can make the model more robust and stable to small changes in the input data, reduce the possibility of overfitting, and improve the generalization ability of the model. Therefore. How to effectively combine the random configuration network with the node embedding technology is a technical problem that needs to be solved urgently. Summary of the invention
[0006] In view of the deficiencies of the above-mentioned prior art, the technical problem to be solved by the present invention is: how to provide a graph anomaly detection method that utilizes the graph data enhancement effect under a randomly configured network, and designs an anomaly detection model that is a serial mixture of a graph convolutional network and a graph attention network under a randomly configured network. The randomly configured network is used to perform random node embedding and random data enhancement on the graph data to improve the diversity of the graph data, and the weight parameters of the graph convolutional network and the graph attention network are randomly initialized to make the network converge to a better solution faster. The graph convolutional network and the graph attention network are used in series to fully understand the patterns and anomalies in the graph data, thereby improving the accuracy of graph data node anomaly detection.
[0007] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0008] The graph anomaly detection method using graph data enhancement effect under random configuration network includes:
[0009] S1: Obtain the image data to be detected;
[0010] S2: Input the graph data to be detected into the trained anomaly detection model and output the corresponding node prediction type; the anomaly detection model is built based on random configuration network, graph convolution network and graph attention network;
[0011] The processing steps for training anomaly detection model are as follows:
[0012] S201: Obtain graph data samples used as training data and corresponding node real types;
[0013] S202: Input the graph data sample into the random configuration network, perform random node embedding and random data enhancement on the graph data sample, and generate a node enhanced embedding vector;
[0014] S203: Randomly initialize the weight parameters of the graph convolution network and the graph attention network;
[0015] S204: Inputting the node enhanced embedding vector into the graph convolution network for graph convolution processing to generate the first feature representation of the node;
[0016] S205: Input the first feature representation of the node into the graph attention network to capture the attention relationship between the nodes and generate the second feature representation of the node;
[0017] S206: Fusing the first feature representation of the node and the second feature representation of the node to generate a fused feature representation;
[0018] S207: Input the fused feature representation into a classifier for classification, and generate a corresponding node prediction type;
[0019] S208: Calculate the loss based on the predicted node type and the true node type of the corresponding graph data sample, and optimize the parameters of the classifier;
[0020] S209: Repeat steps S201 to S208 until the anomaly detection model converges or reaches a preset number of iteration rounds;
[0021] S3: Output the true type of the node as the graph anomaly detection result of the graph data to be detected.
[0022] Preferably, in step S202, the random configuration network implements random node embedding through the following steps:
[0023] S2021: Randomly initialize the graph data to generate an initial node vector;
[0024] S2022: In each round of information transmission, for each node in the graph data, a certain number of neighboring nodes are sampled according to its neighbor relationship;
[0025] S2023: For each node, use an aggregation function to summarize the information of its neighboring nodes;
[0026] S2024: Based on the aggregated neighboring node information and the node's own information, a neural network model is used to update the node representation and generate a random embedding vector for the node.
[0027] Preferably, in step S202, the random configuration network implements random node embedding through the following steps:
[0028] S2121: Randomly select a part of node embedding vectors from the node random embedding vectors as the enhanced object;
[0029] S2123: Perform random data perturbation on the selected node embedding vector to generate a node enhanced embedding vector.
[0030] Preferably, in step S203, the graph convolution network weight parameters are initialized by normal distribution or uniform distribution;
[0031] 1) The formula for initializing the weight parameters of the graph convolutional network using normal distribution is expressed as:
[0032]
[0033] 2) The formula for initializing the weight parameters of the graph convolutional network using uniform distribution is expressed as:
[0034] W GCN ~U(-a GCN ,a GCN );
[0035] Where: W GCNRepresents the weight parameter matrix of the graph convolutional network; represents the variance of the normal distribution; a GCN Denotes the tuning parameter for the uniform distribution.
[0036] Preferably, in step S203, initialization of the attention weight and value weight of the graph attention network is achieved through normal distribution and uniform distribution respectively;
[0037] 1) The formula for initializing the attention weight of the graph attention network using normal distribution is expressed as:
[0038] W att ~U(-a att ,a att );
[0039] 2) The formula for initializing the weights of the graph attention network using uniform distribution is expressed as:
[0040]
[0041] Where: W att , W val Represent the attention weight and value weight of the graph attention network respectively; represents the variance of the normal distribution; a att Denotes the tuning parameter for the uniform distribution.
[0042] Preferably, in step S204, the graph convolution network performs convolution processing on the node enhanced embedding vector through stacked multiple layers of graph convolution layers, the output of the previous graph convolution layer is used as the input of the adjacent next graph convolution layer, and the output of the last graph convolution layer is used as the first feature representation of the node;
[0043] In each graph convolutional layer, the feature representation of each node is updated by aggregating the feature representations of its neighboring nodes;
[0044] The formula is:
[0045]
[0046] Where: Represents the feature representation of node i output by the k+1th graph convolutional layer; represents the feature representation of node i’s neighbor node j; N(i) represents the set of neighbor nodes of node i; c ij is the normalization coefficient; W (k) represents the weight matrix of the k-th graph convolutional layer; σ is the activation function.
[0047] Preferably, in step S205, in the graph attention network, for each node: calculate the attention coefficient between the node and the neighboring nodes; use the Softmax function to normalize the attention coefficient to obtain the attention weight between the node and the neighboring nodes; perform weighted summation on the neighboring nodes of the node according to the attention weight to update the feature representation of the node to obtain the second feature representation of the node;
[0048] The calculation formula of the attention coefficient is expressed as:
[0049] e ij =LeakyReLU(a T [Wh i ||Wh j ]);
[0050] Where: e ij represents the attention coefficient between node i and its neighbor node j; h j represents the feature representation of node i’s neighbor node j; a represents the parameter vector of the attention mechanism; W represents the linear transformation matrix of the node features; || represents the connection operation of the vector;
[0051] The normalized calculation formula is expressed as:
[0052]
[0053] Where: α ij Represents the normalized attention coefficient, that is, the attention weight.
[0054] Preferably, in step S207, the fusion feature representation is calculated by the following formula:
[0055] H fusion =A·H GAT +(1-A)·H GCN ;
[0056] Where: H fusion represents fusion feature representation; H GCN represents the first feature representation of the node; H GAT represents the second feature representation of the node; A represents the attention weight.
[0057] Preferably, in step S208, the loss is calculated by the following formula:
[0058]
[0059] Where: N s represents the number of graph data samples; w(y i ) represents the category weight; y i Indicates the real type of the node; Indicates that graph data sample i belongs to the true type of node y i The probability of ; q is a hyperparameter.
[0060] Compared with the prior art, the graph anomaly detection method using graph data enhancement effect under random configuration network in the present invention has the following beneficial effects:
[0061] The present invention performs random node embedding and random data enhancement on the input graph data through a random configuration network. First, through the random configuration mechanism of the random configuration network, a certain randomness can be introduced in the node embedding process, which helps the model learn more diverse feature representations; at the same time, the random node embedding based on the random configuration network can convert the nodes in the graph data into low-dimensional vector representations, which can capture the key features of the nodes. In the anomaly detection task, these feature representations are crucial for distinguishing normal nodes from abnormal nodes, thereby improving the accuracy of anomaly detection of graph data nodes. Secondly, the random data enhancement based on the random configuration network can generate diversified training samples by introducing noise or transforming the original data. These samples increase the diversity of the data while retaining the key features of the original data, which helps the model learn more generalized feature representations, thereby improving the detection ability of unknown abnormal nodes. Finally, the incremental learning characteristics of the random configuration network enable the anomaly detection model to gradually optimize the node embedding and model parameters during the training process. Through random node embedding and random data enhancement, the anomaly detection model can capture the key features in the data faster, thereby accelerating the convergence speed of the model.
[0062] The present invention randomly initializes the weight parameters of the graph convolution network and the graph attention network by randomly configuring the network. First, randomly initializing the weights can increase the diversity of the network, which helps the graph convolution network and the graph attention network to better explore and search the parameter space during the training process, thereby accelerating the training process and enabling the network to converge to a better solution faster. Secondly, the graph convolution network captures the local structural information in the graph data through the convolution operation. By randomly initializing the weight parameters of the graph convolution network, it can be ensured that the network can learn different local features at the beginning of training, which is particularly important for the node anomaly detection task, because abnormal nodes often differ from normal nodes in local structure. Finally, the graph attention network learns the relative importance between nodes by introducing the attention mechanism, so as to better aggregate the information of neighboring nodes. By randomly initializing the weight parameters of the graph attention network, it can be ensured that the attention mechanism can pay attention to different neighboring nodes at the beginning of training, which is crucial for identifying abnormal nodes that are inconsistent with the behavior of most neighboring nodes.
[0063] The present invention performs graph convolution processing on nodes through a graph convolution network, and then captures the attention relationship between nodes through a graph attention network. First, the serial use of the graph convolution network and the graph attention network enables the anomaly detection model to capture node information from multiple angles, including the static properties of the nodes, local structures, and important neighbor relationships, which helps the anomaly detection model to more comprehensively understand the patterns and anomalies in the graph data. Secondly, by serially connecting two different types of graph neural networks, the anomaly detection model can fuse heterogeneous information, such as node features, edge features, and complex relationships between nodes. This fusion helps to improve the accuracy and robustness of anomaly detection in graph data. Finally, by fusing the node feature representation of the graph convolution network and the graph attention network, a more comprehensive node representation can be obtained, which is conducive to improving the accuracy of anomaly detection of graph data nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to make the purpose, technical solution and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:
[0065] Figure 1 It is the logic block diagram of the graph anomaly detection method;
[0066] Figure 2 is a flow chart of the graph anomaly detection method;
[0067] Figure 3 This is a line chart of the evaluation indicators when the graph convolutional network model is used alone;
[0068] Figure 4 This is a line chart of the evaluation indicators when the graph attention network model is used alone;
[0069] Figure 5 This is a line chart of the evaluation indicators of the serial model using graph convolutional networks and graph attention networks under random configuration networks;
[0070] Figure 6 Comparison of AUC scores
[0071] Figure 7 is the confusion matrix image. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but only represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.
[0073] The following is a further detailed description through specific implementation methods:
[0074] Example:
[0075] This embodiment discloses a graph anomaly detection method that utilizes graph data enhancement effect in a randomly configured network.
[0076] like Figure 1 As shown, the graph anomaly detection method using graph data enhancement effect under random configuration network includes:
[0077] S1: Obtain the image data to be detected;
[0078] S2: Input the graph data to be detected into the trained anomaly detection model and output the corresponding node prediction type;
[0079] In this embodiment, the node prediction type includes the prediction type (normal or abnormal) of each node in the graph data.
[0080] The anomaly detection model is built based on the Stochastic Configuration Network (SCN), Graph Convolutional Network (GCN) and Graph Attention Network (GAT); combined with Figure 2 As shown, the processing steps for training anomaly detection model are as follows:
[0081] S201: Obtain graph data samples used as training data and corresponding node real types;
[0082] S202: Input the graph data sample into the random configuration network, perform random node embedding and random data enhancement on the graph data sample, and generate a node enhanced embedding vector;
[0083] In this embodiment, the random configuration network is constructed based on a graph convolutional network.
[0084] S203: Randomly initialize the weight parameters of the graph convolution network and the graph attention network;
[0085] S204: Inputting the node enhanced embedding vector into the graph convolution network for graph convolution processing to generate the first feature representation of the node;
[0086] S205: Input the first feature representation of the node into the graph attention network to capture the attention relationship between the nodes and generate the second feature representation of the node;
[0087] S206: Fusing the first feature representation of the node and the second feature representation of the node to generate a fused feature representation;
[0088] S207: Input the fused feature representation into a classifier for classification, and generate a corresponding node prediction type;
[0089] S208: Calculate the loss based on the predicted node type and the true node type of the corresponding graph data sample, and optimize the parameters of the classifier;
[0090] S209: Repeat steps S201 to S208 until the anomaly detection model converges or reaches a preset number of iteration rounds;
[0091] S3: Output the true type of the node as the graph anomaly detection result of the graph data to be detected.
[0092] The present invention performs random node embedding and random data enhancement on the input graph data through a random configuration network. First, through the random configuration mechanism of the random configuration network, a certain randomness can be introduced in the node embedding process, which helps the model learn more diverse feature representations; at the same time, the random node embedding based on the random configuration network can convert the nodes in the graph data into low-dimensional vector representations, which can capture the key features of the nodes. In the anomaly detection task, these feature representations are crucial for distinguishing normal nodes from abnormal nodes, thereby improving the accuracy of anomaly detection of graph data nodes. Secondly, the random data enhancement based on the random configuration network can generate diversified training samples by introducing noise or transforming the original data. These samples increase the diversity of the data while retaining the key features of the original data, which helps the model learn more generalized feature representations, thereby improving the detection ability of unknown abnormal nodes. Finally, the incremental learning characteristics of the random configuration network enable the anomaly detection model to gradually optimize the node embedding and model parameters during the training process. Through random node embedding and random data enhancement, the anomaly detection model can capture the key features in the data faster, thereby accelerating the convergence speed of the model.
[0093] The present invention randomly initializes the weight parameters of the graph convolution network and the graph attention network by randomly configuring the network. First, randomly initializing the weights can increase the diversity of the network, which helps the graph convolution network and the graph attention network to better explore and search the parameter space during the training process, thereby accelerating the training process and enabling the network to converge to a better solution faster. Secondly, the graph convolution network captures the local structural information in the graph data through the convolution operation. By randomly initializing the weight parameters of the graph convolution network, it can be ensured that the network can learn different local features at the beginning of training, which is particularly important for the node anomaly detection task, because abnormal nodes often differ from normal nodes in local structure. Finally, the graph attention network learns the relative importance between nodes by introducing the attention mechanism, so as to better aggregate the information of neighboring nodes. By randomly initializing the weight parameters of the graph attention network, it can be ensured that the attention mechanism can pay attention to different neighboring nodes at the beginning of training, which is crucial for identifying abnormal nodes that are inconsistent with the behavior of most neighboring nodes.
[0094] The present invention performs graph convolution processing on nodes through a graph convolution network, and then captures the attention relationship between nodes through a graph attention network. First, the serial use of the graph convolution network and the graph attention network enables the anomaly detection model to capture node information from multiple angles, including the static properties of the nodes, local structures, and important neighbor relationships, which helps the anomaly detection model to more comprehensively understand the patterns and anomalies in the graph data. Secondly, by serially connecting two different types of graph neural networks, the anomaly detection model can fuse heterogeneous information, such as node features, edge features, and complex relationships between nodes. This fusion helps to improve the accuracy and robustness of anomaly detection in graph data. Finally, by fusing the node feature representation of the graph convolution network and the graph attention network, a more comprehensive node representation can be obtained, which is conducive to improving the accuracy of anomaly detection of graph data nodes.
[0095] In order to better introduce the technical solution of the present invention, this embodiment is described through the following parts.
[0096] 1. Random Node Embedding and Data Augmentation
[0097] Introduce randomness in the node embedding process. In node representation learning, the random representation of the node can be obtained by using alternating random walks in the node feature representation process, so that the node representation is more diverse. In the training phase of the model, the model learns node embedding by iteratively updating the representation of each node. The random node embedding idea adopted by the present invention is mainly reflected in the initialization of node representation, information transmission, aggregation of neighbor information and updating of node representation.
[0098] In this embodiment, the random configuration network implements random node embedding through the following steps:
[0099] S2021: Randomly initialize the graph data to generate an initial node vector;
[0100] In this embodiment, the initial vectors have the same dimension, but the vector value of each node is randomly generated. The purpose is to provide a starting point for all nodes in the graph data so that these vectors can be gradually optimized during the information propagation process so that they can capture the structure of the graph and the association information between nodes.
[0101] S2022: In each round of information transmission, for each node in the graph data, a certain number of neighboring nodes are sampled according to its neighbor relationship (i.e., edge connectivity);
[0102] In this embodiment, the number of samples can be determined according to the specific algorithm and the scale of the graph. The purpose is to limit the number of neighbors that each node needs to consider when updating its representation, so as to reduce the computational complexity and improve the scalability of the algorithm.
[0103] S2023: For each node, use some aggregation function (such as average pooling, maximum pooling, summation, etc.) to summarize the information of its neighboring nodes;
[0104] In this embodiment, the information of the neighboring nodes may be their feature vectors or their representations after the previous round of updating. The purpose is to integrate the information of the neighboring nodes into a unified representation so as to be used to update the representation of the current node.
[0105] S2024: Based on the aggregated neighboring node information and the node's own information, a neural network model (such as a multi-layer perceptron, a graph convolutional network, etc.) is used to update the node representation and generate a random embedding vector for the node.
[0106] In this embodiment, the updating process usually involves operations such as linear transformation, nonlinear activation function, etc. The purpose is to generate a richer node representation by combining the information of neighboring nodes and the information of the node itself, which can capture the structural information of the graph and the relationship between nodes.
[0107] The formula for updating the node representation through the neural network model is expressed as:
[0108] D aug ={T(d)|d∈D,T∈M};
[0109] Where: D aug Represents a random embedding vector of a node; D represents the original data set; T represents a set of data transformation operations; M represents a neural network model; T(d) represents a new sample obtained by performing transformation operation T on the original data d, and T∈M represents that the transformation operation is part of the neural network model.
[0110] In this embodiment, the random configuration network implements random node embedding through the following steps:
[0111] S2121: Randomly select a part of node embedding vectors from the node random embedding vectors as the enhanced object;
[0112] In this embodiment, it can be achieved through random sampling or a sampling strategy based on node importance.
[0113] S2123: Perform random data perturbation on the selected node embedding vector to generate a node enhanced embedding vector.
[0114] In this embodiment, the random disturbance includes additive noise (such as Gaussian noise, uniform noise), multiplicative noise, or geometric transformation such as slight rotation and scaling of the vector.
[0115] In other preferred embodiments, in addition to directly perturbing the embedding vector, the embedding vector can also be indirectly affected by changing the graph structure, such as randomly deleting or adding edges, or sampling subgraphs of the graph, etc. Then, the nodes of the graph that has undergone structural transformation are re-embedded to obtain a new set of embedding vectors.
[0116] 2. Random Weights in Convolution Operations
[0117] In the graph convolutional network (GCN) and graph attention network models, randomness is first introduced in the convolution operation, then in the information transmission process, and finally in the neighborhood aggregation to enhance the model's modeling ability for the graph data structure. The weights in the convolution operation are usually learned through the back propagation algorithm rather than randomly initialized. Therefore, the present invention hopes to use random weights in the convolution operation, and requires a certain method to achieve this.
[0118] First, random initialization is used to initialize the neural network. The present invention will perform different initialization allocation operations on GCN and GAT respectively. Since GCN and GAT use different mechanisms to process graph data, the weights of different parts need to be initialized respectively.
[0119] In GCN, the weight parameters of the graph convolutional network are initialized through normal distribution or uniform distribution;
[0120] 1) The formula for initializing the weight parameters of the graph convolutional network using normal distribution is expressed as:
[0121]
[0122] 2) The formula for initializing the weight parameters of the graph convolutional network using uniform distribution is expressed as:
[0123] W GCN ~U(-aGCN ,a GCN );
[0124] Where: W GCN Represents the weight parameter matrix of the graph convolutional network; represents the variance of the normal distribution; a GCN Denotes the tuning parameter for the uniform distribution.
[0125] GAT usually adopts an adaptive attention mechanism. Unlike GCN, the weight parameters in GAT are usually determined by the attention mechanism, so different initialization strategies are required. In GAT, the attention weights and value weights of the graph attention network are initialized by normal distribution and uniform distribution respectively;
[0126] 1) The formula for initializing the attention weight of the graph attention network using normal distribution is expressed as:
[0127] W att ~U(-a att ,a att );
[0128] 2) The formula for initializing the weights of the graph attention network using uniform distribution is expressed as:
[0129]
[0130] Where: W att , W val Represent the attention weight and value weight of the graph attention network respectively; represents the variance of the normal distribution; a att Denotes the tuning parameter for the uniform distribution.
[0131] 3. Graph Convolutional Network
[0132] The graph convolution network performs convolution processing on the node enhanced embedding vector through stacked multi-layer graph convolution layers. The output of the previous graph convolution layer is used as the input of the adjacent next graph convolution layer, and the output of the last graph convolution layer is used as the first feature representation of the node.
[0133] In each graph convolutional layer, the feature representation of each node is updated by aggregating the feature representations of its neighboring nodes;
[0134] The formula is:
[0135]
[0136] Where: Represents the feature representation of node i output by the k+1th graph convolutional layer; represents the feature representation of node i’s neighbor node j; N(i) represents the set of neighbor nodes of node i; cij is the normalization coefficient, usually the square root of the node degree; W (k) represents the weight matrix of the k-th graph convolutional layer; σ is the activation function (such as ReLU).
[0137] 4. Graph Attention Network
[0138] In the graph attention network, for each node: calculate the attention coefficient between the node and its neighboring nodes; use the Softmax function to normalize the attention coefficient to obtain the attention weight between the node and its neighboring nodes; perform weighted summation of the node's neighboring nodes according to the attention weight to update the node's feature representation and obtain the node's second feature representation;
[0139] The calculation formula of the attention coefficient is expressed as:
[0140] e ij =LeakyReLU(a T [Wh i ||Wh j ]);
[0141] Where: e ij represents the attention coefficient between node i and its neighbor node j; h j represents the feature representation of node i’s neighbor node j; a represents the parameter vector of the attention mechanism; W represents the linear transformation matrix of the node features; || represents the connection operation of the vector;
[0142] The normalized calculation formula is expressed as:
[0143]
[0144] Where: α ij Represents the normalized attention coefficient, that is, the attention weight.
[0145] Because GCN and GAT have different effects when processing different parts of information. Among them, GCN works better when processing graph data. When processing graph data, the GCN method is more suitable for learning node representations in graph data, and can better use the adjacency relationship between nodes for information propagation. Ideally, GCN is used to process graph data first, and each node is represented as a low-dimensional vector containing its neighbor information. GCN can effectively capture the local structure and propagate information between nodes, and is an ideal choice for densely connected graph data. At the same time, GAT introduces an attention mechanism to dynamically learn the importance weights between nodes and their neighbors. Similarly, ideally, GAT can be used to further process node representations to better capture the complex relationships and local structures between nodes through the attention mechanism. It is precisely because GAT can adaptively learn the importance of nodes according to specific tasks that it is more suitable for situations where the connections between nodes in graph data are sparse and complex. In general, GCN will be used to perform appropriate preprocessing of graph data, and then GAT will perform more detailed feature extraction and representation learning.
[0146] 5. Feature Fusion
[0147] In this embodiment, the fusion feature representation is calculated by the following formula:
[0148] H fusion =A·H GAT +(1-A)·H GCN ;
[0149] Where: H fusion represents fusion feature representation; H GCN represents the first feature representation of the node; H GAT represents the second feature representation of the node; A represents the attention weight, which can be GAT Matrices or tensors of the same dimension are used to weight the second feature representation of the nodes output by the graph attention network; (1-A) represents weighting the first feature representation of the nodes output by the graph convolutional network so that the two are balanced when fused.
[0150] It should be noted that the attention weight A can be learned from the GAT model, which is designed based on the attention mechanism and can learn the attention relationship between nodes according to the structure and features of the input graph. By multiplying the attention weight output by GAT with the corresponding feature, the attention information can be incorporated into the final feature representation.
[0151] 6. Loss Function
[0152] In a well-defined convolution operation, input data is passed to the convolution layer and the output is calculated through forward propagation. The defined loss function measures the difference between the model output and the true label. An optimizer is selected to adjust the weights of the convolution layer to reduce the value of the loss function.
[0153] Given the predicted probability distribution p and the true label y, the loss function can be expressed as:
[0154]
[0155] Where: N s represents the number of graph data samples; w(y i ) represents the category weight; y i Indicates the real type of the node; Indicates that graph data sample i belongs to the true type of node y i The probability of ; q is a hyperparameter.
[0156] Compared with the ordinary cross entropy loss function, this loss function weights the predicted probability when calculating the loss, making the categories with higher predicted probabilities more prone to errors. The cross entropy function formula used is defined as follows:
[0157]
[0158] where Y g is the label probability predicted by the model, and q is a hyperparameter that adjusts the coefficient of the loss weight.
[0159] In addition, it is recommended to use the Softmax function in the cross entropy loss function to convert the original output of the model into a probability distribution. The expression of the Softmax function is:
[0160]
[0161] Among them, p i is the probability of category i, Z i is the original output of the model, and N is the total number of categories. During model training, the optimizer will use the backpropagation algorithm to calculate the gradient of the loss function with respect to the weights and use these gradients to update the weights of the convolutional layer.
[0162] VII. Experimental Description
[0163] All experiments use the same parameters, including:
[0164] 1) Model: For the same dataset, our neural network uses the same screen parameter settings. GCN: input dimension is 64, hidden layer dimension is 32, and output dimension is 2. GAT: input dimension is 64, hidden layer dimension is 32, number of attention heads is 8, and output dimension is 2. The serial GCN and GAT models based on SCN use the same parameter settings.
[0165] 2) Training parameters: The validation set size is 0.25 (25%), the test set size is 0.75 (75%), that is, 75% of the data is used for testing and the rest of the data is used for training. The following parameters are used in the training process of each model: 200 iterations, a learning rate of 0.005, a threshold parameter of 1.5, an SCN parameter of 0.5, a GCE (generalized cross entropy loss) parameter of 0.5, and a regularization weight parameter (wds) of [0.0005, 0.0002, 0.0002, 0.0002, 0.00020.0004, 0.001, 0.0009].
[0166] 3) Validation metrics: Obtain the training loss, validation metrics, confusion matrix, and ROC curve for each model.
[0167] In order to evaluate the performance of the designed framework and model, experiments were conducted using public data to verify the experimental framework and model. Corresponding comparative experiments were also conducted to verify the effectiveness and accuracy of the experiments.
[0168] 1. Experimental Preparation
[0169] Datasets: To ensure the fairness and effectiveness of the experiment, we used publicly available datasets as experimental data. Table 1 lists the statistics of the datasets used, where each dataset is divided into different parts, with 25% and 75% of the annotated nodes for training and testing, respectively. In addition, the proportion of outliers contained in each part is the same as that of the entire dataset.
[0170] Table 1 Dataset statistics
[0171]
[0172] ACM is a widely used scientific citation network, where nodes represent publications and edges represent citation relationships. Node attributes are extracted from the published content using bag-of-words. The Flickr dataset is large in scale and contains a large number of images covering a variety of topics, scenes, and content. Due to its richness and diversity, the Flickr dataset has become one of the important benchmark datasets in the field of computer vision.
[0173] 2. Evaluation Metrics
[0174] We use four commonly used evaluation metrics, namely F1 score, precision, recall, and AUC score, to objectively evaluate the performance of the model. Specifically, using these metrics can evaluate the experimental effect at a macro level without excessively underestimating or overestimating the experimental model.
[0175] The single model GCN and GAT models were evaluated by indicators (such as Figure 3 and Figure 4 ), and the model proposed in this experiment was tested in the same way (as shown in Figure 5 The experimental results show that the proposed method can obtain higher and more stable F1 scores, recall rates and precision rates compared with the single GCN or GAT model. Therefore, the loss is also lower and does not fluctuate.
[0176] It can be seen that compared with using GCN or GAT alone, the neural network with a serial mixture of GCN and GAT and the randomly configured network performed better in terms of the evaluation indicators in this experimental study part.
[0177] 3. Detection performance
[0178] These experiments are compared with traditional GCN and GAT models using evaluation metrics and accuracy values to demonstrate their effectiveness. Specifically, performance is evaluated by precision, recall, and F1 score. In addition, AUC scores are compared for possible supervised training scenarios, such as Figure 6 As shown. Figure 6 As can be seen from the figure, the hybrid model under the random configuration network (SCN) seems to have better results than both the single GAT network and the single GCN network. This is reflected in the fact that the overall AUC score is in the leading position, and the model rises faster in the initial stage.
[0179] Secondly, the image of confusion matrix is studied because it can integrate the classification of abnormal assessment, e.g. Figure 7 shown. Figure 7 The diagonal elements (TP and TN) in the confusion matrix represent the number of samples correctly classified by the model. Higher diagonal element values indicate that the model has higher accuracy and can correctly identify normal and abnormal nodes. The TP (True Positive) and FP (False Positive) values in the confusion matrix are used to calculate precision. Lower FP values and higher TP values indicate that the model has a higher proportion of abnormal nodes when predicting abnormal nodes, and has high precision. The F1 score is the harmonic mean of precision and recall, combining the advantages of both. The TP, FP, and FN values in the confusion matrix jointly determine the F1 score. The higher F1 score in this study indicates that the model has achieved a good balance between precision and recall.
[0180] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.
Claims
1. A graph anomaly detection method using graph data enhancement effect under a random configuration network, characterized in that: include: S1: Obtain the image data to be detected; S2: Input the graph data to be detected into the trained anomaly detection model and output the corresponding node prediction type; The anomaly detection model is built based on random configuration network, graph convolution network and graph attention network; The processing steps for training anomaly detection model are as follows: S201: Obtain graph data samples used as training data and corresponding node real types; S202: Input the graph data sample into the random configuration network, perform random node embedding and random data enhancement on the graph data sample, and generate a node enhancement embedding vector; S203: Randomly initialize the weight parameters of the graph convolution network and the graph attention network; S204: Inputting the node enhanced embedding vector into the graph convolution network for graph convolution processing to generate the first feature representation of the node; S205: Input the first feature representation of the node into the graph attention network to capture the attention relationship between the nodes and generate the second feature representation of the node; S206: Fusing the first feature representation of the node and the second feature representation of the node to generate a fused feature representation; S207: Input the fused feature representation into a classifier for classification, and generate a corresponding node prediction type; S208: Calculate the loss based on the predicted node type and the true node type of the corresponding graph data sample, and optimize the parameters of the classifier; S209: Repeat steps S201 to S208 until the anomaly detection model converges or reaches a preset number of iteration rounds; S3: Output the true type of the node as the graph anomaly detection result of the graph data to be detected.
2. The graph anomaly detection method using graph data enhancement effect under a random configuration network as claimed in claim 1, characterized in that: In step S202, the random configuration network implements random node embedding through the following steps: S2021: Randomly initialize the graph data to generate an initial node vector; S2022: In each round of information transmission, for each node in the graph data, a certain number of neighboring nodes are sampled according to its neighbor relationship; S2023: For each node, use an aggregation function to summarize the information of its neighboring nodes; S2024: Based on the aggregated neighboring node information and the node's own information, a neural network model is used to update the node representation and generate a random embedding vector for the node.
3. The graph anomaly detection method using graph data enhancement effect under a random configuration network as claimed in claim 2, characterized in that: In step S202, the random configuration network implements random node embedding through the following steps: S2121: Randomly select a part of node embedding vectors from the node random embedding vectors as the enhanced object; S2123: Perform random data perturbation on the selected node embedding vector to generate a node enhanced embedding vector.
4. The graph anomaly detection method using graph data enhancement effect under a random configuration network as claimed in claim 1, characterized in that: In step S203, the weight parameters of the graph convolutional network are initialized by normal distribution or uniform distribution; 1) The formula for initializing the weight parameters of the graph convolutional network using normal distribution is expressed as: 2) The formula for initializing the weight parameters of the graph convolutional network using uniform distribution is expressed as: W GCN ~U(-a GCN ,a GCN ); Where: W GCN Represents the weight parameter matrix of the graph convolutional network; represents the variance of the normal distribution; a GCN Denotes the tuning parameter for the uniform distribution.
5. The graph anomaly detection method using graph data enhancement effect under a random configuration network as claimed in claim 1, characterized in that: In step S203, the attention weight and value weight of the graph attention network are initialized by normal distribution and uniform distribution respectively; 1) The formula for initializing the attention weight of the graph attention network using normal distribution is expressed as: W att ~U(-a att ,a att ); 2) The formula for initializing the weights of the graph attention network using uniform distribution is expressed as: Where: W att , W val Represent the attention weight and value weight of the graph attention network respectively; represents the variance of the normal distribution; a att Denotes the tuning parameter for the uniform distribution.
6. The graph anomaly detection method using graph data enhancement effect under a random configuration network as claimed in claim 1, characterized in that: In step S204, the graph convolution network performs convolution processing on the node enhanced embedding vector through stacked multi-layer graph convolution layers, the output of the previous graph convolution layer is used as the input of the adjacent next graph convolution layer, and the output of the last graph convolution layer is used as the first feature representation of the node; In each graph convolutional layer, the feature representation of each node is updated by aggregating the feature representations of its neighboring nodes; The formula is: Where: Represents the feature representation of node i output by the k+1th graph convolutional layer; represents the feature representation of node i’s neighbor node j; N(i) represents the set of neighbor nodes of node i; c ij is the normalization coefficient; W (k) represents the weight matrix of the k-th graph convolutional layer; σ is the activation function.
7. The graph anomaly detection method using graph data enhancement effect under a randomly configured network as claimed in claim 1, characterized in that: In step S205, in the graph attention network, for each node: the attention coefficient between the node and the neighboring nodes is calculated; the attention coefficient is normalized using the Softmax function to obtain the attention weight between the node and the neighboring nodes; Perform weighted summation on the neighboring nodes of the node according to the attention weight to update the feature representation of the node and obtain the second feature representation of the node; The calculation formula of the attention coefficient is expressed as: e ij =LeakyReLU(a T [Wh i ||Wh j ]); Where: e ij represents the attention coefficient between node i and its neighbor node j; h j represents the feature representation of node i’s neighbor node j; a represents the parameter vector of the attention mechanism; W represents the linear transformation matrix of the node features; || represents the connection operation of the vector; The normalized calculation formula is expressed as: Where: α ij Represents the normalized attention coefficient, that is, the attention weight.
8. The graph anomaly detection method using graph data enhancement effect under a random configuration network as claimed in claim 1, characterized in that: In step S207, the fusion feature representation is calculated by the following formula: H fusion =A·H GAT +(1-A)·H GCN ; Where: H fusion represents fusion feature representation; H GCN represents the first feature representation of the node; H GAT represents the second feature representation of the node; A represents the attention weight.
9. The graph anomaly detection method using graph data enhancement effect under a random configuration network as claimed in claim 1, characterized in that: In step S208, the loss is calculated using the following formula: Where: N s Represents the number of graph data samples; w(y i ) represents the category weight; y i Indicates the real type of the node; Indicates that graph data sample i belongs to the true type of node y i The probability of ; q is a hyperparameter.
Citation Information
Cited By
Target abnormal behavior detection and identification method based on enhanced graph learning
CN119669895A
Data classification method and device based on linear feature enhancement, equipment and storage medium
CN120277540A
Distributed photovoltaic short-term power prediction method and system based on BiLSTM
CN120354091A
