A privacy-preserving graph anomaly detection method, system, device, and medium

The method addresses unbalanced data distribution and privacy concerns in graph anomaly detection by reconstructing neighbor nodes and using multi-scale contrastive learning in a federated environment, achieving effective anomaly detection across multiple data centers.

CN119004347BActive Publication Date: 2025-01-03HANGZHOU MIND MEDICAL ALLIANCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411473588.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-01-03
Estimated Expiration
2044-10-22

AI Technical Summary

Technical Problem

Existing graph anomaly detection methods face challenges in detecting anomalies across unbalanced data distributions and privacy issues in federated environments, leading to suboptimal performance and overfitting due to limited negative sample collection.

Method used

A privacy-preserving graph anomaly detection method utilizing multi-scale contrastive learning in a federated environment, reconstructing neighbor nodes with linear models, and constructing structure-level and context-level contrast networks to capture anomalies, ensuring data privacy and optimizing node embeddings.

Benefits of technology

Solves the problem of unbalanced data distribution and ensures data privacy by reconstructing neighbor nodes, capturing structural and attribute anomalies, and generating a global model for effective anomaly detection across multiple data centers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119004347B_ABST
    Figure CN119004347B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of anomaly detection technology, and discloses a privacy-protection-oriented graph anomaly detection method, system, device and medium. The present application constructs a graph anomaly detection method based on a federated environment, solves the problem of unbalanced data distribution, can collaborate in multiple data centers, and reduces the risk of overfitting; the present application reconstructs the neighbor nodes of graph data in a federated environment, optimizes node embedding, predicts the number and attributes of neighbor nodes, and achieves data privacy protection while solving the problem of missing data when aggregating neighbor information across different clients, so that the connection information between nodes is complete and has stronger applicability; the present application performs multi-scale comparative learning on the graph data after reconstructing the neighbor nodes, further develops subgraph information, captures information embedding from high-dimensional attributes and local structures, and obtains graph anomaly results when the graph data distribution is unbalanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of anomaly detection technology, and in particular to a privacy-preserving graph anomaly detection method, system, device and medium. Background Art

[0002] Graph anomalies often appear behind malicious behaviors in graph neural networks, such as rumor propagation, financial fraud, network intrusion, malware development, etc. In real-world scenarios, anomalies are widespread and destructive, but difficult to detect, and it is crucial to accurately detect these abnormal nodes or edges to protect the network from unexpected damage.

[0003] Existing graph anomaly detection methods are mainly divided into methods based on auto-encoding and contrastive learning techniques. For example, DOMINANT integrates graph convolutional networks (GCNs) and autoencoders to reconstruct topological structures and node attributes. Similarly, ALARM uses multi-graph neural networks (GNNs) to encode attribute networks and handle multi-view attribute scenarios. However, this approach often leads to suboptimal results when abnormal samples deviate significantly from normal samples. Because subgraph data located on different clients often show unbalanced data distribution, and real-world abnormal samples often exhibit sparsity, there is a potential risk of overfitting in existing anomaly detection methods based on contrastive learning.

[0004] Contrastive learning methods have emerged as a new learning paradigm that can acquire knowledge about abnormal patterns by comparing graph samples. A typical example of contrastive learning for graph anomaly detection is CoLA, which obtains local information from network data by sampling node-node comparison pairs.

[0005] ANEMONE introduces multi-scale contrastive learning to capture the distribution of patterns in graph data. However, existing graph anomaly detection methods ignore data privacy issues and are built on the assumption that a large graph is fully observable, but subgraphs of a large graph are usually distributed in different data centers.

[0006] However, directly applying existing contrastive learning methods to federated environments may lead to limited negative sample collection, thus missing the diversity of negative samples from other clients, resulting in poor performance of current methods.

[0007] Based on the above situation, it is urgent to develop a privacy-preserving graph anomaly detection method to solve these problems. Summary of the invention

[0008] In order to solve the above technical problems, the present invention provides a privacy-preserving graph anomaly detection method, system, device and medium, which realizes the purpose of collaborative detection of multiple data centers based on a federal environment, solves the problem of unbalanced data distribution, and ensures the integrity of connection information between neighbor nodes across different clients by inferring neighbor information. Multi-scale contrastive learning including structure level and context level is used to detect graph anomalies in the case of unbalanced graph data distribution.

[0009] In a first aspect, a first object of the present invention is to provide a privacy protection-oriented graph anomaly detection method, comprising the following steps:

[0010] S1. Based on the federated learning distributed network, different graph data samples are set on different clients;

[0011] S2, using the first linear model and the second linear model to reconstruct neighbors for the graph data samples set by each client; the first linear model is used to predict the number of neighbor nodes of each node in the graph data sample, and the second linear model is used to predict the neighbor node features of each node in the graph data sample;

[0012] S3, capturing structural anomalies and attribute anomalies based on the graph data samples reconstructed by neighbors and calculating anomaly scores respectively; wherein, structural anomalies are captured by constructing a structure-level contrast network, and attribute anomalies are captured by constructing a context-level contrast network;

[0013] S4, uploading the global parameters of each client to the server for parameter aggregation and then sending them to each client for multiple rounds of training until the loss of the structure-level contrast network and the context-level contrast network is minimized, and a global model is generated on the server;

[0014] S5. Input the image data to be tested into the server, perform multiple rounds of calculations in the global model of the server to obtain anomaly scores, obtain a total anomaly score based on the anomaly scores of each round, and obtain a detection result of the image data to be tested based on the total anomaly score.

[0015] Furthermore, capturing structural anomalies by constructing a structural level comparison network includes:

[0016] The random walk algorithm is used to sample the k-order neighbor nodes of the target node to form the first self-network centered on the target node;

[0017] The target node is calculated by MLP to obtain a first embedding output of the target node;

[0018] Mask the target node, project the masked first ego network into a low-dimensional space and calculate the second embedding output using the GNN model;

[0019] The structural anomaly score is calculated according to the first embedding output and the second embedding output; wherein k is a natural number not equal to 0.

[0020] Furthermore, capturing the anomaly on the attribute by constructing a context-level comparison network includes:

[0021] A random walk algorithm is used to sample k-order connected nodes of the target node to form a second self-network centered on the target node;

[0022] Mask the target node, project the masked second ego network into a low-dimensional space, and calculate the third embedding output using the GNN model and the Readout function;

[0023] Calculate an anomaly score on the attribute based on the first embedding output and the third embedding output.

[0024] Further, the anomaly score is obtained by subtracting the positive score from the negative score;

[0025] Positive sample pairs and negative sample pairs are constructed respectively, and the positive scores and negative scores are calculated by a discriminator, and the discriminator uses a bilinear function for calculation.

[0026] Further, the S5 includes:

[0027] The structural anomaly score obtained in each round is used to calculate the structural anomaly standard deviation, and the attribute anomaly score obtained in each round is used to calculate the attribute anomaly standard deviation;

[0028] The total anomaly score is calculated based on the anomaly standard deviation on the structure and the anomaly standard deviation on the attribute.

[0029] Furthermore, S5 further includes: if the total abnormal score is greater than or equal to a preset value, the image data to be tested is normal; if the total abnormal score is less than the preset value, the image data to be tested is abnormal.

[0030] In a second aspect, a second object of the present invention is to provide a privacy-preserving graph anomaly detection system, comprising:

[0031] Federated environment construction module: Based on the federated learning distributed network, different graph data samples are set on different clients; and the first linear model and the second linear model are used to reconstruct the neighbors of the graph data samples set on each client; the first linear model is used to predict the number of neighbor nodes of each node in the graph data sample, and the second linear model is used to predict the neighbor node characteristics of each node in the graph data sample;

[0032] Multi-scale contrastive learning module: connected to the federated environment construction module, used to capture structural anomalies and attribute anomalies based on the graph data samples reconstructed by neighbors and calculate the anomaly scores respectively; structural anomalies are captured by building a structure-level contrast network, and attribute anomalies are captured by building a context-level contrast network; the global parameters of each client are uploaded to the server for parameter aggregation and then sent to each client for multiple rounds of training until the loss of the structure-level contrast network and the context-level contrast network is minimized, and a global model is generated on the server;

[0033] Output module: connected to the multi-scale contrast learning module, used to input the image data to be tested into the server, perform multiple rounds of calculations in the global model of the server to obtain anomaly scores, calculate the total anomaly score based on the anomaly scores of each round, and calculate the detection result of the image data to be tested based on the total anomaly score.

[0034] In a third aspect, a third object of the present invention is to provide an electronic device, comprising a processor and a memory; the processor is used to execute the steps of the method described in the first aspect by calling a program or instruction stored in the memory.

[0035] In a fourth aspect, a fourth object of the present invention is to provide a computer-readable storage medium, wherein the computer-readable storage medium stores a program or instruction, wherein the program or instruction enables a computer to execute the steps of the method described in the first aspect.

[0036] The embodiments of the present invention have the following technical effects:

[0037] This application builds a graph anomaly detection method based on a federated environment, which solves the problem of unbalanced data distribution, can collaborate across multiple data centers, and reduces the risk of overfitting;

[0038] This application reconstructs the neighbor nodes of graph data in a federated environment, optimizes node embedding, and predicts the number and attributes of neighbor nodes, thereby protecting data privacy and solving the problem of missing data when aggregating neighbor information across different clients, making the connection information between nodes complete and more applicable.

[0039] This application performs multi-scale comparative learning on the graph data after reconstructing neighbor nodes, further develops subgraph information, captures information embedding from high-dimensional attributes and local structures, and obtains graph anomaly results when the graph data distribution is unbalanced. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 is a flowchart of a privacy protection-oriented graph anomaly detection method provided by an embodiment of the present invention;

[0042] Figure 2 It is a framework diagram of a privacy-preserving graph anomaly detection method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0044] Example 1

[0045] Figure 1 is a flowchart of a privacy-preserving graph anomaly detection method provided by an embodiment of the present invention. Figure 1 , specifically including:

[0046] S1. Based on the federated learning distributed network, different graph data samples are set on different clients.

[0047] First, prepare a federated environment, which includes multiple clients and stores different data on each client.

[0048] Graph sample data can be distributed across different clients, that is, different clients input different graph data, so that subsequent training can be performed in batches to obtain the optimal model.

[0049] S2. Use the first linear model and the second linear model to reconstruct neighbors for the graph data samples set by each client respectively; the first linear model is used to predict the number of neighbor nodes for each node in the graph data sample, and the second linear model is used to predict the neighbor node characteristics of each node in the graph data sample.

[0050] For each client, two linear regression models are used to reconstruct neighbor nodes, that is, to reconstruct missing neighbors. In the figure, nodes are the basic range of data and can represent various entities or abstract concepts. Adjacent nodes indicate that there is an edge between the two nodes, while non-adjacent nodes indicate that there is no edge between the two nodes. An edge indicates a close relationship. Neighbor node reconstruction is to infer the similar nodes near the node, so that the connection information between the nodes is complete and has stronger applicability. For more information, please refer to Figure 2 .

[0051] The first linear model is used to predict the number of neighbor nodes, expressed as ,use Parameterized, the calculation formula is:

[0052] ,

[0053] in, is the predicted value of the number of neighbor nodes, is the activation function, is the number of first-order neighbors at node v; for convenience, To express the following formula.

[0054] The second linear model is used to predict the characteristics of neighbor nodes. Denote the corresponding feature learner, and use Parameterized, the calculation formula is:

[0055] ;

[0056] in, is the predicted value of neighbor node features, is a Gaussian noise generator, is the characterization vector at node v; similarly, for convenience, we use Indicates the following formula.

[0057] Furthermore, the parameters of the two linear models can be optimized in the following way:

[0058] Given a client mask map The above two models are optimized for overall neighbor repair, where: represents a node set, represents a randomly selected set of edges, i.e., the edges connecting the nodes, Represents the neighbor node feature set, the formula to be optimized It is expressed as follows:

[0059] ;

[0060] in, and Respectively and The prediction loss is and This application uses the smooth L1 loss function to calculate the predicted value of the number of neighbor nodes. And the actual value of the number of neighbor nodes The distance between them is calculated using the L2 loss function to generate the predicted value of the neighbor node feature. The true value of the neighbor node feature The difference between them can be expressed as:

[0061] ,

[0062] ,

[0063] in, express The number of nodes, Representation Node The neighbor nodes at .

[0064] After the above optimization, we get and The minimum value of , construct two linear models for parameter update, that is, and By updating, we can obtain the graph data samples after the optimal neighbor reconstruction.

[0065] S3. Capture structural anomalies and attribute anomalies based on the graph data samples reconstructed by neighbors and calculate the anomaly scores respectively; wherein, the structural anomalies are captured by constructing a structure-level contrast network, and the attribute anomalies are captured by constructing a context-level contrast network.

[0066] For each client, use the self-supervised contrastive learning model To capture the image information related to the anomaly. The anomaly of the image often includes two aspects: structural anomaly and attribute anomaly. In this application, a structure-level comparison network and a superior-subordinate comparison network are set up to capture them respectively.

[0067] First, make the following instructions:

[0068] By using the random walk algorithm as a data augmentation strategy, we select the sample pairs of the above two aspects and obtain 'node vs. node' and 'node vs. self-graph', see Figure 2 , if the target node is , sample two ego networks with step size k, which consist of nodes The sampled k-order neighbors are composed of neighbors within the range of k hops. Specifically, a node is determined as the target node. For the structural contrast network, k-order nodes around the target node are randomly selected to form the first self-network with the target node; and for the superior-subordinate contrast network, k-order nodes with connection relationships around the target node are randomly selected to form the second self-network with the target node. The connection relationship here is connected edges. Among them, the first self-network and the second self-network are used as source data in structural contrast learning and context-level contrast learning respectively; obviously, the target node is the central node in the node set; among them, k is a natural number other than 0. It should be noted that the self-graph refers to the second self-network that does not include the target node.

[0069] Project the target node into a low-dimensional embedding space, that is, transform it into a low-dimensional space through a mapping relationship. Use a multi-layer perceptron (MLP) layer to calculate the target node. The first embedding output is:

[0070] ,

[0071] Where w represents the learnable parameter, and the superscript Indicates the number of layers, target node The final embedding output is , the following will use Instead of indicating.

[0072] (1) Structural-level contrast network

[0073] The random walk algorithm is used to sample the k-order neighbor nodes of the target node to form the first self-network centered on the target node;

[0074] The target node is calculated by MLP to obtain a first embedding output of the target node;

[0075] Mask the target node, project the masked first ego network into a low-dimensional space and calculate the second embedding output using the GNN model;

[0076] The structural anomaly score is calculated according to the first embedding output and the second embedding output; wherein k is a natural number not equal to 0.

[0077] Specifically, the target node The initial node feature of is set to zero vector, that is, the target node is masked, and then the mask is obtained based on the GNN (Graph Neural Network) model. The second embedding output of the node, the output at this time is .

[0078] The weights of GNN Shared with the previous MLP weights to ensure and Projected into a unified embedding space.

[0079] Positive and negative sample pairs are constructed to capture structural abnormal information, and the positive and negative scores are calculated respectively through the discriminator, where the discriminator uses a bilinear function for calculation.

[0080] The sample pair consists of the source data and the target node. For the structure-level contrast network, the sample pair consists of the first self-network and the target node. The positive sample pair requires that the source data (node ​​or subnetwork) is a neighbor of the target node, while the negative sample pair requires that the source data is not a neighbor of the target node.

[0081] A bilinear function is used to calculate the strength of the relationship between positive sample pairs, that is, the positive score , positive score It is used to represent the consistency score of the positive sample pair, which can be expressed as:

[0082] ,

[0083] in, are the trainable parameters of the discriminator, It is a logistic sigmoid type function, and s is used as a superscript in this application to represent the parameters in the structure-level contrast network.

[0084] A bilinear function is used to calculate the strength of the relationship between negative sample pairs, that is, the negative score , which can be expressed as:

[0085] ,

[0086] Among them, e j Indicates other nodes The representation vector of .

[0087] Calculate the difference between positive and negative scores to get the anomaly score :

[0088] ,

[0089] in, The contrastive network is trained using the Jensen-Shannon divergence objective, with the objective function L s for:

[0090] ,

[0091] Here, n is the number of positive or negative sample pairs.

[0092] (2) Context-level contrastive network.

[0093] A random walk algorithm is used to sample k-order connected nodes of the target node to form a second self-network centered on the target node;

[0094] Mask the target node, project the masked second ego network into a low-dimensional space, and calculate the third embedding output using the GNN model and the Readout function;

[0095] Calculate an anomaly score on the attribute based on the first embedding output and the third embedding output.

[0096] Specifically, the same target node in the structure-level contrast network is input into the context-level contrast network. The main difference between the context-level contrast network and the structure-level contrast network is that the source data is embedded in different ways; specifically, the structure-level contrast network is the self-network embedding obtained by masking the target node, while the third self-network embedding constructed in the context-level contrast network is obtained by the following formula, that is, the second self-network is obtained after passing through the GNN and then processed by the Readout function. Here, the parameters of the GNN are set to :

[0097] ,

[0098] in, is the embedding of the second self network, is the vector obtained by processing the embedding output of the second ego network through the Readout function, where k is the k-order neighbor.

[0099] The calculation of positive scores is similar to that in the structure-level contrast network, while the calculation of negative scores is similar to that in the structure-level contrast network. The calculation of is as follows:

[0100] ,

[0101] in, Non-target node The self-network embedding composed of its surrounding neighbor nodes, in this application, c is used as a superscript to represent the relevant parameters in the context-level contrast network.

[0102] Calculate the difference between the positive and negative scores to get the anomaly score :

[0103] ,

[0104] in, The Jensen-Shannon divergence objective is also used to train the contrast network, and the objective function Lc for:

[0105]

[0106] In summary, the objective function of the final graph anomaly detection is set as:

[0107] ,

[0108] in, and denote the contrastive learning objective functions at the structure level and the context level, respectively; is a balance parameter with a value range of [0, 1]. The setting of the objective function realizes the optimization of node embedding in this application.

[0109] S4. Upload the global parameters of each client to the server for parameter aggregation and then send them to each client for multiple rounds of training until the loss of the structure-level contrast network and the context-level contrast network is minimized, and a global model is generated on the server.

[0110] In the federated learning framework, the parameters of each client are updated. Specifically, the server S first sends the initial parameters of the network to each client, and then loads these parameters into the local model. Each client updates the parameters in each round. In federated learning, each client has a parameter set in round p. The formula aggregation is as follows:

[0111] ;

[0112] Among them, L is the objective function of contrastive learning, is the learning rate, represents the number of sample pairs in round p, Represents the global parameters of the p-1th round. The global parameters refer to , , and , Indicates the gradient. The gradient is updated according to the following formula:

[0113] ;

[0114] Finally, the server calculates The global parameter with the smallest time, and the one obtained in this round The model is broadcast to all clients, and the server generates a global model, which is a fusion of the local training results of each client. The client only needs to send the training results (such as model parameters or gradients) to the server instead of the entire model or original data. The clients can jointly improve the model performance without sharing the original data.

[0115] S5. Input the image data to be tested into the server, perform multiple rounds of calculations in the global model of the server to obtain anomaly scores, obtain a total anomaly score based on the anomaly scores of each round, and obtain a detection result of the image data to be tested based on the total anomaly score.

[0116] The server in federated learning stores the models of each client and the final model parameters, and generates a total score based on the anomaly scores obtained from multiple rounds of calculations.

[0117] Specifically, the positive and negative scores of the structure-level contrast network and the positive and negative scores of the context-level contrast network are obtained respectively: , , , , through multiple rounds of sampling, the anomaly score of each round can be obtained for:

[0118]

[0119] Here, view represents c or s. .

[0120] Calculate the standard deviation of the anomaly score on structural anomalies and attribute anomalies separately:

[0121] ,

[0122] ,

[0123] in, is the mean of the anomaly scores of each round on structural anomalies or attribute anomalies, and the standard deviation is calculated using the mean. and Calculate the final total score:

[0124] ,

[0125] Among them, m is a hyperparameter with a value range of [0, 1]. After obtaining the total anomaly score, the abnormal nodes and normal nodes are divided according to the proportion n% of data anomalies. For example, if the total anomaly score is greater than or equal to n%, the graph data is normal; if the total anomaly score is less than n%, the graph data is abnormal, and the detection result of the graph anomaly can be obtained.

[0126] It should be noted that the graph data to be tested and the graph data samples do not overlap. The anomaly detection of each graph must go through the above training process. The graph data samples are on the client side, and the graph data to be tested is on the server side. During the detection, the anomaly score can be uniformly obtained on the server side.

[0127] In summary, the purpose of collaborative detection among multiple data centers is achieved based on the federated environment, the problem of unbalanced data distribution is solved, and the integrity of connection information between neighbor nodes across different clients is guaranteed by inferring neighbor information. Multi-scale contrastive learning including structure level and context level is used to detect graph anomalies when graph data distribution is unbalanced.

[0128] Example 2

[0129] Based on Example 1, the present application provides a privacy protection-oriented graph anomaly detection system, including:

[0130] Federated environment construction module: Based on the federated learning distributed network, different graph data samples are set on different clients; and the first linear model and the second linear model are used to reconstruct the neighbors of the graph data samples set on each client; the first linear model is used to predict the number of neighbor nodes of each node in the graph data sample, and the second linear model is used to predict the neighbor node characteristics of each node in the graph data sample;

[0131] Multi-scale contrastive learning module: connected to the federated environment construction module, used to capture structural anomalies and attribute anomalies based on the graph data samples reconstructed by neighbors and calculate the anomaly scores respectively; structural anomalies are captured by building a structure-level contrast network, and attribute anomalies are captured by building a context-level contrast network; the global parameters of each client are uploaded to the server for parameter aggregation and then sent to each client for multiple rounds of training until the loss of the structure-level contrast network and the context-level contrast network is minimized, and a global model is generated on the server;

[0132] Output module: connected to the multi-scale contrast learning module, used to input the image data to be tested into the server, perform multiple rounds of calculations in the global model of the server to obtain anomaly scores, calculate the total anomaly score based on the anomaly scores of each round, and calculate the detection result of the image data to be tested based on the total anomaly score.

[0133] For other contents, please refer to Example 1, which will not be described in detail here.

[0134] Example 3

[0135] Based on the content of Example 1, the present application provides an electronic device, which includes: a processor and a memory; the processor is used to execute the steps of the method in Example 1 by calling a program or instruction stored in the memory.

[0136] The processor may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.

[0137] The memory may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on a computer-readable storage medium, and the processor may run the program instructions to implement a system security startup method and / or other desired functions of any embodiment of the present application described above. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.

[0138] Example 4

[0139] Based on the content of Example 1, the present application provides a computer-readable medium, where the computer-readable storage medium stores programs or instructions, and the programs or instructions enable a computer to execute the steps of the method in Example 1.

[0140] In addition to the aforementioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of a privacy-preserving graph anomaly detection method provided in any embodiment of the present application.

[0141] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0142] Computer readable storage media can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0143] It should be noted that the terms used in the present invention are only for describing specific embodiments, rather than limiting the scope of the present application. As shown in the present specification, unless the context clearly indicates an exception, the words "one", "a", "a kind of" and / or "the" do not specifically refer to the singular, but may also include the plural. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method or device. In the absence of more restrictions, the elements defined by the sentence "include one..." do not exclude the presence of other identical elements in the process, method or device including the elements.

[0144] 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 aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.

Claims

1. A privacy-preserving graph anomaly detection method, characterized in that: The steps include: S1. Based on the federated learning distributed network, different graph data samples are set on different clients; S2, using the first linear model and the second linear model to reconstruct neighbors for the graph data samples set by each client; The first linear model is used to predict the number of neighbor nodes of each node in the graph data sample, and the second linear model is used to predict the neighbor node features of each node in the graph data sample; S3, capturing structural anomalies and attribute anomalies based on the graph data samples reconstructed by neighbors and calculating anomaly scores respectively; wherein, structural anomalies are captured by constructing a structure-level contrast network, and attribute anomalies are captured by constructing a context-level contrast network; S4, uploading the global parameters of each client to the server for parameter aggregation and then sending them to each client for multiple rounds of training until the loss of the structure-level contrast network and the context-level contrast network is minimized, and a global model is generated on the server; S5, inputting the image data to be tested into the server, performing multiple rounds of calculations in the global model of the server to obtain anomaly scores, obtaining a total anomaly score according to the anomaly scores of each round, and obtaining a detection result of the image data to be tested according to the total anomaly score; The capturing of structural anomalies by constructing a structural level comparison network includes: The random walk algorithm is used to sample the k-order neighbor nodes of the target node to form the first self-network centered on the target node; k is a natural number not equal to 0; The target node is calculated by MLP to obtain a first embedding output of the target node; Mask the target node, project the masked first ego network into a low-dimensional space and calculate the second embedding output using the GNN model; Calculating a structural anomaly score based on the first embedding output and the second embedding output; The method of capturing anomalies on attributes by building a context-level comparison network includes: A random walk algorithm is used to sample k-order connected nodes of the target node to form a second self-network centered on the target node; Mask the target node, project the masked second ego network into a low-dimensional space, and calculate the third embedding output using the GNN model and the Readout function; Calculate an anomaly score on the attribute based on the first embedding output and the third embedding output.

2. The privacy-preserving graph anomaly detection method according to claim 1, characterized in that: The anomaly score is obtained by subtracting the positive score from the negative score; Positive sample pairs and negative sample pairs are constructed respectively, and the positive scores and negative scores are calculated by a discriminator, and the discriminator uses a bilinear function for calculation.

3. The privacy-preserving graph anomaly detection method according to claim 1, characterized in that: The S5 includes: The structural anomaly score obtained in each round is used to calculate the structural anomaly standard deviation, and the attribute anomaly score obtained in each round is used to calculate the attribute anomaly standard deviation; The total anomaly score is calculated based on the anomaly standard deviation on the structure and the anomaly standard deviation on the attribute.

4. The privacy-preserving graph anomaly detection method according to claim 1, characterized in that: The S5 further includes: if the total abnormal score is greater than or equal to a preset value, the image data to be tested is normal; if the total abnormal score is less than the preset value, the image data to be tested is abnormal.

5. A privacy-preserving graph anomaly detection system, used to implement the steps of a privacy-preserving graph anomaly detection method as claimed in any one of claims 1 to 4, characterized in that: include: Federated environment building module: Based on the federated learning distributed network, different graph data samples are set on different clients; and using the first linear model and the second linear model to respectively reconstruct neighbors for the graph data samples set by each client; The first linear model is used to predict the number of neighbor nodes of each node in the graph data sample, and the second linear model is used to predict the neighbor node features of each node in the graph data sample; Multi-scale contrastive learning module: connected to the federated environment construction module, used to capture structural anomalies and attribute anomalies based on the graph data samples reconstructed by neighbors and calculate the anomaly scores respectively; structural anomalies are captured by building a structure-level contrast network, and attribute anomalies are captured by building a context-level contrast network; the global parameters of each client are uploaded to the server for parameter aggregation and then sent to each client for multiple rounds of training until the loss of the structure-level contrast network and the context-level contrast network is minimized, and a global model is generated on the server; Output module: connected to the multi-scale contrast learning module, used to input the image data to be tested into the server, perform multiple rounds of calculations in the global model of the server to obtain anomaly scores, calculate the total anomaly score based on the anomaly scores of each round, and calculate the detection result of the image data to be tested based on the total anomaly score.

6. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is used to execute the steps of the method according to any one of claims 1 to 4 by calling the program or instruction stored in the memory.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute the steps of the method according to any one of claims 1 to 4.