A social user classification method and system based on a graph neural network

By generating synthetic nodes and adjacency information in a graph neural network and combining it with an adaptive label propagation algorithm, the problem of imbalanced data in social user classification is solved, improving classification accuracy and performance while reducing computational costs.

CN115631057BActive Publication Date: 2026-07-10QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
Filing Date
2022-10-24
Publication Date
2026-07-10

Smart Images

  • Figure CN115631057B_ABST
    Figure CN115631057B_ABST
Patent Text Reader

Abstract

The application discloses a social user classification method and system based on a graph neural network, electronic equipment and a computer readable storage medium, and belongs to the technical field of social user classification. The method comprises the following steps: constructing original graph structure data based on input social user data, obtaining node representation, performing oversampling operation based on the node representation, generating a synthetic node for a minority node in the data, obtaining adjacency information of the synthetic node based on the synthetic node, assigning a pseudo label to the synthetic node, combining the synthetic node, the adjacency information and a real node to construct a node balanced graph, and performing classification. The method can solve the imbalance classification problem, improve the accuracy of social user classification, and solve the problem of low accuracy and high calculation cost caused by class imbalance in social user classification in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of social user classification technology, and in particular to a social user classification method and system based on graph neural networks. Background Technology

[0002] The statements in this section merely refer to the background art related to this application and do not necessarily constitute prior art.

[0003] In recent years, with the development of graph neural networks (GNNs), graph representation learning has been greatly improved and widely applied in classification tasks, but existing work still mainly focuses on the study of data balance learning.

[0004] Node classification is an important research topic in graph representation learning. Graph Neural Networks (GNNs) have achieved state-of-the-art node classification performance. However, existing GNNs address the problem of data sample balance between different classes; in many real-world scenarios, instances of some classes may be far fewer than others. In such cases, directly training a GNN classifier will be insufficient to represent the samples from those minority classes, leading to suboptimal performance.

[0005] However, in the real world, the number of samples from different categories in the data may be imbalanced, meaning that some categories may have significantly more samples than others. This imbalance is particularly pronounced in the detection of fake users, as the majority of users on video websites and social networking sites are real, with only a small percentage being bots (fake users).

[0006] Semi-supervised classification learning trains a classifier using a small subset of labeled data from a large dataset to complete the final classification task. However, when classifying social users, there is only a limited amount of labeled data. Semi-supervised learning further exacerbates this problem by making the number of labeled minority samples even smaller, since we only have limited labeled data.

[0007] In the field of machine learning, the imbalanced classification problem has been extensively studied and can be summarized into three categories: data-level methods, algorithmic methods, and hybrid methods. Data-level methods use oversampling or undersampling techniques to balance the class distribution. Oversampling balances the dataset by oversampling minority class samples, while undersampling balances the dataset by undersampling majority class samples. Undersampling may lead to more efficient classification, but because it discards useful information from the majority class, it eventually shakes the decision boundary and results in a poor classifier. Conversely, oversampling preserves more information by copying existing samples or synthesizing new samples. Copying (also known as random oversampling) randomly copies some minority samples, so it usually produces a smaller minority class region, which can lead to overfitting. Algorithmic methods typically introduce different misclassification penalties or prior probabilities for different classes; hybrid methods combine both. However, directly applying them to graphs may yield suboptimal results. Relationships are key information to be mined in graph-structured data, and insufficient minority sample representation not only affects embedding quality but also the knowledge exchange process between adjacent nodes. Previous algorithms failed to address this problem because they assumed that each sample was independent.

[0008] While existing methods have demonstrated their success in learning from imbalanced data, two problems remain:

[0009] (1) In the oversampling strategy, synthesis provides a wider decision region than replication, but it results in heavy computational costs;

[0010] (2) Hybrid strategies rebalance the dataset with a wide decision region, but ensemble learning strategies require a lot of computational cost during training, especially when combined with oversampling strategies.

[0011] (3) In real-world scenarios such as social user classification, some classes may have far fewer instances than others. In such cases, directly training a GNN classifier will be insufficient to represent the samples from those minority classes and will result in suboptimal performance. Summary of the Invention

[0012] To address the shortcomings of existing technologies, this application provides a social user classification method, system, electronic device, and computer-readable storage medium based on graph neural networks. It generates synthetic minority nodes by interpolating in the expressive embedding space obtained by a GNN-based feature extractor and uses an edge generator to predict the links of the synthetic nodes, thereby balancing the minority nodes with other nodes to facilitate node classification using GNN.

[0013] Firstly, this application provides a social user classification method based on graph neural networks;

[0014] A social user classification method based on graph neural networks includes:

[0015] Given the original graph structure data constructed from social user data, obtain node representations and perform oversampling operations based on these node representations.

[0016] Generate composite nodes for a small number of nodes in the data;

[0017] Based on the composite node, obtain the adjacency information of the composite node;

[0018] Assign pseudo-labels to the synthesized nodes;

[0019] By combining synthetic nodes, adjacency information, and real nodes, a node balance graph is constructed for classification.

[0020] Furthermore, the specific steps for performing oversampling operations to generate synthetic nodes based on node representation are as follows:

[0021] Based on node representation, for a small number of nodes in the data, the corresponding node representation is obtained through feature extraction;

[0022] Based on the attribute and topology information of a small number of nodes, a synthetic node is generated.

[0023] Furthermore, the specific steps for assigning pseudo-labels to some of the synthesized nodes are as follows:

[0024] Based on the weight matrix and neighborhood label information, the degree of influence of neighborhood label information on the predicted label is obtained;

[0025] The predicted label is obtained based on the degree of influence of the original label and neighboring label information on the predicted label.

[0026] Furthermore, the specific steps for constructing a node balance graph by combining synthetic nodes, adjacency information, and real nodes are as follows:

[0027] By concatenating the real node embeddings with the synthetic node embeddings, an enhanced node representation set is obtained;

[0028] Embed the synthesized node into the tag node set to obtain the enhanced tag set.

[0029] Furthermore, before classification, the network is trained using an objective function to obtain a graph neural network classification model.

[0030] Furthermore, the objective function is:

[0031]

[0032] Where, η node Let η be the cross-entropy loss function. edge The loss function for training the edge generator, η pLet λ be the objective function for adaptive label propagation, θ be a hyperparameter, and φ be a hyperparameter. These are the parameters for the feature extractor, edge generator, and node classifier, respectively.

[0033] Furthermore, a two-layer GraphSage is adopted as the backbone model structure.

[0034] Secondly, this application provides a social user classification system based on graph neural networks;

[0035] A social user classification system based on graph neural networks includes:

[0036] It includes feature extractors, node generators, edge generators, label propagators, and GNN classifiers;

[0037] The feature extractor is used to obtain the original graph structure data constructed based on social user data, and to obtain node representations based on the original graph structure data;

[0038] The node generator is used to generate composite nodes based on a few nodes in the data, according to the node representation.

[0039] The edge generator is used to obtain the adjacency information of the composite node based on the composite node;

[0040] The label propagator is used to assign pseudo-labels to the synthesized nodes;

[0041] The GNN classifier is used to combine synthetic nodes, adjacency information, and real nodes to construct a node balance graph for classification.

[0042] Thirdly, this application provides an electronic device;

[0043] An electronic device includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, perform the steps of the above-described social user classification method based on graph neural networks.

[0044] Fourthly, this application provides a computer-readable storage medium;

[0045] A computer-readable storage medium for storing computer instructions, which, when executed by a processor, complete the steps of the above-described social user classification method based on graph neural networks.

[0046] Compared with the prior art, the beneficial effects of this application are:

[0047] 1. This application extends the imbalanced learning techniques previously used for independent and identically distributed data to imbalanced node classification tasks. It adopts the most stable and efficient synthetic minority oversampling algorithm to provide relational information for newly synthesized samples and performs classification based on class-balanced data, thereby improving classification accuracy.

[0048] 2. This application addresses the processing of a small number of nodes by generating embeddings through a GNN feature extractor, generating a small number of nodes in the latent space through a node generator, and then adding connections to these new nodes through an edge generator to obtain an augmented graph with class balance. Finally, a GNN classifier is used to classify the nodes. Attached Figure Description

[0049] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.

[0050] Figure 1 A flowchart illustrating the social user classification method based on graph neural networks provided in this application embodiment;

[0051] Figure 2 This is a schematic diagram of the framework provided for an embodiment of this application. Detailed Implementation

[0052] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0053] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations according to this application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. Furthermore, it should be understood that the terms “comprising” and “having”, and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such process, method, product, or apparatus.

[0054] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0055] Example 1

[0056] In existing technologies, the number of fake users in social user classification problems is much smaller than that of real users. In the process of prediction and classification using graph neural networks, existing methods for imbalanced classification problems have high computational costs, and the directly trained samples are insufficient to represent those samples from the minority class, which leads to suboptimal performance and reduces classification accuracy. Therefore, this application provides a social user classification method based on graph neural networks.

[0057] Next, combined Figure 1-2 This embodiment provides a detailed description of a social user classification method based on graph neural networks.

[0058] This embodiment provides a social user classification method based on graph neural networks, including:

[0059] S1. For the input original graph structure data constructed based on social user data, obtain the node representations, and perform an oversampling operation based on the node representations; the specific steps are as follows:

[0060] The node representations of the original graph structure data constructed from social user data are extracted using a feature extractor; in this embodiment, the first layer of GraphSage is used to compute the node representations.

[0061]

[0062] Where F represents the input node attribute matrix, F[,:] represents the node attributes, and A[:,] represents the v-th column in the adjacency matrix. It is the embedding of nodes, W 1 These are weight parameters, representing activation functions like ReLU.

[0063] S2. After obtaining the representation of each node in the embedding space constructed by the feature extractor, synthetic nodes are generated for the minority nodes in the data. In this embodiment, the minority nodes are the labeled nodes in the data. Specifically, the SMOTE algorithm is used to increase ordinary oversampling by changing the repeated interpolation. The basic idea of ​​the SMOTE algorithm is to interpolate the samples from the target minority class in the embedding space and interpolate the nearest neighbors of the target minority class in the embedding space. The specific process is as follows:

[0064] set up It is a labeled minority node with the label Y. u First find the... The closest labeled node in the same class, i.e.

[0065]

[0066] Here, nn(v) refers to the nearest neighbor of v in the same class, which is measured using Euclidean metric in the embedding space.

[0067] Using nearest neighbors, the resulting composite node is:

[0068]

[0069] Here, δ is a random variable that follows a uniform distribution in the range [0,1].

[0070] because and Since they belong to the same class and are very close to each other, the resulting composite nodes... They should also belong to the same class, thus obtaining a labeled composite node.

[0071] S3. Based on the synthetic nodes, obtain the adjacency information of the synthetic nodes. Synthetic nodes have already been generated to balance the class distribution. Since these nodes are not linked to the original graph G, they are isolated from G. First, training is performed using real nodes and an existing edge generator. Then, the edge generator predicts the adjacency information of the synthetic nodes, and the generated synthetic nodes and edges are added to the initial adjacency matrix. This effectively utilizes node representations to reconstruct the adjacency matrix, providing excellent link prediction for the synthetic nodes.

[0072] To keep the model simple and make the analysis easier, a weighted inner product is used to implement the edge generator, as shown below:

[0073]

[0074] Among them, E v,u S represents the predicted relationship information between nodes v and u, and S represents the parameter matrix that captures the interaction between nodes.

[0075] The edge generator is trained using a loss function, which is:

[0076]

[0077] Here, E represents the predicted connection between nodes in V.

[0078] S4. Assign pseudo-labels to the synthesized nodes; specifically, the goal of label propagation is to find a prediction matrix Y that matches the label matrix. L The specific formula is as follows:

[0079]

[0080] Where Y(0) = Y, and K represents the power iteration step number. The predicted label is represented by the transpose matrix T, which can be set as a normalized adjacency matrix. After propagating the label K times, the predicted label can obtain the neighborhood label information with a distance of K hops. Therefore, we designed an adaptive label propagation algorithm, the specific formula of which can be expressed as:

[0081]

[0082] Where γ ik γ represents the degree of influence of k-hop neighborhood information on the predicted label. ik It can be represented as:

[0083]

[0084] in, Note that vector W is the weight matrix and ReLU is the activation function. The adaptive label propagation operator adjusts its propagation strategy for each node by setting the attention vector and weight matrix as learnable parameters, and finally, the smoothed labels can capture the rich structural information in the input graph.

[0085] The objective function for adaptive label propagation is as follows:

[0086]

[0087] in, It is for node v i The prediction, y i The original labels are represented by l(), which represents the cross-entropy loss.

[0088] S5. Combine the synthesized nodes, adjacency information, and real nodes to construct a node balance graph and perform classification. It is by passing H 1 The augmented node representation set obtained by concatenating the embeddings of real nodes with the embeddings of synthetic nodes It is achieved by embedding the synthetic node into V L The resulting enhanced tag set; thus, a set of tagged nodes is obtained. Enhanced graph

[0089] Specifically, a second GraphSage block is used, with an additional linear layer for... The nodes on the table are categorized as follows:

[0090]

[0091]

[0092] Among them, H 2 The node representation matrix represents the second GraphSage block, and W represents the weight parameters. Pv This represents the probability distribution over the class labels of node v. The classifier module was optimized using cross-entropy loss.

[0093]

[0094] During the test, nodes v and Y... v The prediction class is set to the class with the highest probability.

[0095]

[0096] Furthermore, before classifying social users, a graph neural network classification model is obtained by training the network using an objective function. The optimal graph neural network classification model is obtained when the objective function is minimized. The specific training steps are the same as those described above, and the objective function is:

[0097]

[0098] Where, η node Let η be the cross-entropy loss function. edge The loss function for training the edge generator, η p Let λ be the objective function for adaptive label propagation, and θ, φ be hyperparameters. These are the parameters for the feature extractor, edge generator, and node classifier, respectively.

[0099] Example 2

[0100] This embodiment discloses a social user classification system based on graph neural networks, including a feature extractor, a node generator, an edge generator, a label propagator, and a GNN classifier;

[0101] The feature extractor is used to acquire the original graph structure data constructed based on social user data, and to obtain node representations from the original graph structure data. The feature extractor can be implemented using any type of GNN; specifically, GraphSage is chosen as the backbone model structure because it can effectively learn various local topological structures and generalize well to new structures. The message passing and fusion process is as follows:

[0102]

[0103] Where F represents the input node attribute matrix, F[,:] represents the node attributes, and A[:,] represents the v-th column in the adjacency matrix. It is the embedding of nodes, W 1 These are weight parameters, representing activation functions like ReLU.

[0104] The node generator is used to generate synthetic nodes based on node representations, targeting a minority of nodes in the data. Specifically, after obtaining the representation of each node in the embedding space constructed by the feature extractor, synthetic nodes are generated for the minority of nodes in the data. Specifically, the SMOTE algorithm is used, which increases general oversampling by changing repeated interpolation. The basic idea of ​​the SMOTE algorithm is to interpolate samples from the target minority class in the embedding space and interpolate the nearest neighbors of the target minority class in the embedding space. The specific process is as follows:

[0105] set up It is a labeled minority node with the label Y. u First find the... The closest labeled node in the same class, i.e.

[0106]

[0107] Here, nn(v) refers to the nearest neighbor of v in the same class, which is measured using Euclidean metric in the embedding space.

[0108] Using nearest neighbors, the resulting composite node is:

[0109]

[0110] Here, δ is a random variable that follows a uniform distribution in the range [0,1].

[0111] because and Nodes belonging to the same class and very close to each other are generated as composite nodes. They should also belong to the same class, thus obtaining a labeled composite node.

[0112] An edge generator is used to obtain the adjacency information of a synthesized node; specifically, the generator is trained on actual nodes and existing edges to predict the neighbor information of the synthesized node. These new nodes and edges are added to the initial adjacency matrix and used as input to a GNN-based classifier.

[0113] To keep the model simple and make the analysis easier, a weighted inner product is used to implement the edge generator, as shown below:

[0114]

[0115] Among them, E v,u S represents the predicted relationship information between nodes v and u, and S represents the parameter matrix that captures the interaction between nodes.

[0116] The edge generator is trained using a loss function, which is:

[0117]

[0118] Here, E represents the predicted connection between nodes in V.

[0119] The label propagator is used to assign pseudo-labels to the synthesized nodes; the goal of label propagation is to find a prediction matrix Y that matches the label matrix. L The specific formula is as follows:

[0120]

[0121] Where Y(0) = Y, and K represents the power iteration step number. The predicted label is represented by the transpose matrix T, which can be set as a normalized adjacency matrix. After propagating the label K times, the predicted label can obtain the neighborhood label information with a distance of K hops. Therefore, we designed an adaptive label propagation algorithm, the specific formula of which can be expressed as:

[0122]

[0123] Where γ ik γ represents the degree of influence of k-hop neighborhood information on the predicted label. ik It can be represented as:

[0124]

[0125] in, Note that vector W is the weight matrix and ReLU is the activation function. The adaptive label propagation operator adjusts its propagation strategy for each node by setting the attention vector and weight matrix as learnable parameters, and finally, the smoothed labels can capture the rich structural information in the input graph.

[0126] The GNN classifier combines synthetic nodes, adjacency information, and real nodes to construct a node-balanced graph for classification; a second GraphSage block is used, with an additional linear layer for... The nodes on the table are categorized as follows:

[0127]

[0128]

[0129] Among them, H 2 The node representation matrix represents the second GraphSage block, and W represents the weight parameters. P v This represents the probability distribution over the class labels of node v. The classifier module was optimized using cross-entropy loss.

[0130]

[0131] During the test, nodes v and Y... v The prediction class is set to the class with the highest probability.

[0132]

[0133] It should be noted that the feature extractor, node generator, edge generator, label propagator, and GNN classifier described above correspond to the steps in Embodiment 1. The examples and application scenarios implemented by these modules and their corresponding steps are the same, but they are not limited to the content disclosed in Embodiment 1. It should also be noted that these modules, as part of the system, can be executed in a computer system, such as a set of computer-executable instructions.

[0134] Example 3

[0135] Embodiment 3 of the present invention provides an electronic device, including a memory and a processor, as well as computer instructions stored in the memory and running on the processor. When the computer instructions are executed by the processor, they complete the steps of the above-mentioned social user classification method based on graph neural networks.

[0136] Example 4

[0137] Embodiment 4 of the present invention provides a computer-readable storage medium for storing computer instructions, which, when executed by a processor, complete the steps of the above-described social user classification method based on graph neural networks.

[0138] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0139] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0140] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment, whereby a series of operational steps are performed to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0141] The descriptions of each embodiment in the above embodiments have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0142] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A social user classification method based on graph neural networks, characterized in that, include: Given the original graph structure data constructed from social user data, obtain node representations and perform oversampling operations based on these node representations. Generate composite nodes for a small number of nodes in the data; Based on the composite node, obtain the adjacency information of the composite node; Assign pseudo-labels to the synthesized nodes; By combining synthetic nodes, adjacency information, and real nodes, a node balance graph is constructed for classification. The step of assigning pseudo-labels to the synthetic nodes is as follows: Based on the weight matrix and neighborhood label information, the degree of influence of neighborhood label information on the predicted label is obtained; The predicted label is obtained based on the degree of influence of the original label and neighboring label information on the predicted label.

2. The social user classification method based on graph neural networks as described in claim 1, characterized in that, The specific steps for performing oversampling operations to generate synthetic nodes based on node representation are as follows: For a small number of nodes in the data, the corresponding node representations are obtained through feature extraction; Based on the attribute and topology information of a small number of nodes, a synthetic node is generated.

3. The social user classification method based on graph neural networks as described in claim 1, characterized in that, The specific steps for constructing a node balance graph by combining synthetic nodes, adjacency information, and real nodes are as follows: By concatenating the real node embeddings with the synthetic node embeddings, an enhanced node representation set is obtained; Embed the synthesized node into the tag node set to obtain the enhanced tag set.

4. The social user classification method based on graph neural networks as described in claim 1, characterized in that, Before classification, the network is trained using an objective function to obtain a graph neural network classification model.

5. The social user classification method based on graph neural networks as described in claim 4, characterized in that, The objective function is: in, Let cross-entropy be the loss function. The loss function for training the edge generator. The objective function for adaptive label propagation is... For hyperparameters, These are the parameters for the feature extractor, edge generator, and node classifier, respectively.

6. The social user classification method based on graph neural networks as described in claim 4, characterized in that, A two-layer GraphSage model is used as the backbone structure.

7. A social user classification system based on graph neural networks, characterized in that, Including features Extractor, node generator, edge generator, label propagator, and GNN classifier; The feature extractor is used to obtain the original graph structure data constructed based on social user data, and to obtain node representations based on the original graph structure data; The node generator is used to generate composite nodes based on a few nodes in the data, according to the node representation. The edge generator is used to obtain the adjacency information of the composite node based on the composite node; The label propagator is used to assign pseudo-labels to the synthesized nodes; The GNN classifier is used to combine synthetic nodes, adjacency information, and real nodes to construct a node balance graph for classification. The step of assigning pseudo-labels to the synthetic nodes is as follows: Based on the weight matrix and neighborhood label information, the degree of influence of neighborhood label information on the predicted label is obtained; The predicted label is obtained based on the degree of influence of the original label and neighboring label information on the predicted label.

8. An electronic device, characterized in that, It includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, perform the steps described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, Used to store computer instructions, which, when executed by a processor, perform the steps described in any one of claims 1-6.