Graph neural network training method and system and community relation graph structure generation method and system

By using the loss function of graph signal energy constant in graph neural network training, the graph signal transmission is optimized, and the problem of poor training effect of graph convolutional neural network is solved, and the prediction ability and performance of the model are improved.

CN119227732APending Publication Date: 2024-12-31CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411365976.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

During the training process of existing graph convolutional neural networks, the prediction results of graph structure samples match the labels poorly, resulting in poor network performance.

Method used

A graph neural network training method is adopted to train the graph neural network by obtaining graph structure samples and preset loss functions, especially the loss function used to maintain the energy of graph signals invariant, and optimize the graph signal transmission process of hidden layers. , improve the prediction ability of the model.

Benefits of technology

By optimizing the loss function, the graph neural network can learn and predict graph structure data more accurately, improving the training effect and performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227732A_ABST
    Figure CN119227732A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a graph neural network training method and system and a community relation graph structure generation method and system, and relates to the technical field of computers. The method comprises the following steps: acquiring a graph structure sample; obtaining a preset first loss function, wherein the first loss function is used for keeping energy among graph signals of a plurality of hidden layers input into the graph neural network unchanged; and training the graph neural network by using the graph structure sample and the first loss function to obtain a trained graph neural network. The method improves the training effect of the graph neural network model through the optimized loss function used for keeping the energy between the graph signals input into the plurality of hidden layers of the graph neural network unchanged, so that the model can learn and predict more accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and system for training a graph neural network and generating a community relationship graph structure. Background Art

[0002] Graph Convolution Neural Networks (GCN) is a deep learning model specifically designed for processing graph data. This model updates node representations by aggregating information from adjacent nodes, thereby extracting and exploring features and patterns in graph data. The core idea of ​​Graph Convolution Networks is to use the structural information of the graph to update the representation of each node by aggregating information from adjacent nodes, thereby achieving deep learning processing of graph data. The basic components of Graph Convolution Networks include node feature matrix, adjacency matrix, degree matrix, and multiple graph convolutional layers. The graph convolution operation of each layer is essentially to aggregate the information of neighboring nodes of each node, and then update it through linear transformation and nonlinear activation function. This process is repeated in each layer until the preset number of layers is reached, thereby obtaining the final node representation. Graph Convolution Neural Networks Graph Convolution Neural Networks have the following properties: hierarchical structure properties (features are extracted layer by layer, and deep features are more abstract and advanced than shallow features), nonlinear properties (increasing the expressive power of graph convolutional neural networks), and end-to-end training properties.

[0003] Graph convolutional neural networks are divided into two categories: spectral domain-based graph convolutional neural networks and spatial domain-based graph convolutional neural networks. Spectral domain-based graph convolutional neural networks define graph convolution by introducing filters from the perspective of graph signal processing, where the graph convolution operation is interpreted as removing noise from the graph signal. Spatial domain-based methods represent graph convolution as aggregating feature information from neighbors.

[0004] The training of graph convolutional neural networks is usually based on graph structure samples. The prediction results obtained after calling the graph convolutional neural network are combined with the prediction results and the sample labels carried by the graph structure samples to train the graph neural network. This conventional training method results in poor training results for the graph neural network, that is, the network performance of the trained graph neural network is poor. Summary of the invention

[0005] In order to solve the above technical problems or at least partially solve the above technical problems, an embodiment of the present invention provides a method and system for training a graph neural network and generating a community relationship graph structure.

[0006] In a first aspect, an embodiment of the present invention provides a method for training a graph neural network, wherein the graph neural network includes an input layer, multiple hidden layers, and an output layer; the method includes:

[0007] Get graph structure samples;

[0008] Obtaining a preset first loss function, where the first loss function is used to maintain the energy between the graph signals input into the multiple hidden layers unchanged;

[0009] The graph neural network is trained using the graph structure sample and the first loss function to obtain a trained graph neural network.

[0010] In an optional embodiment, the method further includes: obtaining a preset second loss function, where the second loss function is a logarithmic loss function;

[0011] Using the graph structure samples and the first loss function, the graph neural network is trained to obtain a trained graph neural network, including: determining a joint loss function based on the first loss function and the second loss function; using the graph structure samples and the joint loss function, the graph neural network is trained to obtain a trained graph neural network.

[0012] In an optional embodiment, the graph neural network further includes an input layer, which receives the graph structure sample and transmits output information to the first hidden layer of the graph neural network;

[0013] The first loss function is shown in the following formula (1):

[0014]

[0015] Among them, Loss1 represents the first loss value, H (m) represents the output information of the mth hidden layer of the graph neural network, represents the Fourier transform of the output information of the mth hidden layer of the graph neural network, express The L2 norm of The Fourier transform representing the output information of the input layer of the graph neural network, express The L2 norm of represents the Fourier transform of the output information of the (L-1)th hidden layer of the graph neural network, express , m represents the mth hidden layer of the graph neural network, m=1, 2,…, L-1, and L represents the total number of hidden layers of the graph neural network.

[0016] In an optional embodiment, the second loss function is shown in the following formula (2):

[0017]

[0018] Wherein, Loss2 represents the second loss value, L represents the total number of hidden layers of the graph neural network, and H (m) represents the output information of the mth hidden layer of the graph neural network, y represents the label of the graph structure sample, P(H (m) =y) represents the similarity between the output information of the mth hidden layer of the graph neural network and the label of the graph structure sample, or the probability that the label corresponding to the output of the mth hidden layer of the graph neural network is the same as the label of the graph structure sample.

[0019] In an optional embodiment, the output information of the mth hidden layer of the graph neural network is used as the first vector; and the method further includes:

[0020] Calculating the distance between the first vector and a second vector corresponding to the label of the graph structure sample;

[0021] The distance between the first vector and the second vector is used as the similarity between the output information of the mth hidden layer of the graph neural network and the label of the graph structure sample.

[0022] In an optional embodiment, the method further comprises:

[0023] For each hidden layer of the graph neural network, inputting the output information of the hidden layer into a pre-built probability prediction model, wherein the probability prediction model includes a pooling layer, a multi-layer perceptron layer, and a normalization layer;

[0024] The output information of the probability prediction model is obtained, and the output information of the probability prediction model is used as the probability that the label corresponding to the hidden layer is the same as the label of the graph structure sample.

[0025] In a second aspect, an embodiment of the present invention provides a method for generating a community relationship graph structure, comprising:

[0026] The client sends a request for generating a community relationship graph structure to the server, wherein the request includes user information;

[0027] In response to receiving the request to generate the community relationship graph structure, the server calls the trained graph neural network, and uses the trained graph neural network to analyze the user information included in the request to generate the community relationship graph structure, so as to obtain the community relationship graph structure corresponding to the user information; the trained graph neural network is obtained according to the training method of the graph neural network model of any embodiment of the present invention;

[0028] The server feeds back to the client a community relationship graph structure corresponding to the user information.

[0029] In an optional embodiment, before the client sends a request to generate a community relationship graph structure to the server, the method further includes:

[0030] The client sends a key acquisition request to the server, where the key acquisition request indicates obtaining at least one first key of the server;

[0031] In response to receiving the key acquisition request, the server feeds back at least one first key to the client;

[0032] In response to receiving the at least one first key, the client encrypts the user information based on the at least one first key pair to obtain encrypted user information;

[0033] The client generates a community relationship graph structure generation request based on the encrypted user information;

[0034] Before the server calls the trained graph neural network, the method further includes:

[0035] In response to receiving the request to generate the social relationship graph structure, the server decrypts the encrypted user information carried in the request to generate the social relationship graph structure according to the at least one first key to obtain the decrypted user information.

[0036] In an optional embodiment, in response to receiving the at least one first key, the client encrypts the user information based on the at least one first key pair to obtain the encrypted user information, including:

[0037] In response to receiving the at least one first key, the client combines the at least one first key with the at least one second key in a specified combination manner to obtain a target key;

[0038] The client encrypts the user information using the target key to obtain encrypted user information;

[0039] The client generates a community relationship graph structure generation request based on the encrypted user information, the at least one second key and the specified combination method;

[0040] In response to receiving the request for generating a social relationship graph structure, the server decrypts the encrypted user information carried in the request for generating a social relationship graph structure according to the at least one first key to obtain the decrypted user information, including:

[0041] The server, in response to receiving the request for generating a social relationship graph structure, parses the request for generating a social relationship graph structure, and obtains the encrypted user information, at least one second key, and the specified combination method carried in the request for generating a social relationship graph structure;

[0042] The server combines the at least one first key with the at least one second key according to the specified combination method to obtain the target key, and uses the target key to decrypt the encrypted user information to obtain the decrypted user information.

[0043] In a third aspect, an embodiment of the present invention provides a training system for a graph neural network, wherein the graph neural network includes multiple hidden layers; the system includes:

[0044] An acquisition module is used to obtain graph structure samples;

[0045] A construction module is used to obtain a preset first loss function, where the first loss function is used to maintain the energy between the graph signals input into the multiple hidden layers unchanged;

[0046] A training module is used to train the graph neural network using the graph structure sample and the first loss function to obtain a trained graph neural network.

[0047] In a fourth aspect, an embodiment of the present invention provides a system for generating a community relationship graph structure, including a client and a server:

[0048] The client sends a request for generating a community relationship graph structure to the server, wherein the request for generating a community relationship graph structure includes user information;

[0049] In response to receiving the request to generate the community relationship graph structure, the server calls the trained graph neural network, and uses the trained graph neural network to analyze the user information included in the request to generate the community relationship graph structure, so as to obtain the community relationship graph structure corresponding to the user information; the trained graph neural network is obtained according to the training method of the graph neural network described in any embodiment of the present invention;

[0050] The server feeds back to the client a community relationship graph structure corresponding to the user information.

[0051] In a fifth aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the graph neural network training method or the community relationship graph structure generation method described in any embodiment of the present invention when executing the program stored in the memory.

[0052] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the graph neural network training method or the community relationship graph structure generation method described in any embodiment of the present invention.

[0053] The technical solution provided by the embodiment of the present invention brings at least the following beneficial effects:

[0054] The training method of the graph neural network provided by the embodiment of the present invention obtains a graph structure sample; obtains a preset first loss function, and the first loss function is used to maintain the energy between the graph signals of multiple hidden layers of the input graph neural network unchanged; uses the graph structure sample and the first loss function to train the graph neural network to obtain a trained graph neural network. This method improves the training effect of the graph neural network model by optimizing the loss function used to maintain the energy between the graph signals of multiple hidden layers of the input graph neural network unchanged, so that the model can learn and predict more accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0056] Figure 1 A schematic diagram showing a flow chart of a training method for a graph neural network according to an embodiment of the present invention;

[0057] Figure 2 A schematic diagram showing the structure of a graph neural network according to an embodiment of the present invention is shown;

[0058] Figure 3 A schematic diagram showing a flow chart of a method for training a graph neural network according to another embodiment of the present invention;

[0059] Figure 4 A schematic diagram showing a process of a method for generating a community relationship graph structure provided by an embodiment of the present invention is shown;

[0060] Figure 5 A schematic diagram showing a flow chart of a method for generating a community relationship graph structure according to another embodiment of the present invention;

[0061] Figure 6 A schematic diagram showing the structure of a training system for a graph neural network according to an embodiment of the present invention is shown;

[0062] Figure 7 A schematic diagram showing the structure of a community relationship graph structure generation system provided by an embodiment of the present invention is shown;

[0063] Figure 8 A schematic structural diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0064] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0065] The terms "first", "second", etc. in the specification and claims of the present invention are used to distinguish similar objects, rather than to describe a specific order or precedence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.

[0066] Figure 1 The flowchart of the training method of the graph neural network provided by the example of the present invention is shown. The graph neural network includes an input layer, multiple hidden layers and an output layer. Figure 1 As shown, the training method of the graph neural network includes:

[0067] Step S101: Obtain a graph structure sample.

[0068] A graph is a mathematical structure consisting of a set of nodes (or vertices) and a set of edges. Nodes are connected by edges, which can have weights to represent the strength or similarity of the connection between nodes. Graphs can be used to represent various complex relationships, such as social networks, communication networks, bioinformatics data, etc. In a graph structure, any two nodes may be related, that is, the adjacency relationship between nodes can be arbitrary. The graph structure is composed of points and edges (and weights). Points are vertices in the graph; edges are line segments connecting vertices (weights are the values ​​represented by edges, which are not the lengths of line segments). Graphs can be divided into directed graphs and undirected graphs according to their directionality. The degree of a vertex is the number of edges connecting a vertex. In an undirected graph, the degree of a vertex is the number of edges connecting vertices. In a directed graph, since line segments have directionality, the degree of a vertex is divided into in-degree and out-degree, and the degree of a vertex is the sum of in-degree and out-degree.

[0069] Optionally, in an embodiment of the present invention, a graph structure sample G=(V, E) is defined, where V represents a node set and E represents an edge set.

[0070] Step S102: Obtain a preset first loss function, where the first loss function is used to maintain the energy between the graph signals input into the multiple hidden layers unchanged.

[0071] Optional, such as Figure 2 As shown in the figure, the structural diagram of the graph neural network is as follows Figure 2 As shown in Figure 1, the graph neural network includes an input layer, L hidden layers, and an output layer. The information input to the input layer of the graph neural network includes the features X∈R of the graph structure sample N×C , the adjacency matrix A∈R N×N , degree matrix D∈R N×N The processing of input information by each hidden layer of the graph neural network is shown as follows (6-1):

[0072]

[0073] in, is the adjacency matrix of graph G with self-loops, I N is the identity matrix, is the degree matrix with self-loops, It means taking the square root of the degree matrix with self-loops and then taking the inverse, W (l) is the weight vector of a specific layer that can be used for training, σ(·) is the activation function, and H (m) Represents the output features of the mth hidden layer of the graph neural network, m = 1, 2, ..., L-1. The output information of the input layer of the graph neural network is as follows:

[0074]

[0075] H (0) Represents the initial features of the graph structure sample.

[0076] The spectral convolution operation in the graph neural network is shown in the following formula (6-2):

[0077] g θ *x=Ug θ U T x (6-2)

[0078] Where U represents the normalized Laplace matrix The feature vector of U is , since the graph convolutional neural network is used for undirected graphs, so U T =U -1 .

[0079] g θ The polynomial function representing the eigenvalue ∧ of the eigenvector U is shown in the following equation (6-3):

[0080] g θ =gθ ( Λ)=θ0Λ 0 +θ1Λ 1 +...+θ N ΛN (6-3)

[0081] because,

[0082] Ug θ (Λ)U T =θ0UΛ 0 U T +θ1UΛ 1 U T +...+θ N UΛ N U T

[0083] Further, formula (6-3) can be written as:

[0084] Ug θ (Λ)U T =θ0Λ 0 +θ1(UΛU T ) 1 +θ2(UΛU T ) 2 +...+θ N (UΛU T ) N Right now:

[0085] Ug θ (Λ)U T =θ0Λ 0 +θ1(L sys ) 1 +θ2(L sys ) 2 +...+θ N (L sys ) N (6-4)

[0086] So the convolution operation on the graph signal x is actually the normalized Laplace matrix L sys The LSI filter acts on the graph signal x, that is,

[0087] Taking θ=θ0=-θ1, we get

[0088]

[0089] Then use the reparameterization method to Then we get formula (6-5):

[0090]

[0091] The filter L used in the graph neural network in the prior art sysThe energy of the graph signal cannot be guaranteed to remain unchanged, that is, ||(g θ *x) F ||2≠||x F ||2(e.g. Derive the symmetric Laplace L sys The operator does not satisfy the energy invariance), which will cause the energy of the graph signal (graph signal refers to the function on the graph, which maps each node to a value. These values ​​can represent the attributes, features of the node, or some measurement on the graph) to change in the frequency domain after the graph convolutional neural network transmits information layer by layer (shift operation), resulting in information loss of the graph signal.

[0092] In order to constrain the energy fluctuation of the graph signal in the process of information transmission of the graph neural network and preserve the original information of the graph signal as much as possible, the embodiment of the present application first performs L sys Perform matrix decomposition L sys =V -1 ΛV, get the Fourier transform of the image signal Finally, the energy change is constrained to obtain the first loss function provided in the embodiment of the present application:

[0093]

[0094] Among them, Loss1 represents the first loss value, H (m) represents the output information of the mth hidden layer of the graph neural network, represents the Fourier transform of the output information of the mth hidden layer of the graph neural network, express The L2 norm of The Fourier transform representing the output information of the input layer of the graph neural network, express The L2 norm of represents the Fourier transform of the output information of the (L-1)th hidden layer of the graph neural network, express , m represents the mth hidden layer of the graph neural network, m=1, 2,…, L-1, and L represents the total number of hidden layers of the graph neural network.

[0095] In this embodiment of the present invention, for the graph G, assume that each node V i The characteristic is x i (Assume that the feature of each node is a one-dimensional scalar, which can be a complex number). Therefore, assuming that there are n nodes, the feature vector of the entire graph is x = (x1, x2, ..., x n )'∈R n .

[0096] In Graph Signal Processing (GSP), each node V i Features of x i Assume that the adjacency matrix A of the graph is diagonalizable, and the characteristic decomposition is:

[0097]

[0098] The frequency of the graph signal x is expressed as:

[0099] x F =V -1 x

[0100] That is, through V- 1 Transform x into the frequency domain, where V- 1 It is called the Graph Fourier Transformation (GFT).

[0101] In the frequency domain, the energy of a graph signal is defined as ||x F || 2 =(V -1 x) H V -1 x.

[0102] Each graph linear shift invariant (LSI) filter is a polynomial of the graph shift matrix, namely:

[0103]

[0104] Where L is the number of terms in the polynomial, h k is an adjustable coefficient, and the graph filter depends on its graph shift operator. The filter in signal processing can be regarded as a function that amplifies or reduces relevant frequencies and eliminates irrelevant frequencies.

[0105] For constructing energy-preserving filters, energy-preserving operators all satisfy the properties:

[0106]

[0107] The LSI filter with energy preservation operator is defined as follows:

[0108]

[0109] The signal after the filter:

[0110]

[0111] Convert the signal after the filter to the frequency domain:

[0112]

[0113] in, z F =V -1 z.

[0114] Take this energy preservation operator φ as operator A φ , j is the imaginary unit, φ k ∈[0, 2π], then we have

[0115]

[0116] Then at this time is a simple point-by-point multiplication, then:

[0117]

[0118] Since the modulus of λ is always 1, raising it to any power of k will not significantly change its value, and there will not be a problem like 1.5 20 ≈3,325.2567, 0.9 50 ≈0.00515, such exponential explosion or exponential decay. This shows that the size of each component of the filter in the frequency domain is the same, and no λ is too large or too small, and is only affected by the filter coefficient h k , that is, the energy of the image signal remains unchanged.

[0119] Step S103: Using the graph structure sample and the first loss function, the graph neural network is trained to obtain a trained graph neural network.

[0120] In an optional embodiment, the graph neural network can be trained according to methods such as inductive learning, transductive learning, or few-shot learning. The training method can be selected according to the specific task, the size and distribution of the data set, and the complexity of the model. For example, if the data set is large and evenly distributed, inductive learning may be the best choice. For small data sets or data distributions with large changes, transductive learning is used for training. If the samples are limited, you can choose to train the graph neural network by few-shot learning.

[0121] The training method of the graph neural network model provided by an embodiment of the present invention improves the training effect of the graph neural network model through an optimized loss function for maintaining the energy between graph signals of multiple hidden layers of the input graph neural network, so that the model can learn and predict more accurately.

[0122] Figure 3 FIG. 2 is a schematic diagram showing a method for training a graph neural network model according to another embodiment of the present invention. Figure 3 As shown, the method includes:

[0123] Step S301: Obtain a graph structure sample.

[0124] Step S302: Obtain a preset first loss function, where the first loss function is used to maintain the energy between the graph signals input into the multiple hidden layers unchanged.

[0125] Steps S201-S202 can refer to Figure 1 The illustrated embodiments are not described in detail here to avoid repetition.

[0126] Step S303: Obtain a preset second loss function, where the second loss function is a logarithmic loss function.

[0127] In an optional embodiment, the second loss function is shown in the following formula (2):

[0128]

[0129] Wherein, Loss2 represents the second loss value, L represents the total number of hidden layers of the graph neural network, and H (m) represents the output information of the mth hidden layer of the graph neural network, y represents the label of the graph structure sample, P(H (m) =y) represents the similarity between the output information of the mth hidden layer of the graph neural network and the label of the graph structure sample, or the probability that the label corresponding to the output of the mth hidden layer of the graph neural network is the same as the label of the graph structure sample.

[0130] In an optional embodiment, the similarity between the output information of the mth hidden layer of the graph neural network and the label of the graph structure sample can be determined according to the following process:

[0131] The output information of the mth hidden layer of the graph neural network is used as the first vector, and the distance between the first vector and the second vector corresponding to the label of the graph structure sample is calculated.

[0132] The distance between the first vector and the second vector is the similarity between the output information of the mth hidden layer of the graph neural network and the label of the graph structure sample. The distance between the first vector and the second vector is, for example, the cosine similarity, Euclidean distance or Manhattan distance between the first vector and the second vector.

[0133] In an optional embodiment, the probability that the label corresponding to the output of the mth hidden layer of the graph neural network is the same as the label of the graph structure sample can be determined according to the following process:

[0134] For each hidden layer of the graph neural network, the output information of the hidden layer is input into the pre-built probability prediction model.

[0135] The output information of the probability prediction model is obtained, and the output information of the probability prediction model is used as the probability that the label corresponding to the hidden layer is the same as the label of the graph structure sample. The probability prediction model includes a pooling layer, a multi-layer perceptron layer, and a normalization layer. Optionally, the probability prediction model can be a pre-trained model, or the probability prediction model can be trained simultaneously during the training of the graph neural network.

[0136] Step S304: Use the graph structure sample, the first loss function and the second loss function to train the graph neural network to obtain a trained graph neural network.

[0137] Among them, a joint loss function is obtained according to the first loss function and the second loss function, and the graph neural network is trained using the joint loss function to obtain a trained graph neural network.

[0138] As an optional example, the joint loss function is as follows:

[0139] L=αLoss1+βLoss2

[0140] Among them, α and β represent weight coefficients.

[0141] Figure 4 A schematic diagram of the process of a method for generating a community relationship graph structure provided by an embodiment of the present invention is shown.

[0142] like Figure 4 As shown, the method includes:

[0143] Step S401: The client sends a request for generating a social relationship graph structure to the server, wherein the request includes user information, for example, the user information includes user identity information, relationships between users, and interaction patterns.

[0144] Step S402: In response to receiving the request to generate the community relationship graph structure, the server calls the trained graph neural network, uses the trained graph neural network to analyze the user information included in the request to generate the community relationship graph structure, and obtains the community relationship graph structure corresponding to the user information; the trained graph neural network is obtained according to the graph neural network training method provided by any embodiment of the present invention. The community relationship graph structure includes a target graph node for indicating the target user and graph nodes of associated users who have a community relationship with the target user.

[0145] Step S403: the server feeds back the community relationship graph structure corresponding to the user information to the client.

[0146] The community relationship graph structure generation method of the embodiment of the present invention obtains a graph neural network model based on optimized loss function training. The trained graph neural network model has higher prediction performance, making the generated community relationship graph structure more accurate and able to better reflect real user relationships and community dynamics.

[0147] Since the community relationship graph structure can accurately reflect the community relationship of the target user, the community relationship graph structure is related to the privacy security of the target user. Therefore, it is necessary to improve the security of the community relationship graph structure.

[0148] In order to improve the security of the community relationship graph structure, in an optional embodiment, the client uses the server's private key to encrypt the user information and sends the encrypted user information to the server, reducing the risk of user information being tampered with. After generating the community relationship graph structure, the server also uses the private key to encrypt the generated community relationship graph structure and feeds the encrypted community relationship graph structure back to the client, thereby improving the security of the community relationship graph structure.

[0149] Before the client sends a request for generating a community relationship graph structure to the server, the method for generating a community relationship graph structure according to an embodiment of the present invention includes:

[0150] The client sends a key acquisition request to the server, and the key acquisition request indicates to obtain at least one first key of the server; in response to receiving the key acquisition request, the server feeds back at least one first key to the client. Among them, the first key is a private key of the server. In response to receiving the at least one first key, the client encrypts the user information based on the at least one first key pair to obtain encrypted user information. Based on the encrypted user information, the client generates a request to generate a community relationship graph structure.

[0151] In response to receiving a request to generate a community relationship graph structure, the server calls a trained graph neural network, and uses the trained graph neural network to analyze the user information included in the request to generate a community relationship graph structure, and obtains the community relationship graph structure corresponding to the user information, including: in response to receiving a request to generate a community relationship graph structure, the server decrypts the encrypted user information carried in the request to generate a community relationship graph structure according to at least one first key to obtain the decrypted user information; and calls the trained graph neural network to analyze the decrypted user information to obtain the community relationship graph structure corresponding to the user information.

[0152] The server feeds back the community relationship graph structure corresponding to the user information to the client, including: the server encrypts the community relationship graph structure based on at least one first key to obtain the encrypted community relationship graph structure, and feeds back the encrypted community relationship graph structure to the client.

[0153] Figure 5 FIG. 1 is a flow chart showing a method for generating a community relationship graph structure according to an embodiment of the present invention. Figure 5 As shown, the method includes:

[0154] (1) The client sends a key acquisition request to the server, where the key acquisition request indicates obtaining at least one first key of the server.

[0155] (2) In response to receiving the key acquisition request, the server feeds back at least one first key to the client.

[0156] (3) In response to receiving the at least one first key, the client combines the at least one first key with the at least one second key in a specified combination manner to obtain a target key.

[0157] The first key (denoted as B1) is the private key of the server, and the second key (denoted as A1) is the private key of the client. As an optional example, the key combination is [client, server, server, client, server], then the target key obtained is A1B1B1A1B1. It can be understood that the more keys the client has (for example, the client's own keys can also include A1, A2...AN) and the more keys the server has (for example, the server's own keys can also include B1, B2...BN), the higher the security performance of the target key, and the more complex the key combination, the higher the security performance of the target key.

[0158] (4) The client uses the target key to encrypt the user information to obtain encrypted user information.

[0159] (5) The client generates a community relationship graph structure generation request based on the encrypted user information, at least one second key and a specified combination method.

[0160] (6) In response to receiving the request for generating a social relationship graph structure, the server parses the request for generating a social relationship graph structure and obtains the encrypted user information, at least one second key, and a specified combination method carried in the request for generating a social relationship graph structure.

[0161] (7) The server combines at least one first key with at least one second key in a specified combination manner to obtain a target key, and uses the target key to decrypt the encrypted user information to obtain the decrypted user information.

[0162] (8) The server calls the trained graph neural network, predicts the target user's community relationship graph structure based on the target user's user information, encrypts the target user's community relationship graph structure based on the target key, obtains the encrypted community relationship graph structure, and sends the encrypted community relationship graph structure to the client.

[0163] (9) The client receives the encrypted community relationship graph structure, and decrypts the encrypted community relationship graph structure based on the target key to obtain the community relationship graph structure.

[0164] In this embodiment, since the first key is the private key of the server, the second key is the private key of the client, and the key combination method is private to the client and the server, any third party other than the client and the server does not have the key combination method. Therefore, even if any third party other than the client and the server knows the client's own key and the server's own key, they cannot obtain the target key. Therefore, any third party other than the client and the server cannot decrypt the user's user information and community relationship graph structure, thereby ensuring the end-to-end data security of user information and community relationship graph structure between the client and the server, thereby effectively improving the information security of the graph neural network. At the same time, because the trained graph neural network has a higher prediction performance, the predicted community relationship graph structure can accurately reflect the community relationship of the target user.

[0165] Figure 6 FIG. 2 shows a schematic diagram of the structure of a training system for a graph neural network provided by an embodiment of the present invention. Figure 6 As shown, the graph neural network training system 600 includes:

[0166] An acquisition module 601 is used to acquire a graph structure sample;

[0167] A construction module 602 is used to obtain a preset first loss function, where the first loss function is used to maintain the energy between the graph signals of multiple hidden layers of the input graph neural network unchanged;

[0168] The training module 603 is used to train the graph neural network using the graph structure sample and the first loss function to obtain a trained graph neural network.

[0169] In an optional embodiment, the construction module is further used to obtain a preset second loss function, which is a logarithmic loss function; wherein the probability of a graph structure sample substituted into the logarithmic loss function being predicted as a predicted label is obtained through a preset reinforcement learning model, and the predicted label is the output information of the last hidden layer of the graph neural network;

[0170] The training module is also used to: use the graph structure sample, the first loss function and the second loss function to train the graph neural network to obtain a trained graph neural network.

[0171] Figure 7 FIG. 1 is a schematic diagram showing a system for generating a community relationship graph structure according to an embodiment of the present invention. Figure 7 As shown, the community relationship graph structure includes a client 701 and a server 702 .

[0172] The client 701 sends a request for generating a social relationship graph structure to the server 702 , and the request for generating a social relationship graph structure includes user information.

[0173] In response to receiving the request to generate the community relationship graph structure, the server 702 calls the trained graph neural network, and uses the trained graph neural network to analyze the user information included in the request to generate the community relationship graph structure, and obtains the community relationship graph structure corresponding to the user information; the trained graph neural network is obtained according to the training method of any embodiment of the present invention.

[0174] The server 702 feeds back the community relationship graph structure corresponding to the user information to the client 701 .

[0175] In an optional embodiment, the client sends a key acquisition request to the server, where the key acquisition request indicates to acquire at least one first key of the server;

[0176] In response to receiving the key acquisition request, the server feeds back at least one first key to the client;

[0177] In response to receiving the at least one first key, the client encrypts the user information based on the at least one first key pair to obtain encrypted user information;

[0178] The client generates a community relationship graph structure generation request based on the encrypted user information;

[0179] In response to receiving the request to generate the community relationship graph structure, the server decrypts the encrypted user information carried in the request to generate the community relationship graph structure according to the at least one first key to obtain the decrypted user information; and calls the trained graph neural network to analyze the decrypted user information to obtain the community relationship graph structure corresponding to the user information;

[0180] The server encrypts the community relationship graph structure based on the at least one first key to obtain an encrypted community relationship graph structure, and feeds the encrypted community relationship graph structure back to the client.

[0181] In an optional embodiment, in response to receiving the at least one first key, the client combines the at least one first key with the at least one second key in a specified combination manner to obtain a target key;

[0182] The client encrypts the user information using the target key to obtain encrypted user information;

[0183] The client generates a community relationship graph structure generation request based on the encrypted user information, the at least one second key and the specified combination method;

[0184] The server, in response to receiving the request for generating a social relationship graph structure, parses the request for generating a social relationship graph structure, and obtains the encrypted user information, at least one second key, and the specified combination method carried in the request for generating a social relationship graph structure;

[0185] The server combines the at least one first key with the at least one second key according to the specified combination method to obtain the target key, and uses the target key to decrypt the encrypted user information to obtain the decrypted user information.

[0186] Figure 8 FIG. 1 is a schematic diagram showing the structure of an electronic device according to an embodiment of the present invention. Figure 8 As shown, the electronic device includes:

[0187] Processor 801, communication interface 802, memory 803 and communication bus 804, wherein the processor 801, communication interface 802, memory 803 communicate with each other via the communication bus 804.

[0188] Memory 803, used for storing computer programs;

[0189] The processor 801 is used to execute the program stored in the memory 803, and implements the following steps:

[0190] Get graph structure samples;

[0191] Obtaining a preset first loss function, where the first loss function is used to maintain the energy between graph signals of multiple hidden layers of the input graph neural network unchanged;

[0192] The graph neural network is trained using the graph structure sample and the first loss function to obtain a trained graph neural network.

[0193] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0194] The communication interface is used for communication between the above terminal and other devices.

[0195] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0196] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0197] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the method described in any of the above embodiments.

[0198] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the method described in any one of the above embodiments.

[0199] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0200] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0201] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0202] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A training method for a graph neural network, characterized in that: The graph neural network includes multiple hidden layers; the method includes: Get graph structure samples; Obtaining a preset first loss function, where the first loss function is used to maintain the energy between the graph signals input into the multiple hidden layers unchanged; The graph neural network is trained using the graph structure sample and the first loss function to obtain a trained graph neural network.

2. The method according to claim 1, characterized in that: The method further includes: obtaining a preset second loss function, where the second loss function is a logarithmic loss function; Using the graph structure sample and the first loss function, training the graph neural network to obtain a trained graph neural network includes: Determine a joint loss function according to the first loss function and the second loss function; The graph neural network is trained using the graph structure sample and the joint loss function to obtain a trained graph neural network.

3. The method according to claim 1 or 2, characterized in that: The graph neural network also includes an input layer, which receives the graph structure sample and transmits output information to the first hidden layer of the graph neural network; The first loss function is shown in the following formula (1): Among them, Loss1 represents the first loss value, H (m) represents the output information of the mth hidden layer of the graph neural network, represents the Fourier transform of the output information of the mth hidden layer of the graph neural network, express The L2 norm of The Fourier transform representing the output information of the input layer of the graph neural network, express The L2 norm of represents the Fourier transform of the output information of the (L-1)th hidden layer of the graph neural network, express , m represents the mth hidden layer of the graph neural network, m=1, 2,…, L-1, and L represents the total number of hidden layers of the graph neural network.

4. The method according to claim 2, characterized in that: The second loss function is shown in the following formula (2): Wherein, Loss2 represents the second loss value, L represents the total number of hidden layers of the graph neural network, and H (m) represents the output information of the mth hidden layer of the graph neural network, y represents the label of the graph structure sample, P(H (m) =y) represents the similarity between the output information of the mth hidden layer of the graph neural network and the label of the graph structure sample, or the probability that the label corresponding to the output of the mth hidden layer of the graph neural network is the same as the label of the graph structure sample.

5. The method according to claim 4, characterized in that The output information of the mth hidden layer of the graph neural network is used as a first vector; the method further includes: Calculating the distance between the first vector and a second vector corresponding to the label of the graph structure sample; The distance between the first vector and the second vector is used as the similarity between the output information of the mth hidden layer of the graph neural network and the label of the graph structure sample.

6. The method according to claim 4, characterized in that The method further comprises: For each hidden layer of the graph neural network, inputting the output information of the hidden layer into a pre-built probability prediction model, wherein the probability prediction model includes a pooling layer, a multi-layer perceptron layer, and a normalization layer; The output information of the probability prediction model is obtained, and the output information of the probability prediction model is used as the probability that the label corresponding to the hidden layer is the same as the label of the graph structure sample.

7. A method for generating a community relationship graph structure, characterized in that: include: The client sends a request for generating a community relationship graph structure to the server, wherein the request includes user information; In response to receiving the request to generate the community relationship graph structure, the server calls a trained graph neural network, and uses the trained graph neural network to analyze the user information included in the request to generate the community relationship graph structure, so as to obtain a community relationship graph structure corresponding to the user information; the trained graph neural network is obtained according to the training method according to any one of claims 1 to 6; The server feeds back to the client a community relationship graph structure corresponding to the user information.

8. The method according to claim 7, characterized in that Before the client sends a request to generate a community relationship graph structure to the server, the method further includes: The client sends a key acquisition request to the server, where the key acquisition request indicates obtaining at least one first key of the server; In response to receiving the key acquisition request, the server feeds back at least one first key to the client; In response to receiving the at least one first key, the client encrypts the user information based on the at least one first key pair to obtain encrypted user information; The client generates a community relationship graph structure generation request based on the encrypted user information; In response to receiving the request to generate the community relationship graph structure, the server calls the trained graph neural network, and uses the trained graph neural network to analyze the user information included in the request to generate the community relationship graph structure, and obtains the community relationship graph structure corresponding to the user information, including: In response to receiving the request to generate the community relationship graph structure, the server decrypts the encrypted user information carried in the request to generate the community relationship graph structure according to the at least one first key to obtain the decrypted user information; and calls the trained graph neural network to analyze the decrypted user information to obtain the community relationship graph structure corresponding to the user information; The server feeds back to the client a community relationship graph structure corresponding to the user information, including: The server encrypts the community relationship graph structure based on the at least one first key to obtain an encrypted community relationship graph structure, and feeds the encrypted community relationship graph structure back to the client.

9. The method according to claim 8, characterized in that In response to receiving the at least one first key, the client encrypts the user information based on the at least one first key pair to obtain the encrypted user information, including: In response to receiving the at least one first key, the client combines the at least one first key with the at least one second key in a specified combination manner to obtain a target key; The client encrypts the user information using the target key to obtain encrypted user information; The client generates a community relationship graph structure generation request based on the encrypted user information, the at least one second key and the specified combination method; In response to receiving the request for generating a social relationship graph structure, the server decrypts the encrypted user information carried in the request for generating a social relationship graph structure according to the at least one first key to obtain the decrypted user information, including: The server, in response to receiving the request for generating a social relationship graph structure, parses the request for generating a social relationship graph structure, and obtains the encrypted user information, at least one second key, and the specified combination method carried in the request for generating a social relationship graph structure; The server combines the at least one first key with the at least one second key according to the specified combination method to obtain the target key, and uses the target key to decrypt the encrypted user information to obtain the decrypted user information.

10. A graph neural network training system, characterized in that: The graph neural network includes multiple hidden layers; the system includes: An acquisition module is used to obtain graph structure samples; A construction module is used to obtain a preset first loss function, where the first loss function is used to maintain the energy between the graph signals input into the multiple hidden layers unchanged; A training module is used to train the graph neural network using the graph structure sample and the first loss function to obtain a trained graph neural network.

11. A community relationship graph structure generation system, characterized in that: Including client and server: The client sends a request for generating a community relationship graph structure to the server, wherein the request for generating a community relationship graph structure includes user information; In response to receiving the request to generate the community relationship graph structure, the server calls a trained graph neural network, and uses the trained graph neural network to analyze the user information included in the request to generate the community relationship graph structure, so as to obtain a community relationship graph structure corresponding to the user information; the trained graph neural network is obtained according to the training method according to any one of claims 1 to 6; The server feeds back to the client a community relationship graph structure corresponding to the user information.

12. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, configured to implement the method according to any one of claims 1 to 9 when executing a program stored in a memory.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.