Multi-view and multi-scale image anomaly detection method and system based on dynamic node screening
Through dynamic node screening and multi-view multi-scale methods, a comparative network model is constructed, which solves the problem that the existing technology is difficult to capture multi-scale information, and significantly improves the accuracy of graph anomaly detection and model performance.
Patent Information
- Application Number
- CN202411393124.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2024-11-08
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing graph anomaly detection methods are difficult to effectively capture multiple information scales and context information, resulting in poor abnormality detection performance in complex graph data.
A multi-view multi-scale graph anomaly detection method based on dynamic node filtering is adopted, instance pairs of different scales are constructed through the RWR algorithm, and a comparative network model is constructed for feature learning and dynamic node filtering, and the anomaly score of each node is calculated.
It significantly improves the accuracy and reliability of anomaly detection, improves model performance, and adapts to large-scale graph datasets, reducing irrelevant data interference.
Smart Images

Figure CN118916820A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of graph anomaly detection, and in particular relates to a multi-view and multi-scale graph anomaly detection method and system based on dynamic node screening. Background Art
[0002] In recent years, as social networks, biological networks, transportation networks, and financial transaction networks continue to generate complex, interdependent, and interconnected data, data representation and analysis in the form of graphs or networks have received widespread attention; among them, the graph anomaly detection task, that is, identifying patterns in a graph (such as nodes, edges, subgraphs) that are significantly different from most patterns, is particularly important in aspects such as fraud detection in financial transaction networks and abnormal user detection in social networks; attribute networks (or attribute graphs) are particularly critical in this context; they not only represent the relationships between entities, but also encode a rich set of features for each node, effectively dealing with the problem of data heterogeneity in information systems; the analysis of attribute networks also helps to reveal the correlation between individual attributes, thereby extracting valuable information and knowledge from complex systems.
[0003] The development of graph anomaly detection technology can be divided into two categories: shallow methods and deep methods. Early shallow methods, such as ego-network analysis, residual analysis, or CUR decomposition, although simple in concept, may not be able to learn nonlinear representations when processing complex graph data, resulting in unsatisfactory anomaly detection performance. In the era of deep learning, deep model methods such as graph autoencoders (GAEs) learn nonlinear hidden representations and estimate anomaly scores based on reconstruction errors, which are significantly improved compared to shallow methods. However, these methods are usually unable to capture contextual information used for anomaly detection well, such as subgraphs around nodes, which limits their performance. Contrastive learning mechanisms have been applied to the field of graph anomaly detection and have shown good performance. By constructing pairs of instances (such as subgraphs and target nodes) and adopting contrastive learning methods to learn representations, anomaly scores are further calculated based on predictions of instances. However, current methods only consider a single information scale. Given the complexity of graph data, anomalies are usually hidden at different scales (such as node and subgraph levels), requiring a more fine-grained anomaly detection system to deal with them. Therefore, it is necessary to focus on developing advanced graph anomaly detection technologies that can comprehensively utilize multiple information scales and contextual information. Summary of the invention
[0004] In order to solve the deficiencies in the prior art, the present invention provides a multi-view and multi-scale graph anomaly detection method based on dynamic node screening, introduces a dynamic node screening mechanism, and captures richer information by sampling lightweight comparison instance pairs.
[0005] The present invention adopts the following technical solution.
[0006] A multi-view multi-scale graph anomaly detection method based on dynamic node screening comprises the following steps: Step 1: Obtain the original data of all nodes to form an original data set, and preprocess the original data set to form an original view and a second view; Step 2: Use the RWR algorithm to sample sub-images of the original view and the second view respectively to construct instance pairs of different scales; Step 3: Construct a comparison network model based on the constructed instance pairs of different scales, and initialize the comparison network model; Step 4: Perform feature learning based on the subgraph sampled in step 2, construct the feature matrix and self-connection matrix of the subgraph nodes, and input the feature matrix and adjacency matrix of the nodes into the comparison network model constructed in step 3 for training to perform dynamic node screening. Input the obtained feature matrix and adjacency matrix of the dynamic nodes into the comparison network model for training, and calculate the final anomaly score of each node.
[0007] The present invention also includes the following preferred embodiments: In step 1, the original data includes nodes, node attributes, and link relationships between nodes; the attributes of the nodes include the feature vectors of the nodes; and the link relationships between nodes are presented in the form of an adjacency matrix.
[0008] In step 1, preprocessing the original data set to form the original view and the second view includes: Perform structural anomaly injection and attribute anomaly injection on the original data set constructed in step 1, and construct the original view through edge perturbation and attribute perturbation; The edge perturbation image enhancement technology is used to perform edge perturbation on the constructed original view to construct the second view.
[0009] In step 2, the subgraph is a graph consisting of a portion of nodes selected from the original view or the second view and the edges corresponding to the nodes.
[0010] In step 2, constructing instance pairs of different scales includes constructing subgraph-node instance pairs, node-node instance pairs, and subgraph-subgraph instance pairs.
[0011] Constructing a subgraph-node instance includes constructing a loss function for subgraph-node comparison according to the following formula: : , in, Indicates the node number, Indicates the total number of nodes, represents the consistency score between the subgraph and the target node, In the case of subgraph-node pairs, labels and pairs are represented. Equal to 1, in the case of a negative pair, is equal to 0.
[0012] Constructing node-node instance pairs includes constructing the node-node comparison loss function according to the following formula :
[0013] in, Indicates the node number, Indicates the total number of nodes, represents the consistency score between the embedding and the target node formed by the aggregation of other vectors in the subgraph, represents the node-node instance pair label, when the instance pair is Equal to 1, negative instance pair, is equal to 0.
[0014] Constructing a subgraph-subgraph instance pair includes constructing a loss function for the subgraph-subgraph instance pair according to the following formula: : , in, Indicates the node number, Indicates the total number of nodes, , Respectively represent nodes Sub-image embedding in the original view and the second view, , Respectively represent nodes Sub-image embedding in the original view and the second view.
[0015] In step 3, the construction of the comparison network model includes: Initialize the parameters of the comparison network model, including the restart probability of random walk when initializing the sampling subgraph, the weight parameter of the GCN layer, the weight parameter of the bilinear scoring function, and the learning rate batch size; The binary cross entropy function is used to construct the loss function of the contrastive network model.
[0016] In step 4, the feature matrix and adjacency matrix data of the node are input into the comparison network model for training to perform dynamic node screening, and the feature matrix and adjacency matrix data of the obtained dynamic node are input into the comparison network model for training. The final abnormal score of each node is calculated including: Step 4.1: Use all nodes to train the model and estimate the degree of abnormality of each node. Design a dynamic strategy to add the node with the lowest value in the distribution of abnormal scores among all nodes as a high-confidence node to the normal pool; Step 4.2: Input the obtained feature matrix and adjacency matrix data of the dynamic nodes into the contrast network model for training; Step 4.3: Use multiple rounds of positive and negative sampling strategies to calculate the final anomaly score of each node.
[0017] In step 4.1, the abnormality degree of each node is estimated according to the following formula: , in, Representation Node The abnormality index, represents the consistency score of the negative pair, represents the consistency score of the pair, represents a positive instance pair, and n represents a negative instance pair.
[0018] In step 4.1, the design formula of the dynamic strategy is as follows: , in, represents the speed of the k-th step of the dynamic strategy, Indicates the total number of nodes, represents the number of trainings in the selection phase, and k represents the number of trainings.
[0019] In step 4.3, multiple rounds of positive and negative sampling strategies are used to calculate the final anomaly score of each node, including calculating the final anomaly score of the node according to the following formula: , , , in, Indicates the number of rounds of positive and negative sampling, Representation Node The final anomaly score, m represents the mth positive and negative sampling, represents the mean of the abnormal scores of positive and negative sampling in round r, Represents the standard deviation of the anomaly scores of r rounds of positive and negative sampling.
[0020] At the same time, the present invention also implements a multi-view multi-scale graph anomaly detection system based on dynamic node screening, including a data acquisition module, an instance pair construction module, a comparison network model construction module, and a graph anomaly score calculation model training module; A data acquisition module acquires the original data of all nodes to form an original data set, and pre-processes the original data set to form an original view and a second view; The instance pair construction module builds a comparison network model, uses the RWR algorithm to perform subgraph sampling, builds instance pairs of different scales, and initializes the comparison network model; A contrast network model building module is used to build a contrast network model based on instance pairs of different scales and initialize the contrast network model. The graph anomaly score calculation module performs feature learning based on the subgraph sampled in step 2, constructs the feature matrix and self-connection matrix of the subgraph nodes, and inputs the feature matrix and adjacency matrix data of the nodes into the comparison network model for training to perform dynamic node screening. The obtained feature matrix and adjacency matrix data of the dynamic nodes are input into the comparison network model for training, and the final anomaly score of each node is calculated.
[0021] A terminal includes a processor and a storage medium; the characteristics are: the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of any method.
[0022] A computer-readable storage medium stores a computer program, which implements the steps of any method when executed by a processor.
[0023] The beneficial effects of the present invention are that, compared with the prior art, the present invention: improves the node embedding quality of graph anomaly detection (GAD) by sampling lightweight comparison instance pairs and adapts to large-scale graph data sets to capture richer information; optimizes the feature analysis of graph anomaly detection, starting from multi-view and multi-scale, significantly improves the accuracy and reliability of anomaly scores; introduces a dynamic node screening mechanism to improve training efficiency and reduce irrelevant data interference, further improving model performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a flow chart of a multi-view multi-scale graph anomaly detection method based on dynamic node screening in an embodiment of the present invention; Figure 2 This is the loss curve diagram for dynamic node screening training; Figure 3 It is a ROC curve diagram of the comparison network model in the embodiment of the present invention; DETAILED DESCRIPTION
[0025] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. The embodiments described in this application are only part of the embodiments of the present invention, not all of them. Based on the spirit of the present invention, other embodiments obtained by ordinary technicians in this field without creative work are all within the scope of protection of the present invention.
[0026] The present invention provides a multi-view multi-scale graph anomaly detection method based on dynamic node screening, such as Figure 1The flowchart of the multi-view multi-scale graph anomaly detection method based on dynamic node screening is shown, and the method includes the following steps: Step 1: Obtain the original data of all nodes to form an original data set, and preprocess the original data to form an original view and a second view.
[0027] In one embodiment of the present invention, in step 1, the original data includes nodes, node attributes and link relationships between nodes; the attributes of the nodes include the feature vectors of the nodes; the link relationships between nodes are presented in the form of an adjacency matrix, reflecting the interaction between the nodes.
[0028] In another embodiment of the present invention, in step 1, the original data set applied for paper retrieval is five widely used benchmark data sets for GAD, including three citation data sets of Cora, CiteSeer, and ACM, and two social network data sets of BlogCatalog and Flickr; the citation data sets are composed of scientific publications, in these networks, nodes represent published papers, and edges represent citation relationships between papers; in social network data sets, nodes represent users of the website, and edges represent relationships between users.
[0029] In one embodiment of the present invention, preprocessing the original data set to form the original view and the second view includes injecting structural anomalies and attribute anomalies into the original data set formed in step 1, forming the original view through edge perturbation and attribute perturbation; and forming the second view by performing edge perturbation on the formed original view through edge perturbation graph enhancement technology.
[0030] In this embodiment, the anomaly injection into the original data set includes structural anomaly injection and attribute anomaly injection. In order to balance the ratio of the two anomalies, the number of the two anomalies introduced is equal. For structural anomalies, m nodes (fixed to 15) are arbitrarily selected to make them fully connected, and the operation is repeated n times to obtain Structural abnormality node; for attribute abnormality, select any For each node, k nodes are selected (fixed as 50), the Euclidean distance between the node and the feature vectors of k nodes is calculated, and the node with the largest Euclidean distance replaces the original feature vector of the target node; the original data set and the number of injected anomalies are shown in Table 1.
[0031] Table 1 Original data set and number of injected anomalies Dataset Number of nodes Number of edges Number of features Number of exceptions Cora 2708 5429 1433 150 CiteSeer 3327 4732 3703 150 BlogCatalog 5196 171743 8189 300 Flickr 7575 239738 12407 450 ACM 16484 71980 8337 600 In one embodiment of the present invention, generating the second view by edge perturbation technology includes: setting a ratio K, randomly and uniformly deleting edge, and then The edges are randomly and uniformly added to the adjacency matrix, where M is the number of edges in the original view; the adjacency matrix is a binary square matrix used to represent a graph. The elements in the matrix are used to describe the connection relationship between the nodes in the graph, where 1 indicates that there is a connection between two nodes, and 0 indicates no connection.
[0032] Step 2: Use the RWR algorithm to sample sub-images of the original view and the second view respectively to construct instance pairs of different scales.
[0033] In one embodiment of the present invention, in step 2, the subgraph is a graph consisting of a portion of nodes selected from the original view or the second view and the edges corresponding to the nodes.
[0034] In one embodiment of the present invention, in step 2, constructing instance pairs of different scales includes constructing subgraph-node instance pairs, node-node instance pairs, and subgraph-subgraph instance pairs.
[0035] In one embodiment of the present invention, the RWR algorithm is used to perform subgraph sampling, and subgraph-node instance pairs and node-node instance pairs are constructed in each view, and subgraph-subgraph instance pairs are constructed between two views, wherein the subgraph is a part of the nodes and corresponding edges selected from the original view or the second view, representing the local structure of a node.
[0036] For a subgraph-node instance pair, the target node (The target node is every node in the graph, and the abnormal node is also included in the target node) forms a positive pair with its sampled subgraph, and with another random node in the graph The sampled subgraphs of constitute negative pairs, including: 1) GCN is used to learn potential features of the sub-graph. The formula is as follows: (1) in, Representation Node The self-join adjacency matrix of the subgraph, is the degree matrix, is the subgraph feature matrix, is the GCN weight parameter, Represents the latent feature matrix of the subgraph. The latent features are used as a new feature space representation to better represent the intrinsic structure and relationship of the data. Represents the activation function.
[0037] 2) Obtain the overall embedding of the subgraph through the Readout function. The formula is as follows: (2) in, is the number of subgraph nodes, j represents Each row vector index, Represents the final subgraph overall embedding representation.
[0038] 3) The target node Through MLP mapping to the same embedding space as the subgraph, the formula is as follows: (3) in, Indicates the target node The characteristic vector of Represents the weight parameters of shared GCN, Represents the embedding vector of the target node.
[0039] 4) Use a bilinear function to evaluate the consistency between the subgraph and the node embedding. The formula is as follows: (4) in, represents the weight parameter of the bilinear layer, represents a nonlinear activation function, Represents the consistency score between the subgraph and the target node.
[0040] 5) The loss function formula for subgraph-node comparison is as follows: (5) in, Indicates the node number, Indicates the total number of nodes, in the case of positive pairs, Equal to 1, in the case of a negative pair, is equal to 0.
[0041] 6) Repeat the above steps for the second view, and the final loss function of the two views is defined as: (6) in, To balance the parameters of the two views, represents the subgraph-node loss of the original view, Represents the subgraph-node loss of the second view.
[0042] In one embodiment of the present invention, for a node-node instance pair, the target node It is directly opposite to the embedding formed by the aggregation of other nodes in the subgraph, and The embeddings of other nodes in the subgraph centered on form negative pairs, including: 1) A new GCN is used for potential representation learning, the formula is as follows: (7) in, Representation Node The self-join adjacency matrix of the subgraph, represents the degree matrix, represents the subgraph feature matrix, represents the GCN weight parameter, represents the latent representation matrix of the subgraph, Represents the activation function.
[0043] The first vector Recorded as , is the embedding vector formed by the aggregation of other vectors in the subgraph.
[0044] 2) The target node Through MLP mapping to the same embedding space as the subgraph, the formula is as follows: (8) in, Indicates the target node The attribute vector of represents the weight parameters shared with GCN, Embedding vector representing the target node 3) Use bilinear scoring to evaluate consistency, the formula is as follows: (9) in, represents the weight parameter of the bilinear layer, is a nonlinear activation function, Represents the consistency score between the embedding and the target node aggregated from other vectors in the subgraph.
[0045] 4) The loss function formula for node-node instance pair is as follows: (10) in, Indicates the node number, Indicates the total number of nodes, in the case of positive pairs, Equal to 1, in the case of a negative pair, is equal to 0.
[0046] 5) Repeat the above steps for the second view. The final loss function of the two views is defined as: (11) in, represents the parameters that weigh the two views, represents the node-node loss of the original view, represents the node-node loss of the second view.
[0047] In one embodiment of the present invention, for a subgraph-subgraph instance pair, the target node The subgraph in the original view is aligned with the subgraph in the second view, and the target node Subgraph in original view with another node The sub-images located in two different views form negative pairs respectively.
[0048] The node-node pair loss function formula of the second view is as follows: (12) in, Indicates the node number, Indicates the total number of nodes, , Respectively represent nodes Sub-image embedding in two views after GCN layer, , Respectively represent nodes Sub-image embeddings in two views after GCN layers.
[0049] Combining the subgraph-node, node-node, and subgraph-subgraph loss functions, the final loss function formula for the comparison network model is as follows: (13) in, A parameter that represents the trade-off between subgraph-node comparison and node-node comparison, Parameters representing sub-graph-sub-graph comparisons.
[0050] Step 3: Construct a comparison network model based on the constructed instance pairs of different scales and initialize the comparison network model In one embodiment of the present invention, in step 3, the construction of the contrast network model includes: initializing the parameters of the contrast network model, including the restart probability of the random walk when initializing the sampling subgraph, the weight parameters of the GCN layer, the weight parameters of the bilinear scoring function, and the batch size of the learning rate; using the binary cross entropy function to construct the loss function of the contrast network model; the input of the contrast network model is the feature matrix and the adjacency matrix of the node, and the output is the abnormality score of each node; the network model includes a multi-scale contrast learning module and a dynamic node screening module; initializing the contrast network model includes the restart probability of the random walk when initializing the sampling subgraph, the weight parameters of the GCN layer, the weight parameters of the bilinear scoring function, and the batch size of the learning rate; the contrast learning model can be regarded as a binary classifier, and its goal is to determine the label of the instance pair, so the loss function adopts the binary cross entropy loss function; in order to balance the influence of each view and each instance pair on the final result, α is used as the hyperparameter between the two views in the loss function, β is used as the hyperparameter for node-subgraph and node-base point comparison, and γ is used as the hyperparameter for subgraph-subgraph comparison.
[0051] Step 4: Perform feature learning based on the subgraph sampled in step 2, construct the feature matrix and self-connection matrix of the subgraph nodes, and input the feature matrix and adjacency matrix of the nodes into the comparison network model obtained in step 3 for training to perform dynamic node screening. Input the feature matrix and adjacency matrix of the obtained dynamic nodes into the comparison network model for training, and calculate the final anomaly score of each node.
[0052] In one embodiment of the present invention, in step 4, the feature matrix and adjacency matrix data of the node are input into the comparison network model for training to perform dynamic node screening, the feature matrix and adjacency matrix data of the obtained dynamic node are input into the comparison network model for training, and the final abnormal score of each node is calculated, including: Step 4.1: Use all nodes to train the model and estimate the degree of abnormality of each node. Design a dynamic strategy to add the lowest value in the distribution of abnormal scores among all nodes as high-confidence points to the normal pool.
[0053] In one embodiment of the present invention, in step 4.1, all nodes are used to train the comparison network model, and the abnormality degree of each node is estimated according to the formula: (14) (15) in, represents the consistency score of the negative pair, represents the consistency score of the pair, and denote the anomaly scores of the original view and the enhanced view, respectively. Represents the anomaly score of the node-subgraph.
[0054] Similar to , and finally the rough anomaly score formula for each node is as follows: (16) in, To balance the parameters between node-subgraph instance pairs and node-node instance pairs, is the final abnormal score of each node, Represents the node-node anomaly score.
[0055] In one embodiment of the present invention, in step 3.1, the speed function formula of each step of the dynamic strategy is as follows: (17) Where n represents the total number of nodes. represents the number of trainings in the dynamic node screening phase, k represents the k-th step of training, represents the speed of the k-th step of the dynamic strategy. Nodes are added to the normal pool. In order to reduce the randomness of different strategies and improve the reliability of the abnormality of each node, the multi-step abnormality estimation is averaged in the normal pool. The formula is as follows: (18) in, Representation Node The number of times it is added to the normal pool, is the abnormal score for each time, k represents the k-th step of training, Represents the average of multi-step anomalies.
[0056] Finally, all the nodes calculated Arrange in descending order and select the K% lowest nodes as the model input for the second stage of training.
[0057] Step 4.2: Input the obtained feature matrix and adjacency matrix data of the dynamic nodes into the contrast network model for training.
[0058] Step 4.3: Use multiple rounds of positive and negative sampling strategies to calculate the final anomaly score of each node.
[0059] In one embodiment of the present invention, in step 4.3, calculating the final anomaly score of each node includes calculating the final anomaly score of the node according to the following formula: (19) (20) (twenty one) Among them, r represents the number of rounds of positive and negative sampling, k represents the kth round of positive and negative sampling, Representation Node The final anomaly score, m represents the mth positive and negative sampling, represents the mean of the abnormal scores of positive and negative sampling in round r, Represents the standard deviation of the anomaly scores of r rounds of positive and negative sampling.
[0060] In one embodiment of the present invention, the AUC index is used as a metric to evaluate the comparison network model; AUC is the lower line area of the ROC curve (Receiver Operating Characteristic Curve), which can represent the probability of selecting anomalies rather than normal samples in the samples with the highest anomaly scores. Take the Cora reference network dataset as an example, Figure 2 The figure shows the loss curve of the training with dynamic node screening. The first 200 rounds of training are dynamic node screening. It can be seen that after dynamic node screening, the loss value of the model drops rapidly. Take the Cora reference network dataset as an example. Figure 3 The ROC curve of the comparison network model is shown. The larger the area surrounded by the ROC curve, the better the performance of the comparison network model. The method proposed in the technical solution of the present invention is compared with the existing DOMINANT and CoLA methods. The AUC values of each method for five data sets are shown in Table 2. Since ACM is a large-scale data set, the reconstructed adjacency matrix characteristics of DOMINANT cannot be expanded, so no results can be obtained. It can be seen that the multi-view multi-scale graph anomaly detection method based on dynamic node screening has significantly improved the AUC values on each data set and can be applied to large-scale graph data sets.
[0061] Table 2 Comparison of AUC values of different methods method Cora Citeseer Blogcatalog Flickr ACM DOMINANT 0.8697 0.7901 0.6949 0.7072 - CoLA 0.8536 0.8535 0.7286 0.7240 0.8462 The present invention 0.9103 0.9290 0.7433 0.7330 0.9028 At the same time, the present invention also provides a multi-view multi-scale graph anomaly detection system based on dynamic node screening, including a data acquisition module, an instance pair construction module to compare the network model construction module and a graph anomaly score calculation module; A data acquisition module acquires the original data of all nodes to form an original data set, and pre-processes the original data set to form an original view and a second view; The instance pair construction module uses the RWR algorithm to sample sub-images of the original view and the second view respectively to construct instance pairs of different scales; A contrast network model building module is used to build a contrast network model based on instance pairs of different scales and initialize the contrast network model. The graph anomaly score calculation module performs feature learning based on the sampled subgraphs, constructs the feature matrix and self-connection matrix of the subgraph nodes, and inputs the feature matrix and adjacency matrix data of the nodes into the comparison network model for training to perform dynamic node screening. The obtained feature matrix and adjacency matrix data of the dynamic nodes are input into the comparison network model for training, and the final anomaly score of each node is calculated.
[0062] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0063] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the above. The computer-readable storage medium used herein is not to be interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0064] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0065] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of the computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit may execute the computer-readable program instructions, thereby implementing various aspects of the present disclosure.
[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents, and any modifications or equivalent replacements that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A multi-view multi-scale graph anomaly detection method based on dynamic node screening, characterized in that: The method comprises the following steps: Step 1: Obtain the original data of all nodes to form an original data set, and preprocess the original data set to form an original view and a second view; Step 2: Use the RWR algorithm to sample sub-images of the original view and the second view respectively to construct instance pairs of different scales; Step 3: Construct a comparison network model based on the constructed instance pairs of different scales, and initialize the comparison network model; Step 4: Perform feature learning based on the subgraph sampled in step 2, construct the feature matrix and self-connection matrix of the subgraph nodes, and input the feature matrix and adjacency matrix of the nodes into the comparison network model constructed in step 3 for training to perform dynamic node screening. Input the obtained feature matrix and adjacency matrix of the dynamic nodes into the comparison network model for training, and calculate the final anomaly score of each node.
2. According to claim 1, a multi-view multi-scale graph anomaly detection method based on dynamic node screening is characterized in that: In step 1, the original data includes nodes, node attributes, and link relationships between nodes; the attributes of the nodes include the feature vectors of the nodes; and the link relationships between nodes are presented in the form of an adjacency matrix.
3. A multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 1 or 2, characterized in that: In step 1, preprocessing the original data set to form the original view and the second view includes: Perform structural anomaly injection and attribute anomaly injection on the original data set constructed in step 1, and construct the original view through edge perturbation and attribute perturbation; The edge perturbation image enhancement technology is used to perform edge perturbation on the constructed original view to construct the second view.
4. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 1, characterized in that: In step 2, the subgraph is a graph consisting of a portion of nodes selected from the original view or the second view and the edges corresponding to the nodes.
5. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 1, characterized in that: In step 2, constructing instance pairs of different scales includes constructing subgraph-node instance pairs, node-node instance pairs, and subgraph-subgraph instance pairs.
6. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 5, characterized in that: Constructing a subgraph-node instance includes constructing a loss function for subgraph-node comparison according to the following formula: : , in, Indicates the node number, Indicates the total number of nodes, represents the consistency score between the subgraph and the target node, In the case of subgraph-node pairs, labels and pairs are represented. Equal to 1, in the case of a negative pair, is equal to 0.
7. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 5, characterized in that: Constructing node-node instance pairs includes constructing the node-node comparison loss function according to the following formula : , in, Indicates the node number, Indicates the total number of nodes, represents the consistency score between the embedding and the target node formed by the aggregation of other vectors in the subgraph, represents the node-node instance pair label, when the instance pair is Equal to 1, negative instance pair, is equal to 0.
8. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 4, characterized in that: Constructing a subgraph-subgraph instance pair includes constructing a loss function for the subgraph-subgraph instance pair according to the following formula: : , in, Indicates the node number, Indicates the total number of nodes, , Respectively represent nodes Sub-image embedding in the original view and the second view, , Respectively represent nodes Sub-image embedding in the original view and the second view.
9. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 1, characterized in that: In step 3, the construction of the comparison network model includes: Initialize the parameters of the comparison network model, including the restart probability of random walk when initializing the sampling subgraph, the weight parameter of the GCN layer, the weight parameter of the bilinear scoring function, and the learning rate batch size; The binary cross entropy function is used to construct the loss function of the contrastive network model.
10. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 1, characterized in that: In step 4, the feature matrix and adjacency matrix data of the node are input into the comparison network model for training to perform dynamic node screening, and the feature matrix and adjacency matrix data of the obtained dynamic node are input into the comparison network model for training. The final abnormal score of each node is calculated including: Step 4.1: Use all nodes to train the model and estimate the degree of abnormality of each node. Design a dynamic strategy to add the node with the lowest value in the distribution of abnormal scores among all nodes as a high-confidence node to the normal pool; Step 4.2: Input the obtained feature matrix and adjacency matrix data of the dynamic nodes into the contrast network model for training; Step 4.3: Use multiple rounds of positive and negative sampling strategies to calculate the final anomaly score of each node.
11. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 10, characterized in that: In step 4.1, the abnormality degree of each node is estimated according to the following formula: , in, Representation Node The abnormality index, represents the consistency score of the negative pair, represents the consistency score of the pair, represents a positive instance pair, and n represents a negative instance pair.
12. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 10, characterized in that: In step 4.1, the design formula of the dynamic strategy is as follows: , in, represents the speed of the k-th step of the dynamic strategy, Indicates the total number of nodes, represents the number of trainings in the selection phase, and k represents the number of trainings.
13. The multi-view multi-scale graph anomaly detection method based on dynamic node screening according to claim 10, characterized in that: In step 4.3, multiple rounds of positive and negative sampling strategies are used to calculate the final anomaly score of each node, including calculating the final anomaly score of the node according to the following formula: , , , in, Indicates the number of rounds of positive and negative sampling, Representation Node The final anomaly score, m represents the mth positive and negative sampling, represents the mean of the abnormal scores of positive and negative sampling in round r, Represents the standard deviation of the anomaly scores of r rounds of positive and negative sampling.
14. A multi-view multi-scale graph anomaly detection system based on dynamic node screening using the method of any one of claims 1 to 13, comprising a data acquisition module, an instance pair construction module, a comparison network model construction module and a graph anomaly score calculation model training module, characterized in that: A data acquisition module acquires the original data of all nodes to form an original data set, and pre-processes the original data set to form an original view and a second view; The instance pair construction module builds a comparison network model, uses the RWR algorithm to perform subgraph sampling, builds instance pairs of different scales, and initializes the comparison network model; A contrast network model building module is used to build a contrast network model based on instance pairs of different scales and initialize the contrast network model. The graph anomaly score calculation module performs feature learning based on the subgraph sampled in step 2, constructs the feature matrix and self-connection matrix of the subgraph nodes, and inputs the feature matrix and adjacency matrix data of the nodes into the comparison network model for training to perform dynamic node screening. The obtained feature matrix and adjacency matrix data of the dynamic nodes are input into the comparison network model for training, and the final anomaly score of each node is calculated.
15. A terminal comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1-13.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
Citation Information
Patent Citations
Network node full-granularity anomaly detection method and system based on attribute enhanced sampling
CN118074958A
Method and apparatus for anomaly detection on graph
WO2023010502A1
