Training method, prediction method, training device and prediction device of image classification model

By employing a dual-graph classifier architecture and comprehensive loss optimization, the bias of graph classification models towards simple subgraphs is addressed, while attention to complex subgraphs is enhanced, thereby improving the model's generalization performance and prediction accuracy.

CN118982700BActive Publication Date: 2026-02-03INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410954687.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2026-02-03
Estimated Expiration
2044-07-16

AI Technical Summary

Technical Problem

Existing graph classification models tend to overemphasize simple loop structures and neglect polar functional groups during training, leading to a decline in generalization ability. Furthermore, subgraph fusion methods and information bottleneck methods cannot effectively distinguish between causal correlations and spurious correlations, affecting the model's generalization performance.

Method used

A dual-graph classifier architecture is adopted, in which label predictive subgraphs are extracted by first and second subgraph extractors, and the comprehensive loss, including the main loss and the distinctness loss, is calculated using different mask matrices. The model parameters are adjusted to train the graph classification model to ensure that the model focuses on different subgraph patterns.

Benefits of technology

This improves the graph classification model's attention to complex subgraphs, avoids over-focusing on simple subgraphs, and enhances the model's generalization ability and prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118982700B_ABST
    Figure CN118982700B_ABST
Patent Text Reader

Abstract

The present disclosure provides a kind of training method of graph classification model, prediction method, training device and prediction device, training method includes: obtaining the training graph data including information structure graph, wherein, information structure graph includes molecular structure graph or sentiment text graph;First label predictive subgraph and second label predictive subgraph are extracted from training graph data using first subgraph extractor and second subgraph extractor respectively;First label and second label corresponding to first label predictive subgraph and second label subgraph are predicted using first subgraph classifier and second subgraph classifier respectively;According to first label, second label, first subgraph extractor and second subgraph extractor, the first mask matrix and the second mask matrix learned by the first mask matrix and the second mask matrix are used to calculate comprehensive loss, and the parameters of first graph classifier and second graph classifier are adjusted to train to obtain graph classification model with the minimum target of comprehensive loss, wherein, first mask matrix and second mask matrix are different from each other.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the fields of artificial intelligence and deep learning, and more specifically, to a training method, prediction method, training device, and prediction device for a graph classification model. Background Technology

[0002] In image recognition, a typical example of spurious relevance is relying on the background rather than the shape of the object. In natural language understanding, this manifests as a preference for specific words rather than grasping the overall meaning of the sentence. In graph-based tasks, a significant example is focusing on the scaffold of a molecule rather than the actually important functional groups. Due to message-passing mechanisms, structural patterns with higher levels of modularity and complexity may receive more attention.

[0003] More specifically, in the context of predicting water solubility, the presence of ring structures is not the actual determinant of solubility. While molecules with ring structures generally exhibit poor water solubility, the actual determinant of solubility is the polar functional groups that endow the molecule with polarity, such as hydroxyl and amino groups. However, for models trained using stochastic gradient descent (SGD), focusing on ring structures in the graph is often simpler than focusing on polar functional group structures. This can lead to the model overemphasizing simple and spurious features while neglecting to learn complex but causal features, significantly impacting the model's generalization ability.

[0004] To address the problem of out-of-distribution generalization failure, the most effective and widely adopted strategy is based on subgraph fusion. Subgraph fusion methods first use a subgraph extractor to identify underlying invariant or causal subgraphs that maintain consistent relevance to target labels across various graph distributions in different environments. Subsequently, it combines the invariant subgraphs with spurious subgraphs (complements of the invariant subgraphs) from another instance to augment the dataset and achieve improved results. When spurious subgraphs are simpler patterns that also predict training labels, the subgraph extractor faces challenges in extracting invariant subgraphs due to simplicity bias. If the estimated invariant subgraph portion contains spurious information, assigning the label corresponding to the invariant portion to the fusion graph may reinforce the spurious correlation between the spurious subgraph and the label. Another class of work is based on information bottleneck (IB), which aims to achieve generalization by maximizing the mutual information between the label and the invariant subgraph while minimizing the mutual information between the subgraph and the entire graph. However, the IB method itself cannot distinguish between causal and spurious correlations between extracted subgraphs and labels. This limitation may cause the IB method to retain spurious information in the extracted subgraphs. This problem becomes more severe when spurious subgraphs are simpler patterns that are also predictive on the training set. Summary of the Invention

[0005] One of the objectives of this invention is to obtain a graph classification model that can effectively predict the labels of information structure graphs such as sentiment text graphs and molecular structure graphs.

[0006] According to a first aspect of this disclosure, a training method for a graph classification model is provided. The graph classification model includes a first graph classifier and a second graph classifier. The first graph classifier includes a first subgraph extractor and a corresponding first subgraph classifier. The second graph classifier includes a second subgraph extractor and a corresponding second subgraph classifier. The training method includes: acquiring training graph data including an information structure graph, wherein the information structure graph includes a molecular structure graph or a sentiment text graph; extracting a first label predictive subgraph and a second label predictive subgraph from the training graph data using the first subgraph extractor and the second subgraph extractor, respectively; predicting a first label and a second label corresponding to the first label predictive subgraph and the second label subgraph, respectively, using the first subgraph classifier and the second subgraph classifier; calculating a comprehensive loss based on the first label, the second label, the first subgraph extractor, and the second subgraph extractor using a learned first mask matrix and a second mask matrix, respectively; and adjusting the parameters of the first graph classifier and the second graph classifier with the goal of minimizing the comprehensive loss, to train a graph classification model, wherein the first mask matrix and the second mask matrix are different from each other.

[0007] According to embodiments of this disclosure, the step of calculating the comprehensive loss based on the first label, the second label, the first subgraph extractor, and the second subgraph extractor through the first mask matrix and the second mask matrix respectively may include: calculating the main loss based on the first label and the second label; determining the dissimilarity loss based on the Jaccard similarity between the first mask matrix and the second mask matrix; and calculating the comprehensive loss based on the main loss and the dissimilarity loss.

[0008] According to embodiments of this disclosure, the overall loss can be calculated based on the main loss, the dissimilarity loss, and a predetermined diversity weight.

[0009] According to embodiments of this disclosure, each of the first and second label predictive subgraphs can be obtained through the following steps: encoding training graph data into nodes using a graph neural network; mapping the concatenated representations of node pairs obtained from the nodes to mask probabilities using a multilayer perceptron; sampling the mask probabilities using the Gumbel-Sigmoid technique to obtain binarized mask probabilities; obtaining a mask matrix based on the binarized mask probabilities and the mask probabilities; and obtaining the first or second predictive subgraph based on the mask matrix and the adjacency matrix of the graph data.

[0010] According to embodiments of this disclosure, each of the first label and the second label can be predicted as follows: the predictive subgraph is mapped to a feature matrix using a GNN model; the feature matrices of all nodes are aggregated to obtain a feature vector; the feature vector is input into a multilayer perceptron to predict the first label or the second label.

[0011] According to a second aspect of this disclosure, a prediction method for a graph classification model is provided. The prediction method includes: acquiring validation graph data including an information structure graph, wherein the information structure graph includes a molecular structure graph or a sentiment text graph; inputting the validation graph data into a graph classification model trained by the above training method; selecting the graph classification model with the highest accuracy from a first graph classification model and a second graph classification model; acquiring test graph data including the information structure graph; and inputting the test graph data into the selected graph classification model to predict labels related to the molecular structure graph or the sentiment text graph.

[0012] According to a third aspect of this disclosure, a training apparatus for a graph classification model is provided. The training apparatus includes: the graph classification model includes a first graph classifier and a second graph classifier; the first graph classifier includes a first subgraph extractor and a first subgraph classifier corresponding to the first subgraph extractor; the second graph classifier includes a second subgraph extractor and a second subgraph classifier corresponding to the second subgraph extractor; the training apparatus includes: an acquisition module for acquiring training graph data including an information structure graph, wherein the information structure graph includes a molecular structure graph or a sentiment text graph; and a label predictive subgraph acquisition module for acquiring training graph data from the training graph data using the first subgraph extractor and the second subgraph extractor respectively. The system extracts a first-label predictive subgraph and a second-label predictive subgraph. A label acquisition module uses a first subgraph classifier and a second subgraph classifier to predict the first label and the second label corresponding to the first-label predictive subgraph and the second-label subgraph, respectively. A model generation module calculates the comprehensive loss based on the first label, the second label, the first subgraph extractor, and the second subgraph extractor using the learned first mask matrix and second mask matrix, respectively. It then adjusts the parameters of the first and second graph classifiers with the goal of minimizing the comprehensive loss to train a graph classification model. The first mask matrix and the second mask matrix are different from each other.

[0013] According to embodiments of this disclosure, the model generation module is configured to: calculate the main loss based on the first label and the second label; determine the dissimilarity loss based on the Jaccard similarity between the first mask matrix and the second mask matrix; and calculate the comprehensive loss based on the main loss and the dissimilarity loss.

[0014] According to a fourth aspect of this disclosure, a prediction apparatus for a graph classification model is provided. The prediction apparatus includes: an acquisition module for acquiring verification graph data and test graph data, including an information structure graph, wherein the information structure graph includes a molecular structure graph or an emotional text graph; a model selection module for inputting the verification graph data into a graph classification model trained by the above-described training method, and selecting the graph classification model with the highest accuracy from a first graph classification model and a second graph classification model; and a prediction module for inputting the test graph data into the selected graph classification model to predict labels related to the molecular structure graph or the emotional text graph.

[0015] According to a fifth aspect of this disclosure, a computer device is provided, the computer device including a memory and a processor, the memory storing instructions or programs that, when loaded and run by the processor, cause the processor to perform the training method and / or the prediction method described above.

[0016] Beneficial effects

[0017] The training method according to embodiments of the present disclosure enables graph neural networks to notice not only simple subgraph patterns, but also complex subgraph models, thereby avoiding focusing only on simple subgraph models that are often pseudo-correlated with labels, which affects the generalization ability of the model. Attached Figure Description

[0018] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings.

[0019] Figure 1 This is a flowchart of a graph classifier training method according to an embodiment of the present disclosure;

[0020] Figure 2 This is a flowchart for calculating the overall loss according to embodiments of the present disclosure;

[0021] Figure 3 This is a flowchart of obtaining a label predictive subgraph according to an embodiment of the present disclosure;

[0022] Figure 4 This is a flowchart illustrating the prediction of labels according to embodiments of the present disclosure;

[0023] Figure 5 This is a framework diagram of a graph classification model according to an embodiment of the present disclosure;

[0024] Figure 6 This is a block diagram of a training apparatus for a graph classifier according to an embodiment of the present disclosure;

[0025] Figure 7 This is a block diagram of a prediction apparatus for a graph classifier according to an embodiment of the present disclosure. Detailed Implementation

[0026] The following detailed description is provided to aid in obtaining a full understanding of the methods, apparatus, and / or systems described herein. However, the order of operations described herein is merely illustrative and is not limited to those orders set forth herein; equivalent substitutions or changes may be made, except for operations that must occur or be performed in a specific order. Furthermore, for clarity and conciseness, descriptions of content well-known in the art will be omitted or simplified.

[0027] Unless otherwise defined, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains upon understanding this disclosure. Unless expressly defined herein, terms (such as those defined in a general dictionary) shall be interpreted as having a meaning consistent with their meaning in the context of the relevant field and in this disclosure, and shall not be interpreted in an idealized or overly formalistic manner.

[0028] Unless otherwise specified, the same reference numerals generally refer to the same elements (e.g., components, steps, and methods). Reference numerals described in previous embodiments that reappear in later embodiments may be omitted. Furthermore, technical features described in different or the same embodiments can be combined in any way, as long as the combined embodiment or technical solution is complete and can solve the technical problems of this application or achieve the technical effects described or not described in this disclosure but which can be determined based on the complete technical solution described above. The terminology used in this disclosure is explained below.

[0029] It should be noted that, where there is no conflict between the various embodiments, these embodiments and their features can be combined with each other.

[0030] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process and related descriptions of the system described above can be found in the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0031] The graph classification model according to embodiments of this disclosure can be used to predict labels for various information structure graphs, such as molecular structure graphs and sentiment text graphs. Both molecular structure graphs and sentiment text graphs are graph data that can be represented by adjacency matrices, etc. The graph classification model of this disclosure is more suitable for graph data with relatively few nodes. The graph classification model of this disclosure can accurately predict label information in molecular structure graphs and sentiment text graphs. As an example, the graph classification model trained according to the training method of embodiments of this disclosure can predict whether a molecular structure is toxic or not (which is of great significance for drug target identification and lead compound screening); in addition, the graph classification model trained according to the training method of embodiments of this disclosure can also predict whether the sentiment expressed in the text corresponding to the sentiment text graph is positive or negative, etc., which is of great value for accurately identifying text content and understanding text semantics.

[0032] This disclosure effectively addresses the simple bias problem in graph classification by utilizing subgraph distinctness masks, enabling graph neural networks to notice not only simple subgraph patterns but also complex subgraph models. By applying subgraph mask distinctness loss, this disclosure ensures that two models focus on different subgraphs, preventing models from focusing only on environmental or spurious subgraphs and improving generalization performance. The following detailed description, in conjunction with embodiments of this disclosure, further illustrates this point.

[0033] Figure 1 This is a flowchart of a graph classifier training method according to an embodiment of the present disclosure; Figure 2 This is a flowchart for calculating the overall loss according to embodiments of the present disclosure; Figure 3 This is a flowchart of obtaining a label predictive subgraph according to an embodiment of the present disclosure; Figure 4 This is a flowchart illustrating the prediction of labels according to embodiments of the present disclosure; Figure 5 This is a framework diagram of a graph classification model according to an embodiment of the present disclosure; Figure 6 This is a block diagram of a training apparatus for a graph classifier according to an embodiment of the present disclosure; Figure 7 This is a block diagram of a prediction apparatus for a graph classifier according to an embodiment of the present disclosure.

[0034] Reference Figure 5 The graph classification model according to embodiments of this disclosure includes a first graph classifier and a second graph classifier. The first graph classifier includes a first subgraph extractor and a first subgraph classifier corresponding to the first subgraph extractor. The second graph classifier includes a second subgraph extractor and a second subgraph classifier corresponding to the second subgraph extractor. Although Figure 5 A set of graph classification models including two graph classifiers is shown, but this is merely an example. The graph classification models disclosed herein may also include three or more graph classifiers, each of which may have the same construction, i.e., may include a subgraph extractor and a subgraph classifier, wherein each of the subgraph extractor and the subgraph classifier may include a multilayer perceptron (MLP) and a graph neural network (GNN), but this is merely an example, and each of the subgraph extractor and the subgraph classifier may include other neural network models.

[0035] Reference Figure 5 The green subgraph (wheel pattern) and the blue subgraph (house pattern) are both subgraphs that predict the labels on the training set (i.e., label-predictive subgraphs), and there is a strong spurious correlation between these two patterns. By applying a subgraph mask distinctness loss, the two graph classification models can be made to focus on different subgraphs, thereby avoiding the model focusing only on the environment subgraph or the spurious subgraph.

[0036] Reference Figure 1In step S110, training graph data, including information structure graphs, is acquired. These information structure graphs can include molecular structure graphs or sentiment text graphs, which can be derived from molecular structure and sentiment text data. For example, molecular structure graphs can be generated from data exported by molecular modeling software, extracting information about nodes (atoms) and connections (chemical bonds) to construct an adjacency matrix. The sentiment text data can be social network data, etc.

[0037] In step S120, a first label predictive subgraph and a second label predictive subgraph are extracted from the training graph data using a first subgraph extractor and a second subgraph extractor, respectively.

[0038] As described above, each of the first and second subgraph extractors may include a multilayer perceptron (MLP) and a graph neural network (GNN). Here, a label-predictive subgraph refers to a subgraph with label-predictive power, containing only the key information that is most helpful for label prediction.

[0039] For example, in the task of predicting the water solubility of molecules, if the -OH functional group is the key factor determining whether a molecule is water-soluble, then for a model used to predict molecular water solubility, the subgraph represented by the -OH functional group is likely to be a subgraph with label predictive power. In the application of graph neural networks, finding such subgraphs can help people better understand which key features the model is based on for prediction, thereby gaining more understanding of the key features of the data to guide further research. In other words, label predictive subgraphs contain the most valuable information for predicting labels and can effectively reflect the importance of each subgraph.

[0040] For details, please refer to Figure 3 Each of the first label predictive subgraph and the second label predictive subgraph can be obtained through steps S310, S320, S330, S340 and S350.

[0041] In step S310, the training graph data is encoded into nodes using a graph neural network. For example, an initial feature vector can be assigned to each node in the graph, and then information about its neighboring nodes is collected, processed, and fused according to predetermined rules. After multiple iterations and learning processes through the neural network layers, the feature vectors of the nodes are obtained. For instance, a graph G can be encoded into a set of node representations using a graph neural network.

[0042] In step S320, a multilayer perceptron can be used to map the concatenated representations of node pairs obtained from the nodes to mask probabilities.

[0043] For each edge (v) i ,v j)∈E, the concatenated representation of node pairs (z) can be achieved using a multilayer perceptron (MLP). i ,z j ) is mapped to a mask probability p ij ∈[0,1], see equation (1) below for details.

[0044]

[0045] p ij =σ(MLP) mask ([z i ,z j ])) (1)

[0046] In equation (1), σ(·) represents the sigmoid function, [·,·] represents concatenation, and MLP mask This refers to a masked multilayer perceptron (MLP) or a GNN. mask To represent a masked graph neural network, using a molecular dataset as an example, an edge representation e is also introduced. ij To calculate p ij For details, please refer to equation (2) below.

[0047] p ij =σ(MLP) mask ([z i ⊕e ij ,zj⊕e ij (2)

[0048] In equation (2), ⊕ denotes the element-wise summation of the vector.

[0049] After obtaining the mask probability, in step S330, the Gumbel-Sigmoid technique can be used to sample the mask probability to obtain the binarized mask probability.

[0050] As an example, in each forward propagation of the training process, a predictive subgraph, denoted as m, can be extracted by sampling from the Bernoulli distribution. ij ~Bern(p ij Due to the inherent nondifferentiability of Bernoulli sampling, directly from Bern(p) ij Sampling cannot be optimized. To ensure m ij The gradient can be calculated and can be sampled using the Gumbel-Sigmoid technique, as detailed in equation (3).

[0051]

[0052] In equation (3), G represents the Gumbel distribution, G = -log(-log(U)), where U is a random number uniformly distributed between (0, 1). τ is a temperature parameter; when τ is large, the output approaches a continuous distribution, and when τ is close to 0, the output approaches a discrete value.

[0053] In step S340, the mask matrix M is obtained based on the binarized mask probability and the mask probability.

[0054] Given q ij The nondifferentiability of m can be attributed to ij gradient, m ij The calculation method is as follows (4), where the symbol ⊥ indicates the cessation of gradient propagation.

[0055]

[0056] Each element of the mask matrix M can be calculated from m using equation (4). ij .

[0057] In step S350, a first predictive subgraph or a second predictive subgraph is obtained based on the mask matrix and the adjacency matrix of the graph data.

[0058] For example, the extracted predictive subgraphs (first predictive subgraph and second predictive subgraph) can both be represented as the induced adjacency matrix AP = M⊙A, where M represents the learned mask matrix, A is the adjacency matrix of the original graph G, ⊙ denotes element-wise multiplication, and the subgraph corresponding to AP is denoted as G. P .

[0059] In step S130, the first label and the second label corresponding to the first label predictive subgraph and the second label subgraph are predicted using the first subgraph classifier and the second subgraph classifier, respectively.

[0060] For details, please refer to Figure 4 Each of the first and second labels can be predicted through steps S410, S420 and S430.

[0061] In step S410, the predictive subgraph is mapped to a feature matrix using a GNN model. In step S420, the feature matrices of all nodes are aggregated to obtain a feature vector. In step S430, the feature vector is input into a multilayer perceptron to predict either a first label or a second label.

[0062] Specifically, in obtaining the predictive subgraph G P Then, the induced subgraph can be mapped to the representation h using a GNN model. g This means that the label is fed into the subsequent MLP layer for classification or regression to obtain the first label and the second label, as shown in Equation (5) below.

[0063]

[0064] h G =READOUT(H)

[0065]

[0066] In equation (5), GNN feat (G p The graph neural network model learns the embedding representation of each node in the graph. This process involves the message passing mechanism mentioned earlier. Through multiple iterations, each node updates its feature representation based on information from its neighbors, resulting in a feature matrix H, where n is the total number of nodes in the graph. Then, the feature vectors of all nodes are aggregated into a vector h by a readout or aggregation operation (READOUT(H)). G (This represents the features of the entire graph). As an example, common aggregation methods include summation and averaging. Finally, the graph-level feature vector is input into a multilayer perceptron (MLP) to predict the first label. Second label

[0067] Taking molecular structure diagrams as an example, the labels here can be whether the molecular structure is hydrophilic, toxic, etc.

[0068] Reference Figure 5 The first label is predicted by the first subgraph classifier and the second subgraph classifier respectively. Second label As an example, it can be based on the first tag Second label Calculate the main loss L main (That is, the difference between the predicted value and the actual value).

[0069] In step S140, the first tag can be used as a reference. Second tag The first subgraph extractor and the second subgraph extractor calculate the combined loss using the first mask matrix and the second mask matrix learned respectively, and adjust the parameters of the first graph classifier and the second graph classifier (e.g., the weights, biases, etc. of the neural network) with the goal of minimizing the combined loss to train a graph classification model, wherein the first mask matrix and the second mask matrix are different from each other.

[0070] As mentioned above, it can be based on the first tag Second label Calculate the main loss L main (That is, the difference between the predicted value and the actual value).

[0071] Reference Figure 2 The steps of calculating the comprehensive loss based on the first label, the second label, the first subgraph extractor, and the second subgraph extractor through the first mask matrix and the second mask matrix learned respectively may include steps S210, S220, and S230.

[0072] In step S210, the main loss is calculated based on the first label and the second label.

[0073] In step S220, the dissimilarity loss is determined based on the Jaccard similarity between the first mask matrix and the second mask matrix.

[0074] To inject diversity into the models in the ensemble, we can consciously encourage each model to focus on a different subgraph. Suppose the ensemble contains m models, corresponding to a set S of prediction masks for each model. M It can be expressed as equation (6).

[0075] S M ={M1,…,M m}. (6)

[0076] Jaccard loss can be applied as a diversity regularizer to penalize the overlap of each pair of prediction masks in the set, as specifically expressed in Equation (7) below.

[0077]

[0078] Where i,j∈{1,2,…,m},i≠j are indices of different models. This indicates the loss due to heterogeneity.

[0079] In step S230, the comprehensive loss L is calculated based on the main loss and the dissimilarity loss.

[0080] As an example, the overall loss is calculated based on the main loss, the dissimilarity loss, and a pre-determined diversity weight. For instance, the overall loss L can be the sum of the product of the dissimilarity loss and the diversity weight and the main loss, with the diversity weight being 0.5. However, this is just an example, and the diversity weight, as a hyperparameter, can be adjusted based on the validation set.

[0081] The prediction method according to embodiments of this disclosure outperforms the baseline model on virtually all metrics on GOOD-Motif and GOOD-SST2, as detailed in Table 1 below.

[0082] Table 1

[0083]

[0084] Referring to Table 1, the graph classification model disclosed herein outperforms various existing methods (e.g., IRM (Invariant Risk Minimization), ERM (Empirical Risk Minimization), VREx (Extremum Variance Regularization), Group DRO (Grouped Distributed Robust Optimization), CORAL (Covariance Regularization Adaptation), DANN (Domain Adversarial Neural Network), Mixup (Hybrid Data Augmentation), DIR (Distributed Robust Optimization), GSAT (Graph Stochastic Attention), CIGA (Causal Heuristic Invariant Graph Learning)) in terms of both basis and size on the GOOD-Motif dataset. Specifically, it is superior in both covariate and probability bias. Similarly, the graph classification model disclosed herein also outperforms most existing methods in terms of length on the GOOD-SST2 dataset, again demonstrating superior covariate and probability bias. After training the graph classification model, it can be validated on a validation set and tested on a test set.

[0085] Specifically, validation graph data and test graph data, including information structure graphs, can be obtained. Similarly, the information structure graphs here can also include molecular structure graphs or sentiment text graphs. Then, the validation graph data is input into the graph classification model trained by the above training method. The graph classification model with the highest accuracy is then selected from the first graph classification model and the second graph classification model. Finally, the test graph data is input into the selected graph classification model to predict the labels related to the molecular structure graph or sentiment text graph.

[0086] Reference Figure 6 The training apparatus 600 for a graph classification model according to an embodiment of the present disclosure may include a first acquisition module 610, a label predictability subgraph acquisition module 620, a label acquisition module 630, and a model generation module 640.

[0087] As described above, the graph classification model according to embodiments of this disclosure includes a first graph classifier and a second graph classifier, each graph classifier including a subgraph extractor and a subgraph classifier corresponding to the subgraph extractor, although Figure 5 A set of graph classification models including two graph classifiers is shown, but this is merely an example. The graph classification models disclosed herein may also include three or more graph classifiers, each of which may have the same construction, i.e., may include a subgraph extractor and a subgraph classifier, wherein each of the subgraph extractor and the subgraph classifier may include a multilayer perceptron (MLP) and a graph neural network (GNN), but this is merely an example, and each of the subgraph extractor and the subgraph classifier may include other neural network models.

[0088] The first acquisition module 610 can acquire training graph data including information structure graphs. As mentioned above, the information structure graphs may include molecular structure graphs or sentiment text graphs.

[0089] The label prediction subgraph acquisition module 620 can extract a first label prediction subgraph and a second label prediction subgraph from the training graph data using the first subgraph extractor and the second subgraph extractor, respectively. The first label prediction subgraph and the second label prediction subgraph can be different.

[0090] The label acquisition module 630 can use the first subgraph classifier and the second subgraph classifier to predict the first label and the second label corresponding to the first label prediction subgraph and the second label subgraph, respectively.

[0091] The model generation module 640 can calculate the comprehensive loss based on the first label, the second label, the first subgraph extractor, and the second subgraph extractor through the first mask matrix and the second mask matrix learned respectively, and adjust the parameters of the first graph classifier and the second graph classifier with the goal of minimizing the comprehensive loss to train a graph classification model, wherein the first mask matrix and the second mask matrix are different from each other.

[0092] As an example, the model generation module 640 can be configured to: calculate the main loss based on the first label and the second label; determine the distinctness loss based on the Jaccard similarity between the first mask matrix and the second mask matrix; and calculate the comprehensive loss based on the main loss and the distinctness loss. The specific execution steps of the model generation module 640 can be as described above, and will not be repeated here. Although not shown, the first acquisition module 610, the label predictability subgraph acquisition module 620, the label acquisition module 630, and the model generation module 640 can each perform the steps described above, and will not be repeated here.

[0093] Reference Figure 7 The graph classification model prediction device 700 according to the embodiments of the present disclosure may include a second acquisition module 710, a model selection module 720 and a prediction module 730.

[0094] The second acquisition module 710 can acquire verification graph data and test graph data, including information structure graphs, wherein the information structure graphs include molecular structure graphs or emotional text graphs.

[0095] The model selection module 720 can input the validation graph data into the graph classification model mentioned above, and select the graph classification model with the highest accuracy from the first graph classification model and the second graph classification model.

[0096] The prediction module 730 can input test graph data into a selected graph classification model to predict labels associated with molecular structure graphs or sentiment text graphs.

[0097] Although not shown, the second acquisition module 710, the model selection module 720, and the prediction module 730 can each perform the steps described above, which will not be repeated here.

[0098] It should be noted that the above embodiments are merely illustrative examples of the division of functional modules. In practical applications, the functions can be assigned to different functional modules as needed, that is, the modules or steps in the embodiments of this disclosure can be further decomposed or combined. For example, the modules in the above embodiments can be merged into one module, or further divided into multiple sub-modules to complete all or part of the functions described above. The names of the modules and steps involved in the embodiments of this invention are merely for distinguishing the various modules or steps and are not considered as an improper limitation of this disclosure.

[0099] At least one of the multiple modules can be implemented using an AI model. AI-related functions can be executed using non-volatile memory, volatile memory, and a processor.

[0100] The processor may include one or more processors. In this case, the one or more processors may be general-purpose processors, such as central processing units (CPUs), application processors (APs), etc., processors used only for graphics (such as graphics processing units (GPUs), vision processors (VPUs), and / or AI-specific processors (such as neural processing units (NPUs)).

[0101] One or more processors control the processing of input data based on predefined operating rules or artificial intelligence (AI) models stored in non-volatile memory and volatile memory. The predefined operating rules or AI models can be provided through training or learning. Here, providing through learning means forming predefined operating rules or AI models with desired characteristics by applying a learning algorithm to multiple learning data sets. Learning can be performed within the device itself that performs AI according to the embodiment, and / or can be implemented through a separate server / device / system.

[0102] As an example, an artificial intelligence model can consist of multiple neural network layers. Each layer has multiple weight values, and layer operations are performed by computing the previous layer and manipulating the multiple weight values. Examples of neural networks include multilayer perceptrons and graph neural networks.

[0103] A learning algorithm is a method of training a predetermined target device (e.g., a robot) using multiple training datasets to enable, allow, or control the target device to make a determination or prediction. Examples of learning algorithms include, but are not limited to, supervised learning, unsupervised learning, semi-supervised learning, or reinforcement learning.

[0104] A computer-readable storage medium according to embodiments of the present disclosure stores a computer program or code that, when loaded and executed by a processor, causes the processor to perform the training method and / or the prediction method described above.

[0105] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process and related descriptions of the storage device and processing device described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0106] The instructions stored in the aforementioned computer-readable storage medium can be executed in environments deployed in computer devices such as clients, hosts, agent devices, and servers. It should be noted that the instructions can also be used to perform additional steps beyond those described above, or to perform more specific processing while executing the aforementioned steps. The details of these additional steps and further processing are already provided in the reference... Figures 1 to 7 As mentioned in the description of the relevant systems and methods, they will not be repeated here to avoid repetition.

[0107] It should be noted that the traffic flow prediction method according to the exemplary embodiments of this disclosure may rely entirely on the operation of computer programs or instructions to achieve the corresponding functions. That is, each device corresponds to each step in the functional architecture of the computer program, so that the entire system is called through a special software package (e.g., a lib library) to achieve the corresponding functions.

[0108] On the other hand, when the system, unit or module shown in the figures is implemented in software, firmware, middleware or microcode, the program code or code segment for performing the corresponding operation can be stored in a computer-readable medium such as a storage medium, so that at least one processor or at least one computing device can perform the corresponding operation by reading and running the corresponding program code or code segment. In addition, the computer-readable medium or storage medium can cause the processor to perform the above-mentioned training method and / or prediction method when the computer program is executed by the processor.

[0109] Examples of computer-readable storage media here include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, and so on.

[0110] The graph classification model trained according to the training method of the embodiments of this disclosure can effectively predict the labels of information structure graphs such as sentiment text graphs and molecular structure graphs.

[0111] The graph classifier trained by the training method according to embodiments of the present invention can effectively solve the simple bias problem in the classification of text graphs and molecular structure graphs, and enables the graph neural network to notice not only simple subgraph patterns, but also complex subgraph models, thereby improving the generalization ability of the model.

[0112] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A training method for a graph classification model, characterized in that, The graph classification model includes a first graph classifier and a second graph classifier. The first graph classifier includes a first subgraph extractor and a first subgraph classifier corresponding to the first subgraph extractor. The second graph classifier includes a second subgraph extractor and a second subgraph classifier corresponding to the second subgraph extractor. The training method includes: Acquire training graph data including information structure graphs, wherein the information structure graphs include molecular structure graphs or sentiment text graphs; The first subgraph extractor and the second subgraph extractor are used respectively to extract a first label predictive subgraph and a second label predictive subgraph from the training graph data; The first label and the second label corresponding to the first label predictive subgraph and the second label predictive subgraph are predicted using the first subgraph classifier and the second subgraph classifier, respectively. The integrated loss is calculated based on the first label, the second label, the first subgraph extractor, and the second subgraph extractor using the learned first mask matrix and second mask matrix, respectively. The parameters of the first and second graph classifiers are then adjusted with the goal of minimizing the integrated loss to train the graph classification model. The first mask matrix and the second mask matrix are different from each other. The steps for calculating the comprehensive loss based on the first label, the second label, the first subgraph extractor, and the second subgraph extractor through the learned first mask matrix and second mask matrix respectively include: Calculate the main loss based on the first label and the second label; The distinctness loss is determined based on the Jaccard similarity between the first mask matrix and the second mask matrix; The comprehensive loss is calculated based on the main loss and the heterogeneity loss.

2. The training method for the graph classification model according to claim 1, characterized in that, The overall loss is calculated based on the main loss, the dissimilarity loss, and a predetermined diversity weight.

3. The training method for the graph classification model according to claim 1, characterized in that, The first and second label predictive subgraphs are obtained by the corresponding subgraph extractors in the first and second subgraph extractors through the following steps: The training graph data is encoded into nodes using a graph neural network; The concatenated representations of node pairs obtained from the nodes are mapped to mask probabilities using a multilayer perceptron. The mask probability is sampled using the Gumbel-Sigmoid technique to obtain the binarized mask probability; The mask matrix is ​​obtained based on the binarized mask probability and the mask probability. The corresponding label predictive subgraph is obtained based on the mask matrix and the adjacency matrix of the graph data.

4. The training method for the graph classification model according to claim 3, characterized in that, The first label and the second label are predicted by the corresponding subgraph classifiers in the first and second subgraph classifiers in the following manner: The label prediction subgraph is mapped to a feature matrix using a GNN model; Aggregate the feature matrices of all nodes to obtain feature vectors; The feature vector is input into a multilayer perceptron to predict the corresponding label.

5. A prediction method for a graph classification model, characterized in that, The prediction method includes: Acquire verification graph data including an information structure graph, wherein the information structure graph includes a molecular structure graph or an emotional text graph; The verification graph data is input into a graph classification model trained by the training method according to any one of claims 1 to 4; Choose the graph classification model with the highest accuracy from the first graph classification model and the second graph classification model; Obtain test graph data, including the information structure diagram; The test graph data is input into the selected graph classification model to predict the labels associated with the molecular structure graph or sentiment text graph.

6. A training device for a graph classification model, characterized in that, The graph classification model includes a first graph classifier and a second graph classifier. The first graph classifier includes a first subgraph extractor and a first subgraph classifier corresponding to the first subgraph extractor. The second graph classifier includes a second subgraph extractor and a second subgraph classifier corresponding to the second subgraph extractor. The training device includes: The acquisition module acquires training graph data including information structure graphs, wherein the information structure graphs include molecular structure graphs or sentiment text graphs; The label prediction subgraph acquisition module extracts a first label prediction subgraph and a second label prediction subgraph from the training graph data using the first subgraph extractor and the second subgraph extractor, respectively. The label acquisition module uses the first subgraph classifier and the second subgraph classifier to predict the first label and the second label corresponding to the first label prediction subgraph and the second label prediction subgraph, respectively. The model generation module calculates the comprehensive loss based on the first label, the second label, the first subgraph extractor, and the second subgraph extractor using the learned first mask matrix and second mask matrix, respectively. It then adjusts the parameters of the first and second graph classifiers with the goal of minimizing the comprehensive loss to train the graph classification model. The first mask matrix and the second mask matrix are different from each other. The model generation module is configured as follows: Calculate the main loss based on the first label and the second label; The distinctness loss is determined based on the Jaccard similarity between the first mask matrix and the second mask matrix; The comprehensive loss is calculated based on the main loss and the heterogeneity loss.

7. A prediction device for a graph classification model, characterized in that, The prediction device includes: The acquisition module acquires verification graph data and test graph data, including information structure graphs, wherein the information structure graphs include molecular structure graphs or sentiment text graphs. The model selection module inputs the verification graph data into a graph classification model trained by the training method according to any one of claims 1 to 4, and selects the graph classification model with the highest accuracy between the first graph classification model and the second graph classification model. The prediction module inputs the test graph data into the selected graph classification model to predict the labels associated with the molecular structure graph or sentiment text graph.

8. A computer device, characterized in that, The computer device includes a memory and a processor, the memory storing instructions or programs that, when loaded and run by the processor, cause the processor to perform the training method according to any one of claims 1 to 4 and / or the prediction method according to claim 5.

Citation Information

Patent Citations

  • Dialogue emotion recognition network model based on knowledge enhancement and backtracking loss, construction method, electronic device and storage medium

    CN113987179A

  • Molecular graph attribute prediction method of graph random neural network based on dropout connection

    CN115860065A