Knowledge graph small sample node classification method based on meta-learning
By employing a task difficulty-driven meta-learning framework and a pseudo-label enhancement mechanism, the problems of insufficient task scheduling and class discriminability in graph few-sample node classification are solved, achieving efficient and stable node classification in complex graph structures.
Patent Information
- Application Number
- CN202511912291.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-21
AI Technical Summary
Existing graph few-sample node classification methods have shortcomings in task scheduling, self-supervised pseudo-label utilization, and feature discriminative modeling, which limits the generalization and stability of the model under few-sample conditions, especially in complex graph structures where the class distinction is insufficient.
A unified meta-learning framework is proposed, which dynamically schedules task difficulty through a task difficulty-driven meta-training strategy, a Poisson-based pseudo-label generation and a negative sample augmentation contrastive learning mechanism, and utilizes high-confidence unlabeled node information to enhance inter-class discriminability and achieve continuous knowledge transfer and fusion.
It improves the model's generalization ability and stability under small sample conditions, and can achieve higher classification accuracy and robustness in complex graph structures, adapting to graph scenarios where labeled data is scarce and categories change dynamically.
Smart Images

Figure CN121901823A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of neural network technology, specifically to a few-sample node classification method for knowledge graphs based on meta-learning, applicable to few-sample learning and node classification scenarios on graph structure data. Background Technology
[0002] In recent years, graph neural networks have made significant progress in processing graph-structured data. These models, by aggregating feature information from node neighbors, can effectively capture relational dependencies in graph structures and have been widely applied in various practical fields such as social network analysis, recommender systems, bioinformatics, and knowledge graph construction. Among the various tasks of graph neural networks, node classification is the most core and fundamental problem, aiming to predict the category of unlabeled nodes using the attribute features and topological relationships of known nodes in the graph.
[0003] However, existing node classification methods largely rely on sufficient and high-quality manually labeled data. Model performance is usually closely related to the number of labeled nodes, but in practical applications, especially in fields involving privacy protection or high costs (such as medicine and biology), obtaining large-scale labeled data is often difficult. High labeling costs, class imbalance, and privacy restrictions result in a scarcity of labeled nodes in the graph, which limits the model's training effectiveness and reduces its generalization performance.
[0004] To address the problem of scarce annotations, graph few-shot node classification tasks have emerged. This task aims to enable the model to quickly adapt to the classification requirements of new categories by learning from a small number of samples, thus possessing cross-category transfer and rapid adaptation capabilities. Unlike traditional node classification methods, few-shot learning emphasizes the model's generalization and adaptability, rather than memorizing existing categories. To achieve this goal, meta-learning has become a mainstream approach. Meta-learning learns a set of model parameters or optimization rules that can quickly adapt to new tasks through cross-task training, allowing the model to effectively learn with a small number of samples when facing new categories.
[0005] While meta-learning methods have achieved some success in graph few-shot classification, existing research still faces three main challenges: First, task sampling lacks difficulty modeling. Current methods generally employ random task sampling strategies during the meta-training phase, failing to consider the differences in difficulty between different tasks. Since tasks differ in the number of categories, structural complexity, and node similarity, random sampling may lead to the model frequently encountering high-difficulty tasks in the early stages of training, causing optimization instability, reduced learning efficiency, and ultimately affecting generalization ability. Second, unlabeled node information is not fully utilized. Graph data typically contains a large number of unlabeled nodes, whose structural and semantic information has potential value for model learning. However, directly using these nodes easily introduces noise, reducing the model's discriminative power. Especially in few-shot scenarios, how to utilize unlabeled data while reducing noise interference is a significant challenge. Third, inter-class discriminative power is insufficient. Existing methods focus more on intra-class similarity modeling, neglecting the discriminative constraints between different categories. In complex graph structures, prototypes of different categories are prone to overlap or blurred boundaries, leading to a decline in model classification performance among similar categories.
[0006] In summary, existing graph few-shot node classification methods suffer from shortcomings in task scheduling, self-supervised pseudo-label utilization, and feature discriminative modeling, limiting the generalization and stability of the models in real-world scenarios. Therefore, there is an urgent need for a unified meta-learning framework capable of dynamically scheduling task difficulty, fully utilizing unlabeled information, and enhancing inter-class discriminability to improve the overall performance and robustness of graph few-shot node classification. Summary of the Invention
[0007] This invention proposes a unified meta-learning framework for graph few-sample node classification. This framework systematically optimizes the graph primitive learning process from three aspects: task scheduling, self-supervised pseudo-label enhancement, and negative sample modeling, to improve the model's generalization ability and stability under few-sample conditions. First, a task difficulty-driven meta-training strategy is proposed. By dynamically sorting and scheduling tasks, a training process from easy to difficult is achieved, and an information exchange mechanism is established between tasks to realize continuous knowledge transfer and fusion. Second, a pseudo-label generation module based on Poisson learning is designed. Utilizing high-confidence unlabeled node information combined with KL divergence regularization and prototype optimization, the model's discriminative ability at class boundaries is effectively improved. Finally, a contrastive learning mechanism with hard negative sample enhancement is introduced to strengthen feature discrimination ability and improve class separability, thereby achieving higher classification accuracy and robustness in complex graph structures.
[0008] A knowledge graph few-sample node classification method based on meta-learning includes the following steps:
[0009] Step 1, Graph Embedding Learning Stage: Features are extracted from the input graph data, and node embedding representations are calculated using multi-hop neighbor aggregation and attention mechanisms;
[0010] Step 2, Task Difficulty-Driven Meta-Training Scheduling: The difficulty of training tasks is assessed, and tasks are dynamically sorted and scheduled according to their complexity. This guides the model to gradually transition from simple tasks to complex tasks, enabling course-based learning and improving training stability.
[0011] Step 3, Pseudo-label enhancement based on Poisson learning: Using the graph structure and existing labeled samples, a Poisson learning model is constructed to generate high-confidence pseudo-label nodes. The pseudo-label samples are added to the support set to optimize the inter-class prototype distribution and enhance the model's representation ability. KL divergence is introduced as a regularization term to constrain the consistency between the pseudo-label distribution and the real distribution. The inter-class prototypes are calibrated to make the model have higher discriminative power at the class boundaries.
[0012] Step 4, Negative Sample Augmentation Training: Construct semantically similar but labeled nodes in the graph structure as hard negative samples, optimize the objective through comparative learning, improve the model's ability to identify nodes of different categories, and alleviate prototype confusion problem;
[0013] Step 5, inter-task knowledge transfer: During the meta-training process, the meta-parameters of the learned tasks are used as the initialization conditions for the next task, realizing the gradual transfer of knowledge from easy tasks to difficult tasks and improving the overall generalization performance.
[0014] Step 6, Meta-optimization and Meta-prediction Stage: The method learns transferable global knowledge and achieves adaptive balance between tasks through a meta-optimization process with inner and outer loops. In the meta-prediction stage, the model uses global prior parameters and high-confidence pseudo-labels to quickly adapt to new tasks and achieve efficient and accurate node classification.
[0015] The present invention has the following beneficial effects:
[0016] This invention introduces task adaptation and pseudo-label guidance mechanisms into a meta-learning framework, achieving hierarchical modeling and progressive optimization of complex patterns in graph structures, overcoming the bottlenecks of traditional methods that rely on random task sampling and limited labeled data. During training, the system adaptively adjusts the learning pace according to task difficulty, enabling the model to quickly master basic representation capabilities from low-complexity tasks and then gradually migrate to high-complexity tasks to improve generalization. Simultaneously, leveraging pseudo-label information generated by Poisson learning, this invention significantly improves unsupervised data utilization, further mitigating overfitting under small sample conditions by constraining the distribution consistency of different class prototypes. Combined with a contrastive learning module enhanced by hard negative samples, the model exhibits stronger robustness and discriminative power when distinguishing similar categories and complex structural nodes. Overall, this framework enables efficient and stable small-sample node classification in graph scenarios with scarce labeled data and dynamically changing categories, providing a practical solution for intelligent graph analysis and knowledge mining. Attached Figure Description
[0017] Figure 1 This is a flowchart of the method of the present invention;
[0018] Figure 2 This is a schematic diagram of the method framework of the present invention;
[0019] Figure 3 This is a comparative diagram of task distribution; Detailed Implementation
[0020] The present invention will now be described in detail with reference to the accompanying drawings and specific examples.
[0021] In this embodiment, the Amazon-Clothing dataset is used to verify the present invention. This dataset comes from the "Apparel, Footwear, and Jewelry" category on the Amazon platform and contains 24,919 product nodes and 91,680 product co-browsing relationship edges. Each node corresponds to a specific product, and its features are generated from the product's text description, which can be obtained based on the bag-of-words model or other text embedding methods. The edges in the graph represent two products being viewed consecutively or jointly by the same user during browsing, thereby establishing a co-browsing association between products.
[0022] The flowchart of the method of the present invention is as follows Figure 1 As shown in the diagram, the method framework is as follows: Figure 2 As shown. Specifically, it includes the following steps:
[0023] Step 1, Graph Embedding Learning Phase.
[0024] For a knowledge graph G = (V, ε, X, A) consisting of a node set, an edge set, an attribute matrix, and an adjacency matrix, where v i ∈V represents the i-th node in the node set, e ij ∈ε represents the edge connecting node i and node j in the edge set, X = in This represents the number of nodes; the i-th row of X represents node x. i The d-dimensional feature representation. An adjacency matrix consisting of 0s and 1s. If A ij =1, then there is an edge connecting node i and node j; otherwise, A ij =0. Number of nodes in the Amazon-Clothing dataset. The number of edges is 91680, and the feature dimension d = 9034.
[0025] In the input graph-structured data, features are first extracted from each node. To fully capture the multi-level structural relationships of the nodes, a multi-hop neighbor aggregation and attention mechanism is used to generate node embeddings. Specifically, the model aggregates neighbor information with different hop counts layer by layer and uses attention weights to measure the importance of different neighbor layers to obtain a comprehensive representation of the node. The calculation process is shown below.
[0026] F=σ(XW f ),H0≡F,
[0027] γ=σ(MW r ),
[0028] E = Squeeze(Reshape(γ)M)
[0029] in, This represents the initial node embedding matrix, where each row corresponds to the feature vector of a node, and the dimension is typically... in d is the number of nodes, and d is the feature dimension. W f σ is the weight matrix for feature transformation, used to project the initial node embeddings into the new feature space and participate in the linear transformation. σ(·) represents the activation function, used to increase nonlinear expressiveness. F is the node feature matrix after linear transformation and activation function, representing the projection of the initial embeddings. H0 is defined as F, indicating that the node features of the initial layer serve as the basis for subsequent cumulative calculations. Let represent the normalized symmetric adjacency matrix (excluding self-loops) of the i-hop neighbors, where It is the adjacency matrix of i-hop neighbors. It is its corresponding angle matrix. H i This represents the node feature matrix after graph structure aggregation at layer i, i.e., through... The product of F and F yields the updated node representation for each layer. This indicates a feature splicing operation. It is layer H i The concatenated embedding represents the comprehensive node representation after multi-layer graph feature aggregation, used for subsequent global processing. W r It is the weight matrix of the linear transformation, used to reproject the concatenated feature M. This is the attention coefficient, used to measure how much information from the aggregated neighbor representations obtained from different hop neighbors should be retained when generating the final representation of each node. The Squeeze and Reshape operations are used to match the dimensions of the matrix. The parameters of the node embedding module are represented as θ. e ={W f W rBy concatenating multi-level features and introducing nonlinear transformations, the model can better express the semantic differences between nodes, providing a foundation for subsequent task difficulty assessment and classification. The final output node embedding E serves as input for constructing subsequent tasks. In experiments with the Amazon-Clothing dataset, l=2 was used.
[0030] Step 2, Task difficulty-driven meta-training scheduling.
[0031] First, the nodes in the knowledge graph are divided into training, validation, and test sets according to their labels, with each set corresponding to a specific ratio, denoted as y. train y valid y test The label categories in the three sets do not overlap, that is... The model is trained on the training set, and then its performance is validated on the validation set. The timing for stopping the training is determined based on the validation results. The final trained model is then used on the test data. The Amazon-Clothing dataset has a total of 77 labels, which are divided into 40 training classes, 17 validation classes, and 20 test classes.
[0032] The goal of meta-learning is to enable models to quickly adapt to new tasks. Therefore, to simulate few-shot learning scenarios, data is typically organized into task sets, allowing the model to learn how to quickly adapt to new data distributions in each task. Meta-learning consists of two phases: meta-training and meta-testing. An episode-based training strategy is used, where task sets are randomly sampled from the training, validation, and test sets to form the meta-training task set. Meta-verification task set Heyuan Test Task Set And a meta-task By support set S i and query set Q i The model is composed of a support set containing a small number of labeled samples, which the model uses for rapid adaptation and parameter tuning. The query set contains samples used to evaluate the model's adaptation. This partitioning effectively simulates the learning and testing process of a model under limited labeling conditions in real-world scenarios. In meta-learning-based node classification tasks, the N-Way K-Shot task setting is particularly classic, with common sampling formats including 5-Way 3-Shot, 5-Way 5-Shot, 10-Way 3-Shot, and 10-Way 5-Shot. The N-Way K-Shot sampling mechanism involves sampling from Y... train (Y valid / Y test By randomly sampling N categories from the data, and then randomly sampling K+M nodes from each category, a support set and query set for a task are formed.
[0033]
[0034] Where Π represents the total number of sampling tasks, and the i-th meta-task By S i and Q i Composition. S i A total of N×K nodes were sampled, Q i A total of N×M nodes were sampled, (v i,1 v i,2 , ..., v i,k ) represents S i A node of a different category sampled from the middle, (y i,1 y i,2 , ..., y i,k ) represents S i The label corresponding to the sampled node, i.e., the category of the node. Q represents i Different nodes sampled in the middle, Q represents i The label corresponding to the sampling node.
[0035] The goal of the model is to, during the meta-testing phase, rely solely on a support set consisting of a small number of labeled samples to test categories Y that are not present in the training and validation sets. test The unlabeled query set nodes in the dataset are used for classification. Under this setting, meta-learning can learn an optimized initial state for the model, enabling the model to quickly adapt to new tasks with minimal supervision.
[0036] This invention proposes a dynamic ranking strategy based on task difficulty to optimize the traditional random sampling strategy. Starting from graph embedding features, it measures the complexity of each task and implements course-based training from easy to difficult. Task difficulty is measured from two dimensions: (1) Node dimension: Calculate the embedding similarity between nodes of the same type, reflecting the compactness within the task, specifically expressed as the following formula:
[0037]
[0038] (2) Category dimension: Calculate the similarity between prototypes of different categories, reflecting the separability of the task, specifically expressed as the following formula:
[0039]
[0040] The two are fused according to weights α and β (α+β=1) to obtain the total task difficulty index D, which is used to balance the node dimension similarity (D E ) and category-dimensional distinctiveness (D P The contribution of ) is specifically expressed by the following formula:
[0041] D=αD E +βDP
[0042] Where N represents the total number of categories, and Σ represents the summation operation. Let u and v represent the set of nodes belonging to category j, where u and v are the nodes of category j. j The elements in the array represent two distinct nodes, u and v. |V j | represents the size of the set, i.e., set V. j The number of nodes in the middle. E u E v E represents the embedding vectors of nodes u and v. u ·E v This represents the dot product of vectors, used to calculate the similarity between two vectors. ||E u || represents vector E u The norm of the vector (usually the L2 norm), which is the length of the vector. E The similarity metric representing the node dimension is calculated by averaging the pairwise cosine similarities of the node vectors within each task, reflecting the consistency of node representations within the task. j and P k Let D represent the prototype vectors corresponding to category j and category k, respectively, obtained by averaging the embeddings of all nodes within the corresponding category. P The similarity metric representing the category dimension is calculated by averaging the pairwise cosine similarity between the prototype vectors of different tasks, and a negative sign is used to indicate the discriminability between different tasks. In the Amazon-Clothing dataset difficulty calculation, α = 0.7 and β = 0.3.
[0043] During the meta-training phase, the system reorganizes the task set based on task difficulty scores, prioritizing training on lower-difficulty tasks and gradually transitioning to more complex tasks. This achieves stable knowledge transfer and parameter tuning, unlike the random distribution used in traditional methods. Figure 3 As shown.
[0044] Step 3: Pseudo-label enhancement based on Poisson learning.
[0045] To alleviate the problem of scarce small sample data, this invention introduces a Poisson learning label propagation mechanism to fully utilize the information from unlabeled nodes. Specifically, a set of unlabeled nodes is defined for each task. Where V i yes Select all nodes contained in the knowledge graph for the N categories, S i Q i Corresponding to The support set and query set are used, and iterative propagation is performed based on the Laplacian matrix of the graph, specifically expressed as the following formula:
[0046]
[0047] in, Indicates the number of steps the label has propagated. express The matrix after round iteration. D represents the degree matrix, D ii =∑ j W ij It is calculated from the weight matrix W, where W = A + A att Let A denote the adjacency matrix. att Let D represent the similarity attention weight matrix. -1 Let represent the inverse matrix of D. It is a label matrix, which provides information about the labeled nodes as a source for updates. This represents a matrix containing the values of 1 in the label column corresponding to each label node. It is the average of the labeled nodes, used for centering. It is a zero matrix, where |V| represents all nodes belonging to N categories. This represents the transpose of matrix B. L = DW is the Laplacian matrix, used to describe the smoothness of the graph. The current prediction U will be gradually adjusted, with the label information of the labeled nodes continuously being updated. Injection is performed, while the smoothing constraint L is adjusted through LU to ensure label consistency across the entire graph. Iterative updates continue until U converges, i.e., ||U||. (t) -U (t-1) When the change between two iterations of ‖<∈ is sufficiently small, we consider the label distribution of all nodes to have reached a stationary state. ∈ is a preset convergence threshold, preferably ranging from 10. -3 ~10 -5 The Amazon-Clothing dataset takes the number of steps for label propagation.
[0048] Subsequently, the obtained pseudo-label distribution is normalized using softmax, and the top k1 samples with the highest confidence (i.e., top_k1) are selected as the augmented dataset. To further improve the quality of the pseudo-labels, a square operation is used to enhance high-confidence predictions while weakening the impact of low-confidence predictions, thus avoiding noise interference on the model. This is specifically expressed as the following formula:
[0049]
[0050] Where top_k1(·) represents the top k1 samples with the highest confidence for each class j (j∈[1,N]). matrix, express The matrix at row i and column j represents the soft label probability value of the i-th node in the j-th category. j′ represents the category traversal index during the normalization process, used to sum the corresponding items of all categories to achieve normalization and ensure that the weight results satisfy the probability distribution constraints. express The i-th row and j'-th column of the matrix represents the soft label probability value corresponding to the i-th node in the j'-th category. This indicates that the corresponding terms of all categories j' are summed to ensure the normalization of confidence weights across the category dimension.
[0051] Finally, a self-training objective function based on KL divergence is introduced. (Task The KL loss is minimized by reducing the KL divergence, thus improving the original pseudo-label distribution. Gradually shifting towards the sharpened high-confidence distribution This approach enhances its ability to depict real-world categories. Specifically, it can be expressed as the following formula:
[0052]
[0053] In the subsequent meta-testing process, these high-confidence pseudo-labels were distributed... The corresponding nodes are added to the support set to expand the training data, optimize the class prototype distribution, and improve inter-class discrimination. The Amazon-Clothing dataset uses k1=30.
[0054] Step 4, contrastive learning for negative sample enhancement.
[0055] To address the issues of class overlap and prototype confusion in small-sample node classification, this invention proposes a contrastive learning mechanism combining hard negative sample mining. In each task, a convergence constraint is applied between nodes of the same class and their prototypes, while a distance constraint is applied between nodes of different classes and their prototypes, enhancing the discriminative power of the embeddings. Furthermore, a set of hard negative samples is constructed by selecting several samples most similar to the anchor node from the negative sample set, and these sample pairs are optimized to strengthen the model's ability to identify fine-grained boundaries. First, the obtained node embeddings are normalized to become unit vectors. For the task Given an anchor point Z vp Its positive sample set ind + It includes all nodes belonging to the same category as the anchor point, while the negative sample set ind - Includes all nodes that are different from the anchor category, ind all Ind represents all samples. The set of difficult negative samples is ind. hard Defined as ind hard =top_k2{j∈ind- |sim(z vp ,z j The top k2 (top_k2) nodes that are most similar to the anchor point among all negative samples. Optimizing these sample pairs enhances the discriminative power between categories, thus constituting the overall contrastive loss. (Task The negative sample enhancement contrast loss is specifically expressed as the following formula:
[0056]
[0057] Where Z is the task The normalized representation of the concatenation of the node embedding (E) and the prototype vector (P). Indicates task The set of all nodes and prototypes in the middle. This means that VP can be a task. Any node in Z can also be a prototype representation of a certain category in the task. vp This represents the normalized representation corresponding to the anchor point. m∈ind all That is, m belongs to any one of all samples, and the corresponding Z m Let h ∈ ind be the normalized representation of sample m. hard That is, h belongs to the set of difficult negative samples, and the corresponding Z h This represents the normalized representation of sample h. pos∈ind + That is, if pos belongs to any one of the positive samples, the corresponding Z pos This represents the normalized representation of sample pos. τ represents the temperature coefficient. Represents the contrastive loss for a single node or prototype vp. The entire mission The contrast loss is used. The Amazon-Clothing dataset uses k² = 30.
[0058] Step 5: Knowledge transfer and condition initialization between tasks.
[0059] The category-specific initialization parameter Λ is obtained through MLP mapping. j That is, the initialization parameters of class j, and the weights and biases of the MLP as learnable parameters θ. p The weights are randomly initialized, and the biases are a constant of 0; both are optimized during training. Introducing class information during model training makes the initial state of the model more discriminative, as shown in the following formula:
[0060] Λ j =MLP(P j ;θ p )
[0061] To achieve knowledge transfer between tasks, this invention introduces a conditional initialization mechanism, scaling transformation, and shift transformation, i.e., S, during the meta-learning process. 2 Transformation. When training a new task, the model first passes the task through a fully connected layer f(·). Support set S i Feature information and initialization parameters Λ j Perform a linear mapping and output the task. Task set representation t i As input to subsequent modules, Ψ represents the learnable parameters of f(·), where the weights are randomly initialized and the biases are constants of 0; both are learnable during training. Referring to the feature representation t of the previous task... i-1 By employing a fully connected layer g λ (·) and g μ (·) Perform linear mapping to generate adaptive scaling parameters λ for the task. i and offset parameter μ i Their learnable parameters are defined as Φ λ and Φ μ The weights are randomly initialized, and the bias is a constant of 0, which modulates the global meta-parameters, as shown in the following formula:
[0062] t i =f(S) i Λ i ,Ψ)
[0063]
[0064] Ψ i =(λ i +1)⊙Ψ+μ i
[0065] In the formula, j∈{1,2,…,N} represents the category of the prototype vector. These are the initialization parameters corresponding to category j. i Let λ represent the feature representation of the i-th task. i and μ i Representing tasks The scaling and offset parameters are denoted by ⊙, which represents element-wise multiplication. Ψ i Indicates that after S 2 Transform the modulated parameters.
[0066] This task-dependent parameter tuning enables knowledge transfer "from easy to difficult" because step one reorders the tasks, with the previous task being easier than the current one, allowing the model to quickly adapt to different feature distributions in complex tasks.
[0067] Step 6, the meta-optimization and meta-prediction stage.
[0068] In this embodiment of the invention, the meta-optimization process of the method includes two stages: inner loop parameter update and outer loop global optimization, to achieve rapid adaptation and cross-task generalization of the model in multi-task scenarios. First, to measure the model's classification performance on each task, the cross-entropy loss function is used to measure the difference between the model's predictions and the true labels, thereby guiding the model's effective learning and parameter updates within each task. Specifically, for each task... Its meta-training loss is defined as:
[0069]
[0070] Among them, Λ i Ψ represents the prototype-based initialization parameters for category i. i Indicates task The learnable parameters, S, are randomly initialized and updated during training via backpropagation. i For the task Support set, Indicates task The training loss is calculated using the aforementioned loss function. During the inner loop, the model calculates the gradient using this loss function and updates the parameters for each task through one or more gradient descent iterations, enabling the model to quickly adapt to the specific data distribution of that task. The parameter update format is as follows:
[0071]
[0072] Where η = 0.5 is the in-task learning rate. Represents the loss function against Ψ i The gradient is used for parameter updates.
[0073] In the outer loop phase, the model is based on the meta-learning objective of multiple tasks, i.e., the total loss. Global parameter optimization is performed. This stage updates the global parameters δ, Θ, and Φ by minimizing the comprehensive loss function. The comprehensive loss includes the classification loss of the entire task query set. Comparative learning loss KL divergence loss and parameter regularization terms The definition is as follows:
[0074]
[0075] Where, Θ={θ e ,θ p}, Φ={Φ λ ,Φ μ}, For learnable tasks The task weights are added to the optimizer and updated during training, initialized to all 1s, and used to dynamically adjust the contribution of different tasks to the overall optimization objective. ξ = 0.1 ζ = 0.001 represents the weight coefficient of each loss term. In each outer loop iteration, the model updates the global parameters using gradient descent, specifically:
[0076]
[0077] Where ρ = 0.001 is the outer loop learning rate, which controls the magnitude of each gradient update and ensures the stability of the optimization process. and These represent the gradients of the loss function with respect to δ, Θ, and Φ, respectively, used for parameter updates. By repeatedly executing the above inner and outer loop update process, the model can continuously optimize its initialization parameters and task mapping structure in a multi-task environment, thereby achieving rapid adaptation and efficient generalization to new tasks.
[0078] During the testing phase, the system utilizes global prior parameters obtained through meta-training to quickly adapt to new tasks. First, task parameters are initialized based on the support set samples; then, a small number of gradient updates are performed, and the category prototype is corrected using high-confidence pseudo-label samples; finally, predictions are made on the query set, outputting the final node classification result. In this experiment, classification accuracy (ACC) and F1 score are used as evaluation metrics. ACC measures the proportion of correctly predicted samples, while F1 score comprehensively considers the model's precision and recall, and is defined as follows:
[0079]
[0080] Where TP represents the number of samples correctly predicted as positive, TN represents the number of samples correctly predicted as negative, FP represents the number of samples mispredicted as positive, and FN represents the number of samples mispredicted as negative. This invention employs a macro-averaging method to average the F1 scores for each category, thereby improving the fairness and stability of the evaluation results. In few-shot node classification experiments on the Amazon-Clothing dataset, this invention achieved optimal performance under different N-way K-shot settings. In the 5-way 3-shot task setting, ACC = 88.4% and F1 = 88.1%. In the 5-way 5-shot task, the model performance further improved, achieving ACC = 88.5% and F1 = 88.4%, indicating that the method still possesses good stability and generalization ability with an increased sample size. In the more challenging 10-way 3-shot setting, it still maintained high performance, achieving ACC = 79.9% and F1 = 79.4%, demonstrating good adaptability to complex multi-class tasks. In the 10-way 5-shot task, the model achieved ACC = 80.8% and F1 = 80.5%, further validating the stability and robustness of the method in complex category scenarios.
[0081] In summary, the meta-learning-based knowledge graph small-sample node classification method proposed in this invention can achieve high-precision classification and rapid generalization of graph structure nodes under conditions of very few labeled samples, and is suitable for various intelligent analysis scenarios facing complex relational data. This method can be widely applied in the following specific fields: in the field of intelligent recommendation, for user interest modeling and cold-start recommendation in product relationship graphs; in the field of healthcare, for rare disease auxiliary diagnosis and medical entity classification in disease knowledge graphs; in the field of financial risk control, for risk node identification and associated fraud detection in enterprise relationship graphs; in the field of cybersecurity, for malicious node identification and attack path analysis in threat intelligence graphs; in the field of knowledge management and semantic search, for automatic completion, entity type prediction, and relation reasoning in knowledge graphs; and in the fields of industrial internet and IoT, for fault node location and status identification in device knowledge graphs. This invention possesses good versatility and scalability, and can provide robust and reliable technical support for intelligent decision-making systems driven by complex graph data.
[0082] This concludes the description of the specific implementation process of the present invention.
Claims
1. A knowledge graph few-sample node classification method based on meta-learning, characterized in that, By employing a task difficulty awareness mechanism, a Poisson pseudo-label generation strategy, and a difficult negative sample contrastive learning module, this method systematically enhances the generalization ability and robustness of the primitive learning model from multiple levels. First, it constructs task difficulty measurement models along node and category dimensions, calculating task difficulty indices based on the similarity between node embeddings and the separability between category prototypes. Based on these indices, a batch of meta-tasks is dynamically sorted and scheduled from easy to difficult, achieving adaptive course-based training and improving the convergence speed and cross-task generalization ability of the meta-model. Second, a pseudo-label generation strategy based on Poisson distribution modeling is used to probabilistically infer labels for unlabeled nodes, selecting high-confidence nodes to participate in prototype vector calculation, thereby expanding the support set samples and improving the stability of intra-class representations. Finally, a difficult negative sample contrastive learning module is introduced to perform discriminative optimization of intra-task node embeddings, enabling the model to better identify boundary features between similar categories.
2. The method according to claim 1, characterized in that, Includes the following steps: Step 1, Graph Embedding Learning Stage: Features are extracted from the input graph data, and node embedding representations are calculated using multi-hop neighbor aggregation and attention mechanisms; Step 2, Task Difficulty-Driven Meta-Training Scheduling: The difficulty of training tasks is assessed, and tasks are dynamically sorted and scheduled according to their complexity. This guides the model to gradually transition from simple tasks to complex tasks, enabling course-based learning and improving training stability. Step 3, Pseudo-label enhancement based on Poisson learning: Using the graph structure and existing labeled samples, a Poisson learning model is constructed to generate high-confidence pseudo-label nodes. The pseudo-label samples are added to the support set to optimize the inter-class prototype distribution and enhance the model's representation ability. KL divergence is introduced as a regularization term to constrain the consistency between the pseudo-label distribution and the real distribution. The inter-class prototypes are calibrated to make the model have higher discriminative power at the class boundaries. Step 4, Negative Sample Augmentation Training: Construct semantically similar but labeled nodes in the graph structure as hard negative samples, optimize the objective through comparative learning, improve the model's ability to identify nodes of different categories, and alleviate prototype confusion problem; Step 5, inter-task knowledge transfer: During the meta-training process, the meta-parameters of the learned tasks are used as the initialization conditions for the next task, realizing the gradual transfer of knowledge from easy tasks to difficult tasks and improving the overall generalization performance. Step 6, Meta-optimization and Meta-prediction Stage: The method learns transferable global knowledge and achieves adaptive balance between tasks through a meta-optimization process with inner and outer loops. In the meta-prediction stage, the model uses global prior parameters and high-confidence pseudo-labels to quickly adapt to new tasks and achieve node classification.
3. The method according to claim 1, characterized in that, It consists of three parts: a task scheduling module, a pseudo-label enhancement module, and a hard negative sample contrastive learning module. The task scheduling module is responsible for dynamically evaluating and ranking tasks according to task complexity indicators, realizing a course-like learning mechanism of "from easy to difficult". The pseudo-label enhancement module is based on the Poisson learning principle, using the Laplace diffusion process of the graph structure to generate high-confidence pseudo-label nodes, and expanding the support set through pseudo-label samples to optimize the inter-class prototype distribution to enhance the model's representation ability. The hard negative sample contrastive learning module constructs semantically similar but different labeled nodes as hard negative samples in the graph, and combines contrastive learning optimization strategies to effectively improve the model's discriminative ability and class boundary clarity in the feature space.
4. The method according to claim 1, wherein the objective function of the model is the task loss. Comparative learning loss KL divergence It consists of four parts: the constraint on the parameter (Φ), as shown in the following formula: Where Θ={θ e ,θ p }, Φ={Φ λ ,Φ μ }, ξ、 ζ is an adjustment parameter used to control the influence weight of the regularization term. To further enhance the model's adaptability to different tasks, learnable task weight coefficients are introduced. Used to dynamically adjust the contribution of different tasks to the overall loss.