Graph distribution external data classification method based on linear extension and graph enhancement
By constructing a graph data classification network model based on linear expansion and graph enhancement, the problem that the causal learning method cannot discover a complete causal subgraph is solved, and the prediction performance of graph data classification outside the distribution is improved.
Patent Information
- Application Number
- CN202510718709.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-08-15
AI Technical Summary
The existing causal learning methods cannot find complete causal sub-graphs, resulting in a degradation in the classification prediction performance of data outside the graph distribution.
Using a method based on linear expansion and graph enhancement, a data classification network model of graph distribution is constructed, including feature extraction module, sub-graph selection module, causal sub-graph selection module, graph enhancement module and linear graph decision-making module. A new sub-graph is generated through multi-layer perceptron and Gumbel-Sigmoid processing, and a sub-graph selector is optimized using MSE and cross-entropy loss function, and more training data is constructed in combination with gradient inversion and graph enhancement technology.
The prediction performance of the external classification of graph data distribution is improved, the causal information is fully explored, and the prediction failure caused by incomplete causal sub-graphs is avoided, and the performance is better than the existing methods.
Smart Images

Figure CN120495785A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of out-of-graph distribution data classification methods, and relates to an out-of-graph distribution data classification method based on linear expansion and graph enhancement. Background Art
[0002] Out-of-graph data classification involves training on a subset of graph data and then using graph data from different distributions for prediction. In our daily lives, a wide range of application scenarios require modeling using graph data, such as simulating complex relationships and dependencies between entities, interactions between molecules and atoms, and social networks. Graph data, composed of nodes and edges, can address the lack of expressive power of implicit relationships in two-dimensional image data.
[0003] Unlike natural images, generalizing out-of-distribution classification on graphs faces two significant challenges. First, traditional images are regular grids, suitable for convolution operations. However, graph data consists of nodes and edges, with an irregular structure, making traditional convolutions infeasible. Second, graph data has a complex topological structure, which amplifies the effects of distribution differences, making out-of-distribution classification tasks even more challenging.
[0004] The current mainstream approach to addressing this out-of-distribution generalization problem is to utilize causal learning and graph augmentation. By exploring the causal mechanisms within graph data, we can identify causal subgraphs that are causally relevant for prediction. These causal subgraphs remain constant across different distributions. Therefore, as long as neural networks can use causal subgraphs for prediction in different environments, they can maintain good predictive performance across different distributions. The primary approach for exploring causal mechanisms is structural causal models (SCMs), which identify causal subgraphs by maximizing the mutual information between causal subgraphs and labels. However, existing causal learning methods cannot discover complete causal subgraphs. Consequently, relying solely on causal subgraphs for prediction at the output end leads to reduced performance. Summary of the Invention
[0005] The purpose of the present invention is to provide a data classification method outside the graph distribution based on linear expansion and graph enhancement, which solves the problem that the causal learning method in the prior art cannot discover the complete causal subgraph, and the output end only relies on the causal subgraph for prediction, resulting in a decrease in prediction performance.
[0006] The technical solution adopted by the present invention is a method for classifying out-of-graph distribution data based on linear expansion and graph enhancement, which is specifically implemented in the following steps: Step 1: Obtain a generalized dataset outside the graph distribution and divide it into a training set, a test set, and a validation set; Step 2: Build a network model for out-of-graph distribution data classification based on linear expansion and graph enhancement; Step 3: Design a total loss function, input the data in the training set into the out-of-graph distribution data classification network model, adjust the weight parameters and perform training to obtain a trained out-of-graph distribution data classification network model; Step 4: Use the validation set and test set to test the trained out-of-graph distribution data classification network model to obtain the test accuracy based on the optimal validation accuracy; Step 5: Use the tested and verified out-of-graph distribution data classification network model to perform out-of-graph distribution data classification.
[0007] The present invention is also characterized in that: Preferably, the out-of-graph distribution data classification network model based on linear expansion and graph enhancement in step 2 includes a feature extraction module, a subgraph selection module, a causal subgraph selection module, a graph enhancement module, and a linear graph decision module.
[0008] Preferably, the feature extraction module is GIN Network, the graph data in the training set ,in , , X represents the node feature matrix, A Represents the connection relationship, that is, the adjacency matrix, m Represents the number of nodes, represents the feature dimension, Represents the real number field, and the graph data G Input GIN In the network, feature processing is performed to obtain graph data after feature processing Z , specifically: (1) in, GIN It is a three-layer graph isomorphic network with a hidden layer dimension of 300.
[0009] Preferably, the subgraph selection module includes two subgraph selectors, each of which includes a multilayer perceptron connected in sequence. MLP and the multiparameters of discrete random variables Gumbel-Sigmoid Processing module, graph data after feature processing by feature extraction module Z Pass by in sequence MLP and Gumbel-Sigmoid Processing to obtain the mask matrix , and then the mask matrix With the original image data G Multiply to get a new subgraph , and then use the loss function to constrain the two subgraph selectors; After the feature extraction module has processed the graph data Z, it passes through MLP and Gumbel-SigmoidProcessing to obtain the mask matrix Specifically: (2) The mask matrix With the original image data G Multiply to get a new subgraph Specifically: (3) in, is the activation function, is the Hadamard product, which is element-wise multiplication, n=1,2,3,...,N, Represents the nth new subgraph selected by the subgraph selector.
[0010] Preferably, the loss function is used to constrain the two subgraph selectors as follows: The distance between the two subgraph selectors to generate new subgraphs is amplified by variance. At the same time, for each independent subgraph selector, each subgraph selector internally decides N new subgraphs, and the N new subgraphs decided by each subgraph selector are separated by using MSE The loss function reduces the distance; The distance between two subgraph selectors to generate new subgraphs by variance amplification is specifically: (4) in, A new subgraph selected by a different subgraph selector 、 The result of variance calculation; Represents the nth new subgraph The predicted label of Represents the nth new subgraph of another subgraph selector The predicted label of is the image data label, is the cross entropy loss, Var Indicates variance; The predicted labels are obtained as follows: (5) Among them, the graph data to be predicted is extracted through the GIN network and then MLP and softmax Get the output label, which is the predicted label; In formula (4) 、 That is, the corresponding 、 It is obtained by processing according to formula (5); Among them, the multiple subgraphs determined by each subgraph selector are used MSE The loss function reduces the distance, and the result of the MSE loss calculation is: When N=2, then: (6) When N>2, a subgraph is first selected from the N new subgraphs selected by each subgraph selector as the reference subgraph. The reference subgraphs selected by the two subgraph selectors are respectively and , then the result of MSE loss calculation is: (7) in, The result of MSE loss calculation between the two new subgraphs decided by each subgraph selector, where 、 Indicates two different subgraphs selected by a subgraph selector. 、 Indicates two different subgraphs selected by another subgraph selector; The total loss As shown in formula 8: (8) in, and is a hyperparameter.
[0011] Preferably, the causal subgraph selection module obtains the causal subgraph by averaging the multiple subgraphs determined by the two subgraph selectors. , specifically: (9) Then according to the causal subgraph Get non-causal subgraph : (10) in: represents the difference set; Then the graph data label is realized through the label discriminator and non-causal subgraphs Isolation, environmental labeling through environmental identifier and causal subgraphs The two-way loss of the label discriminator and the environment discriminator is back-propagated to the subgraph selector by using the gradient reversal operation to realize the causal mechanism, specifically: (11) (12) in, is the loss of the environment discriminator, is the loss of the label discriminator, is an optimizable parameter of the subgraph selector, and represents the optimal parameters obtained by the subgraph selector during the optimization process of the environment discriminator and the label discriminator, and Represent the network parameters after the subgraph selector on the environment discriminator and label discriminator branches respectively. The causal subgraph is obtained by formula (5) and non-causal subgraphs The corresponding predicted label and , is the cross entropy loss.
[0012] Preferably, the graph enhancement module is used to construct a new graph data by randomly shuffling the non-causal subgraph and randomly splicing it with the causal subgraph. , specifically: (13) in, stands for random shuffle, The number represents the reorganization and splicing to construct the new graph data Continue to be input into the feature extraction module as new training data; use GIN Network The eigenvalue of , The eigenvalue of , then After random shuffling and Perform splicing to obtain the enhanced graph features : (14) in, indices is a randomly shuffled index, It is the graph feature after graph enhancement. For splicing operation; The enhanced graph data is obtained through formula (5), which is the new graph data. The predicted label , then with the graph data labels Do cross entropy loss to get graph enhancement loss : (15) is the image enhancement loss, is the cross entropy loss.
[0013] Preferably, the linear graph decision module selects the subgraph obtained by the subgraph selector and Mapped to the output label space and averaged, the causal subgraph obtained by the causal subgraph selection module is Map to the output label space, and linearly reorganize the two parts in the label space to obtain the final prediction result : (16) in, Represents the output classifier, which is composed of GIN and MLP It consists of the process of extracting the corresponding graph data features and mapping them to the output space, and finally softmax Convert the output into a probability distribution, For the sake of expectation; Then With graph data labels Find the cross entropy loss to get the output loss : (17) in, represents the cross entropy loss.
[0014] Preferably, the total loss function in step 3 is for: (18) During training, the total loss function Minimum is the goal, and Used to optimize label discriminators and environment discriminators; Set the training parameters to: 100 epochs of training, using the Adam optimizer.
[0015] The beneficial effects of the present invention are: The present invention takes into account the fact that traditional deep learning does not meet the situation where the training and test distributions differ in real-world scenarios. It uses the idea of causal learning and a linear expansion method to change a single subgraph selector into two. At the same time, multiple subgraphs are generated inside each subgraph selector at the same time. These subgraphs are simultaneously mapped to the output distribution space as part of the decision output. We use MSE loss and variance to ensure the stability of the selection inside each subgraph selector, as well as the differences between different subgraph selectors, to avoid the situation where all subgraphs are the same. Finally, by finding a combination of multiple subgraphs, we obtain a causal subgraph. At the same time, graph enhancement technology is used to construct more training data, making the discovery of causal subgraphs more complete and sufficient. This solves the problem that existing methods often only rely on the causal subgraph obtained by the final decision when searching for causal subgraphs, but cannot discover complete causal subgraphs.
[0016] Experiments have shown that the present invention performs well in graph classification tasks outside of graph data distribution, and is superior to existing advanced causal learning methods. The model fully mines the causal information in the graph network, making the causal subgraph discovery more complete, while avoiding to a certain extent the problem of prediction failure caused by incomplete causal subgraphs. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a workflow diagram of the network model for out-of-graph distribution data classification in the out-of-graph distribution data classification method based on linear expansion and graph enhancement of the present invention; Figure 2 This is a workflow diagram of the feature extraction module and the subgraph selection module in the out-of-graph distribution data classification method based on linear expansion and graph enhancement of the present invention; Figure 3 This is a workflow diagram of the causal subgraph selection module in the graph distribution data classification method based on linear expansion and graph enhancement of the present invention; Figure 4 This is a workflow diagram of the graph enhancement module in the graph distribution out-of-graph data classification method based on linear expansion and graph enhancement of the present invention. DETAILED DESCRIPTION
[0018] The following describes it in detail with reference to specific implementation methods.
[0019] Example 1 The present invention is based on a method for out-of-graph distribution data classification based on linear expansion and graph enhancement, which is specifically implemented in the following steps: Step 1: Obtain a generalized dataset outside the graph distribution and divide it into a training set, a test set, and a validation set; Step 2: Build a network model for out-of-graph distribution data classification based on linear expansion and graph enhancement; Step 3: Design a total loss function, input the data in the training set into the out-of-graph distribution data classification network model, adjust the weight parameters and perform training to obtain a trained out-of-graph distribution data classification network model; Step 4: Use the validation set and test set to test the trained out-of-graph distribution data classification network model to obtain the test accuracy based on the optimal validation accuracy; Step 5: Use the tested and verified out-of-graph distribution data classification network model to perform out-of-graph distribution data classification.
[0020] Example 2 On the basis of Example 1, the graph distribution data classification network model based on linear expansion and graph enhancement in step 2 includes a feature extraction module, a subgraph selection module, a causal subgraph selection module, a graph enhancement module, and a linear graph decision module. Its workflow is as follows: Figure 1 shown.
[0021] Feature extraction module uses GIN The network acts as a backbone network to process data outside the graph distribution and randomly selects graph data from the training set. ,in , , respectively representing the node feature matrix and the connection relationship, that is, the adjacency matrix, m Represents the number of nodes. represents the feature dimension, Represents the real number domain, and inputs the graph data in the generalized dataset outside the graph distribution into GIN In the network, feature processing is performed; The subgraph selection module uses two subgraph selectors. The two subgraph selectors each decide on multiple subgraphs. The variance is amplified to enlarge the distance between the subgraphs generated by the two subgraph selectors. At the same time, the variance is amplified to enlarge the distance between the multiple subgraphs decided by each independent subgraph selector. MSE Reduce the distance and send the graph data processed by the feature in step 2.1 into MLP In the above example, we get a mask matrix. This mask matrix After multiplying with the original image data, the selected new sub-image can be obtained ; Sub-image selector application Gumbel-Sigmoid Reparameterization techniques can avoid network non-differentiability problems caused by subgraph sampling.
[0022] Example 3 On the basis of Example 2, Figure 2 As shown, the feature extraction module is GIN Network, the graph data in the training set ,in , , X represents the node feature matrix,A Represents the connection relationship, that is, the adjacency matrix, m Represents the number of nodes. represents the feature dimension, Represents the real number field, and the graph data G Input GIN In the network, feature processing is performed to obtain graph data after feature processing Z , specifically: (1) in, GIN It is a three-layer graph isomorphic network with a hidden layer dimension of 300.
[0023] The subgraph selection module includes two subgraph selectors, each of which includes a multi-layer perceptron connected in sequence. MLP and the multiparameters of discrete random variables Gumbel-Sigmoid Processing module, the graph data Z after feature processing by feature extraction module passes through MLP and Gumbel-Sigmoid Processing to obtain the mask matrix , and then the mask matrix With the original image data G Multiply to get a new subgraph , and then use the loss function to constrain the two subgraph selectors.
[0024] After the feature extraction module has processed the graph data Z, it passes through MLP and Gumbel-Sigmoid Processing to obtain the mask matrix Specifically: (2) The mask matrix With the original image data G Multiply to get a new subgraph Specifically: (3) in, is the activation function, is the Hadamard product, which is element-wise multiplication, n=1,2,3,...,N, Represents the nth new subgraph selected by the subgraph selector.
[0025] The loss function is used to constrain the two subgraph selectors as follows: The distance between the two subgraph selectors to generate new subgraphs is amplified by variance. At the same time, for each independent subgraph selector, each subgraph selector internally decides N new subgraphs, and the N new subgraphs decided by each subgraph selector are separated by using MSE The loss function reduces the distance; The distance between two subgraph selectors to generate new subgraphs by variance amplification is specifically: (4) in, A new subgraph selected by a different subgraph selector 、 The result of variance calculation; Represents the nth new subgraph The predicted label of Represents the nth new subgraph of another subgraph selector The predicted label of is the image data label, is the cross entropy loss; When using variance-constrained differences, we use the loss of each subgraph to calculate the variance. In this process, in order to calculate the cross entropy, we need to use the graph data prediction labels to solve the cross entropy loss. The prediction labels are obtained as follows: (5) Among them, the graph data to be predicted is subjected to feature extraction by the GIN network and then passed through MLP and softmax to obtain the output label, which is the predicted label; In formula (4) 、 That is, the corresponding 、 It is obtained by processing according to formula (5); Among them, the multiple subgraphs determined by each subgraph selector are used MSE The loss function reduces the distance as follows: When N=2, then: (6) When N>2, a subgraph is first selected from the N new subgraphs selected by each subgraph selector as the reference subgraph. The reference subgraphs selected by the two subgraph selectors are respectively and , then the result of MSE loss calculation is: (7) in, The result of MSE loss calculation between the two new subgraphs decided by each subgraph selector, where 、 Indicates two different subgraphs selected by a subgraph selector. 、 Indicates two different subgraphs selected by another subgraph selector; in, This is to keep the subgraphs decided by different subgraph selectors different to avoid all the subgraphs being the same. This is to maintain the stability of the internal decision of each subgraph selector, because when we select a causal subgraph, we essentially select the part of the graph that is stable and will not change. MSE loss to achieve stability within each subgraph selector.
[0026] The total loss As shown in formula 8: (8) in, and is a hyperparameter.
[0027] Example 4 On the basis of Example 3, Figure 3 As shown, the causal subgraph selection module obtains the causal subgraph by averaging the multiple subgraphs determined by the two subgraph selectors. , specifically: (9) Then according to the causal subgraph Get non-causal subgraph : (10) in: represents the difference set; In order to realize the two causal independence mechanisms, the gradient reversal operation is mainly used to realize domain confrontation. Two discriminators are used, namely the label discriminator is used to realize , the environment discriminator is used to implement The environment here This can be understood as a factor that produces non-causal subgraphs. Generally, we believe that a graph has only one label, but in order to implement the environment discriminator, we use prior knowledge to give the graph data an environment label. These two losses reverse the gradient when backpropagating to the subgraph selector framework to implement this part of the causal mechanism. Then the graph data label is realized through the label discriminator and non-causal subgraphs Isolation, environmental labeling is achieved through environmental discriminator and causal subgraphs The two-way loss of the label discriminator and the environment discriminator is back-propagated to the subgraph selector by using the gradient reversal operation to realize the causal mechanism, specifically: (11) (12) in, is the loss of the environment discriminator, is the loss of the label discriminator, is an optimizable parameter of the subgraph selector, and represents the optimal parameters obtained by the subgraph selector during the optimization process of the environment discriminator and the label discriminator, and Represent the network parameters after the subgraph selector on the environment discriminator and label discriminator branches, and are the labels predicted by the causal subgraph and the labels predicted by the non-causal subgraph, and the causal subgraph is obtained by formula (5) and non-causal subgraphs The corresponding predicted label and , is the cross entropy loss; Take the GOOD-CMNIST dataset as an example. This dataset is a digital classification dataset. Represents the numbers 1 to 9, which are the graph data labels, and represents the background color that is not related to the number, the causal part represents the graph structure that determines the number category, and the non-causal part represents the graph structure that determines the background color, such as a red 9. It's 9. It's red.
[0028] Example 5 On the basis of Example 4, Figure 4 As shown, the graph enhancement module is used to construct new graph data by randomly shuffling the non-causal subgraph and randomly splicing it with the causal subgraph. , specifically: (13) in, stands for random shuffle, The number represents the reorganization and splicing to construct the new graph data Continue to be input into the feature extraction module as new training data; use GIN Network The eigenvalue of , The eigenvalue of , then After random shuffling and Perform splicing to obtain the enhanced graph features : (14) in, indices is a randomly shuffled index, It is the graph feature after graph enhancement. For splicing operation; The enhanced graph data is obtained through formula (5), which is the new graph data. The predicted label , then with the graph data labels Do cross entropy loss to get graph enhancement loss : (15) is the label predicted by the enhanced graph data, is the image enhancement loss, is the cross entropy loss.
[0029] Example 6 Based on Example 5, the linear graph decision module converts the subgraph obtained by the subgraph selector into and Mapped to the output label space and averaged, the causal subgraph obtained by the causal subgraph selection module is Map to the output label space, and linearly reorganize the two parts in the label space to obtain the final prediction result : (16) in, Represents the output classifier, which is composed of GIN and MLP It consists of the process of extracting the corresponding graph data features and mapping them to the output space, and finally softmax Convert the output into a probability distribution, For the sake of expectation; Then With graph data labels Find the cross entropy loss to get the output loss : (17) in, represents the cross entropy loss.
[0030] Preferably, the total loss function in step 3 is for: (18) During training, the total loss function Minimum is the goal, and Used to optimize label discriminators and environment discriminators; Set the training parameters to: 100 epochs of training, using the Adam optimizer.
[0031] Example 7 Based on Example 6, to verify the effectiveness of the present invention, the domain adversarial training (DANN) of the graph out-of-distribution data classification network model and neural network, the adaptive structure-aware pooling (ASAP) for learning hierarchical graph representations, the discovery of invariant fundamentals of graph neural networks (DIR), interpretable and generalizable graph learning based on random attention mechanism (GSAT), causally invariant representation learning (CIGA) for out-of-distribution generalization on graphs, and joint learning of causal independence of labels and environments (LECI) for out-of-distribution generalization on graphs were tested on the Twitter, HIV-scaffold, HIV-size, and CMNIST datasets. The learning rate was 0.00001 when using the Twitter dataset, 0.0001 when using the HIV-scaffold and HIV-size datasets, and 0.001 when using the CMNIST dataset. The batch size was set to 32 when using the Twitter, HIV-scaffold, and HIV-size datasets, and 64 or 128 when using the CMNIST dataset. The test results are shown in Table 1: Table 1
[0032] Table 1 shows that the classification prediction performance of the model of the present invention is significantly improved compared to the existing technology. This is because the present invention addresses the problem of insufficient exploration of causal mechanisms and the inability to maintain good generalization performance using causal subgraphs alone. At the same time, it combines graph enhancement methods to construct more training environments, and obtains better classification prediction results in graph classification problems of existing out-of-graph generalization methods.
Claims
1. A graph out-of-distribution data classification method based on linear expansion and graph enhancement, characterized by: The specific implementation steps are as follows: Step 1: Obtain a generalized dataset outside the graph distribution and divide it into a training set, a test set, and a validation set; Step 2: Build a network model for out-of-graph distribution data classification based on linear expansion and graph enhancement; Step 3: Design a total loss function, input the data in the training set into the out-of-graph distribution data classification network model, adjust the weight parameters and perform training to obtain a trained out-of-graph distribution data classification network model; Step 4: Use the validation set and test set to test the trained out-of-graph distribution data classification network model to obtain the test accuracy based on the optimal validation accuracy; Step 5: Use the tested and verified out-of-graph distribution data classification network model to perform out-of-graph distribution data classification.
2. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 1 is characterized in that: The out-of-graph distribution data classification network model based on linear expansion and graph enhancement in step 2 includes a feature extraction module, a subgraph selection module, a causal subgraph selection module, a graph enhancement module, and a linear graph decision module.
3. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 2 is characterized in that: The feature extraction module is GIN Network, the graph data in the training set ,in , , X represents the node feature matrix, A Represents the connection relationship, that is, the adjacency matrix, m Represents the number of nodes. represents the feature dimension, Represents the real number field, and the graph data G Input to GIN In the network, feature processing is performed to obtain graph data after feature processing Z , specifically: (1) in, GIN It is a three-layer graph isomorphic network with a hidden layer dimension of 300.
4. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 3 is characterized in that: The subgraph selection module includes two subgraph selectors, each of which includes a multi-layer perceptron connected in sequence. MLP and the multiparameters of discrete random variables Gumbel-Sigmoid Processing module, the graph data Z after feature processing by feature extraction module passes through MLP and Gumbel-Sigmoid Processing to obtain the mask matrix , and then the mask matrix With the original image data G Multiply to get a new subgraph , and then use the loss function to constrain the two subgraph selectors.
5. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 4 is characterized in that: After the feature extraction module has processed the graph data Z, it passes through MLP and Gumbel-Sigmoid Processing to obtain the mask matrix Specifically: (2) The mask matrix With the original image data G Multiply to get a new subgraph Specifically: (3) in, is the activation function, is the Hadamard product, which is element-wise multiplication, n=1,2,3,...,N, Represents the nth new subgraph selected by the subgraph selector.
6. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 5 is characterized in that: The use of the loss function to constrain the two subgraph selectors is specifically as follows: The distance between the two subgraph selectors to generate new subgraphs is amplified by variance. At the same time, for each independent subgraph selector, each subgraph selector internally decides N new subgraphs, and the N new subgraphs decided by each subgraph selector are separated by using MSE The loss function reduces the distance; The distance between two subgraph selectors to generate new subgraphs by variance amplification is specifically: (4) in, A new subgraph selected by a different subgraph selector 、 The result of variance calculation; Represents the nth new subgraph The predicted label of Represents the nth new subgraph of another subgraph selector The predicted label of is the image data label, is the cross entropy loss; The predicted labels are obtained as follows: (5) Among them, the graph data to be predicted is extracted through the GIN network and then MLP and softmax Get the output label, which is the predicted label; In formula (4) 、 That is, the corresponding 、 It is obtained by processing according to formula (5); Among them, the multiple subgraphs determined by each subgraph selector are used MSE The loss function reduces the distance as follows: When N=2, then: (6) When N>2, a subgraph is first selected from the N new subgraphs selected by each subgraph selector as the reference subgraph. The reference subgraphs selected by the two subgraph selectors are respectively and , then the result of MSE loss calculation is: (7) in, The result of MSE loss calculation between the two new subgraphs decided by each subgraph selector, where 、 Indicates two different subgraphs selected by a subgraph selector. 、 Indicates two different subgraphs selected by another subgraph selector; The total loss As shown in Equation 6: (8) in, and is a hyperparameter.
7. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 6 is characterized in that: The causal subgraph selection module obtains a causal subgraph by averaging multiple subgraphs determined by two subgraph selectors. , specifically: (9) Then according to the causal subgraph Get non-causal subgraph : (10) in: represents the difference set; Then the graph data label is realized through the label discriminator and non-causal subgraphs Isolation, realize environmental labeling through environmental discriminator and causal subgraphs The two-way loss of the label discriminator and the environment discriminator is back-propagated to the subgraph selector by using the gradient reversal operation to realize the causal mechanism, specifically: (11) (12) in, is the loss of the environment discriminator, is the loss of the label discriminator, is an optimizable parameter of the subgraph selector, and represents the optimal parameters obtained by the subgraph selector during the optimization process of the environment discriminator and the label discriminator, and Represent the network parameters after the subgraph selector on the environment discriminator and label discriminator branches, and are the labels predicted by the causal subgraph and the labels predicted by the non-causal subgraph, and the causal subgraph is obtained by formula (5) and non-causal subgraphs The corresponding predicted label and , is the cross entropy loss.
8. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 7 is characterized in that: The graph enhancement module is used to construct new graph data by randomly shuffling the non-causal subgraph and randomly splicing it with the causal subgraph. , specifically: (13) in, stands for random shuffle, The number represents the reorganization and splicing to construct the new graph data Continue to be input into the feature extraction module as new training data; use GIN Network The eigenvalue of , The eigenvalue of , then After random shuffling and Perform splicing to obtain the enhanced graph features : (14) in, indices is a randomly shuffled index, It is the graph feature after graph enhancement. For splicing operation; The enhanced graph data is obtained through formula (5), which is the new graph data. The predicted label , then with the graph data labels Do cross entropy loss to get graph enhancement loss : (15) is the label predicted by the enhanced graph data, is the image enhancement loss, is the cross entropy loss.
9. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 8 is characterized in that: The linear graph decision module selects the subgraph obtained by the subgraph and Mapped to the output label space and averaged, the causal subgraph obtained by the causal subgraph selection module is Map to the output label space, and linearly reorganize the two parts in the label space to obtain the final prediction result : (16) in, Represents the output classifier, which is composed of GIN and MLP It consists of the process of extracting the corresponding graph data features and mapping them to the output space, and finally softmax Convert the output into a probability distribution, For the sake of expectation; Then With graph data labels Find the cross entropy loss to get the output loss : (17) in, represents the cross entropy loss.
10. The out-of-graph distribution data classification method based on linear expansion and graph enhancement according to claim 9 is characterized in that: The total loss function in step 3 for: (18) During training, the total loss function Minimum is the goal, and Used to optimize label discriminators and environment discriminators; Set the training parameters to: 100 epochs of training, using the Adam optimizer.