Link prediction method and device, medium and computer equipment
Through the hierarchical graph contrastive learning framework (HGCLD), the diffusion model and graph convolutional neural network are used to independently transform auxiliary relations into the target relation semantic space, which solves the problems of noise influence and semantic transformation pattern capture in heterogeneous graph link prediction and improves the accuracy and robustness of link prediction.
Patent Information
- Application Number
- CN202510882999.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-28
- Publication Date
- 2025-09-26
AI Technical Summary
Existing heterogeneous graph link prediction methods have low link prediction accuracy when faced with noise, and find it difficult to effectively capture the complex semantic transformation patterns between different relationship types.
A hierarchical graph contrastive learning framework (HGCLD) is adopted to independently transform auxiliary relations into the target relation semantic space through a diffusion model to generate contrastive views. Noise is filtered during message passing, and a graph convolutional neural network is used to perform correlation analysis of semantic features.
It improves the accuracy of link prediction, effectively suppresses the influence of noise, enhances the semantic conversion pattern modeling between different relationship types in heterogeneous graphs, and improves the robustness of link prediction.
Smart Images

Figure CN120705666A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of link prediction technology, and in particular to a link prediction method, system, device and medium. Background Art
[0002] Link prediction, a key task in graph data analysis and machine learning, aims to predict edges that have not yet been observed or may appear in the future by analyzing known nodes and edges in the network. Heterogeneous graph link prediction involves predicting specific types of edges that have not yet been observed or may appear in the future in heterogeneous information networks containing multiple types of nodes and edges. Heterogeneous graph link prediction is widely used in social networks, recommender systems, bioinformatics, and other fields. For example, in an e-commerce heterogeneous graph network, predicting a specific type of edge (i.e., a specific relationship), which could be a purchase relationship, can improve the accuracy of recommendations on the e-commerce platform, as the platform will prioritize products with the highest probability of a purchase relationship. However, heterogeneous graph link prediction still faces many challenges.
[0003] Early studies extended the matrix factorization model to improve the performance of link prediction in heterogeneous graphs by integrating different relations as auxiliary data. However, matrix factorization-based methods rely on shallow architectures, are computationally expensive, and lack the ability to fully capture the complex relationships between multi-relation interactions. Recent progress in heterogeneous graph link prediction has focused on converting different nodes in heterogeneous graphs into compact vector embeddings through Graph Neural Networks (GNNs), more specifically through Graph Convolutional Networks (GCNs). These methods aim to capture different node preferences in heterogeneous graphs by leveraging message passing mechanisms, which enables modeling complex high-order interactions between multi-relation interactions, thereby refining different node representations in heterogeneous graphs. However, GCNs-based models require a large amount of high-quality labeled data for supervised training, but most practical application scenarios encounter data sparsity problems when learning node representations.
[0004] To address the sparsity issue, graph contrastive learning (GCL) can be used to create additional contrasting views, which can improve heterogeneous graph link prediction. More specifically, it can generate self-supervised training signals through graph augmentation techniques to alleviate data sparsity. However, existing heterogeneous graph link prediction methods mostly emphasize direct cross-view alignment and simple random augmentation. This approach may lead to the omission of valuable semantic and structural information, ultimately affecting the quality of link prediction.
[0005] Diffusion models (DMs) have demonstrated remarkable capabilities in generating adaptive comparative views. These models operate under the assumption that the original multi-relationship interactions follow an unknown probability distribution. They then attempt to estimate this distribution through neural networks. This approach effectively preserves the information structure of the reconstructed multiple interactions. However, the relationships between them inevitably contain a significant amount of noisy data. For example, click relationships are often highly unpredictable, influenced by various factors such as browsing, random curiosity, or style and color choices when shopping online. This noise is irrelevant and can lead to unrealistic link predictions, thereby reducing link prediction accuracy. Summary of the Invention
[0006] The object of the present invention is to provide a link prediction method, apparatus, medium and computer equipment, which can solve the problem of low link prediction accuracy caused by link prediction noise.
[0007] To solve the above technical problems, an embodiment of the present invention provides a link prediction method, comprising the following steps: Obtain a heterogeneous graph consisting of multiple relationships, where each relationship is formed by the user's interactive operation in the heterogeneous graph; Divide multiple relationships into target relationships and multiple auxiliary relationships, where the target relationship is the same type as the relationship to be predicted, and the auxiliary relationship is the relationship other than the target relationship in the heterogeneous graph; Each auxiliary relation is reconstructed separately through the diffusion model, so that the semantic features of each auxiliary relation after reconstruction are close to the semantic features of the target relation and the semantic features of the corresponding auxiliary relation before reconstruction. Determine the semantic features of each user in the heterogeneous graph based on the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship; Based on the semantic features of each user, the possible future relationships in the heterogeneous graph are predicted to complete the link prediction of the heterogeneous graph.
[0008] Furthermore, the process of reconstructing each auxiliary relation by using the diffusion model so that the semantic features of each auxiliary relation after reconstruction are close to the semantic features of the target relation and the semantic features of the corresponding auxiliary relation before processing includes: Through the diffusion model, the semantic features of each auxiliary relation are reconstructed using the following formula, so that the semantic features of each auxiliary relation after reconstruction are close to the semantic features of the target relation and the semantic features of the corresponding auxiliary relation before processing: Forward diffusion is performed using the following formula: ; The following formula is used for reverse denoising: ; ; The model parameters of the diffusion model are updated using the following formula: ; Where, is the semantic feature of the auxiliary relationship, , This is done by Based on graph neural network encoding, is the number of auxiliary relations, Semantic features of target relations, , , represents the diffusion step, N represents the Gaussian distribution, at each step t, using ∈(0,1)to adjust the size of the introduced Gaussian noise. When T→∞, the state Converges to the standard Gaussian distribution, and represents the mean and covariance of the Gaussian distribution, derived through a neural network parameterized by θ, Using a multilayer perceptron implementation, , is the reconstruction loss term, is the semantic conversion loss term.
[0009] Furthermore, determining the semantic features of each user in the heterogeneous graph according to the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship includes: Through the graph convolutional neural network, the following formula is used to determine the semantic features of each user in the heterogeneous graph based on the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship: ; ; Where, The specific adjacency matrix under the kth relation containing the reconstructed auxiliary relation and target relation, D represents the corresponding degree matrix, Represents the graph convolutional neural network Layer embedding matrix, including the semantic features of the processed auxiliary relations Semantic features of the relationship with the target , Represents the activation function, and after L iterations, the user's semantic features are obtained. , Represents an aggregate function, Indicates the relationship type.
[0010] Furthermore, the graph convolutional neural network is trained using the following loss function: ; Where, and τ represent cosine similarity and temperature respectively, Represents the same user in different reconstructed auxiliary relations as a positive pair, Any two different users corresponding to different reconstructed auxiliary relations are regarded as negative pairs.
[0011] Furthermore, the graph convolutional neural network updates model parameters in the following manner: ; ; Where, Used to adjust the influence of model parameters Θ, Used to adjust the impact of contrast loss, the objective function is , represents the predicted score of the positive term v related to user u, represents the predicted score of the negative term v related to user u An embodiment of the present invention further provides a link prediction device, comprising: The relationship acquisition module is used to obtain a heterogeneous graph consisting of multiple relationships, each of which is formed by the user's interactive operation in the heterogeneous graph; A relationship partitioning module is used to partition multiple relationships into target relationships and multiple auxiliary relationships. The target relationship is a relationship of the same type as the relationship to be predicted, and the auxiliary relationship is a relationship other than the target relationship in the heterogeneous graph. A relationship processing module is used to reconstruct each auxiliary relationship separately through a diffusion model so that the semantic features of each auxiliary relationship after reconstruction are close to the semantic features of the target relationship and the semantic features of the corresponding auxiliary relationship before reconstruction; A user feature determination module is used to determine the semantic features of each user in the heterogeneous graph based on the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship; The link prediction module is used to predict the possible future relationships in the heterogeneous graph based on the semantic features of each user and complete the link prediction of the heterogeneous graph.
[0012] An embodiment of the present invention also provides a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above-mentioned link prediction method.
[0013] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, wherein the computer program implements the above-mentioned link prediction method when executed by a processor.
[0014] The link prediction method provided by the present invention has at least the following beneficial effects: By partitioning the multiple relationships that make up the heterogeneous graph into a target relationship and multiple auxiliary relationships, each auxiliary relationship is then reconstructed using a diffusion model, so that its reconstructed semantic features are close to both the semantic features of the target relationship and the semantic features of the corresponding auxiliary relationship before reconstruction. This facilitates the alignment of the semantic features of the auxiliary relationships with those of the target relationship. During reconstruction, each auxiliary relationship independently serves as a diffusion source for the diffusion model, ensuring that noise from a specific auxiliary relationship does not propagate into the features of other auxiliary relationships during message transmission. This is because specific auxiliary relationships and other auxiliary relationships are propagated separately rather than being fused into an integrated representation, avoiding mutual influence between unrelated relationships that could reduce the accuracy of link prediction. Furthermore, when aligning the semantic features of the auxiliary relationship with those of the target relationship, noise in the auxiliary relationship can be further filtered out, further improving the accuracy of link prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0016] Figure 1 A schematic flow chart of a link prediction method provided by the present invention; Figure 2 A schematic diagram of a cross-type semantic conversion framework provided by the present invention; Figure 3 This is a schematic diagram of the overall framework of the HGCLD model provided by the present invention. DETAILED DESCRIPTION
[0017] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with specific embodiments of the present invention and corresponding drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0018] In the current link prediction method: GNNs have demonstrated impressive performance in tasks such as spam detection and recommender systems, but their application in link prediction remains limited by the homogeneous graph assumption. Classic architectures such as GCNs and Graph Attention Networks (GATs) are primarily designed for node feature aggregation and struggle to model dependencies between multiple types of links in heterogeneous graphs. For example, in the heterogeneous user-item-context graphs of cross-domain recommender systems, traditional GNNs are unable to effectively distinguish between the distinct evolutionary patterns of social and consumer relationship links, resulting in reduced prediction accuracy. Heterogeneous Graph Neural Networks (HGNNs) optimize node embeddings through meta-path aggregation, relationship-aware attention, or Transformer architectures, but their link prediction performance remains limited by two core issues: 1) heterogeneous semantic noise is not systematically filtered out; and 2) semantic transformation patterns between multiple types of links are not explicitly modeled. Existing methods directly train link predictors using the original graph structure, causing noise to propagate through neighborhoods and contaminate predictions.
[0019] Self-supervised learning (SSL) has attracted attention due to its potential to alleviate data scarcity and noise interference in link prediction tasks. Recent studies have attempted to introduce SSL techniques (such as contrastive learning) into the link prediction framework to compensate for the lack of annotation by generating self-supervisory signals. However, existing methods still face key challenges: First, traditional feature masking or random walk strategies have difficulty handling the complex multi-type semantic noise in link prediction on heterogeneous graphs; second, the interaction patterns between different relationship types are not explicitly modeled, resulting in the noise distribution exacerbating the interference on the prediction results. These issues limit the robustness of link prediction in heterogeneous environments, especially when the node / edge types are diverse and the noise level is complex.
[0020] Generative models offer a new paradigm for improving the noise robustness of link prediction. Traditional graph generation methods rely on modeling specific statistical features, making them difficult to adapt to the dynamic demands of heterogeneous link prediction. Although Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs) enhance generative flexibility through latent space mapping, their discriminative generation mechanisms remain insufficient for link-level denoising. Recent research demonstrates that diffusion models can precisely control graph structure generation through a progressive denoising process. This offers dual advantages for link prediction: during training, the forward diffusion process simulates link noise injection, enhancing the model's understanding of the noise distribution; during inference, the backward denoising process gradually corrects the confidence of candidate links, improving the reliability of link relationship predictions. However, different relationships inevitably contain a large amount of noisy data. This noise is irrelevant and can lead to unrealistic link predictions.
[0021] Recently, a diffusion model has been used to transform auxiliary relation data into the target relation semantic space, enabling accurate extraction of task-related information. However, this approach fuses various auxiliary relations into a unified representation and propagates them through GCNs, which faces the problem of noise between auxiliary relations, thus affecting the accuracy of the final link prediction results.
[0022] Therefore, most existing GCNs-based diffusion-enhanced heterogeneous graph link prediction models typically fuse different auxiliary relations to obtain an integrated representation and propagate it through GCNs to generate contrastive views. Current work utilizes diffusion models to consistently transform all auxiliary relation data into the target relation semantic space. Therefore, during the message propagation process, noise originating from specific auxiliary relation features may still be transmitted to other auxiliary relation embeddings, which aggravates the impact of noise and thus impairs the quality of enhanced contrastive views. Obviously, designing a diffusion model that can generate contrastive views while effectively suppressing the propagation of specific auxiliary relation noise to other auxiliary relation embeddings remains a major challenge.
[0023] Furthermore, the various interactive relationships in heterogeneous graphs provide valuable and rich semantic information, enabling a deeper understanding of the different relationships between different nodes, thereby improving the accuracy of link prediction. However, the various relationship types are not independent of each other, but rather interdependent. Existing methods fail to consider the basic semantic information between different relationship types and only learn the semantic information of each relationship separately, which cannot accurately capture the complex semantic transformation patterns between different relationship types. Therefore, constructing a diffusion model that can generate comparative views with cross-type semantic transformations while minimizing noise, thereby promoting the accurate extraction of relevant information for link prediction in heterogeneous graphs, remains another major challenge.
[0024] In summary, combining graph neural networks, contrastive learning, diffusion models, and cross-type semantic transformation can effectively improve the accuracy of link prediction. GNNs improve link prediction accuracy by leveraging message passing to capture the preferences of different nodes in heterogeneous graphs. Contrastive learning generates self-supervised training signals through graph augmentation techniques to alleviate data sparsity and enhance the model's performance on link prediction data. Diffusion models effectively preserve the information structure of reconstructed interactions, further improving the representation learning of different nodes under different relationships. Cross-type semantic transformation accurately captures the complex semantic transformation patterns between different relationship types, fully utilizing various relationships in link prediction. The development and application of these technologies provide new ideas and methods for achieving better performance in link prediction tasks.
[0025] To address these two challenges, we propose a Hierarchical Graph Contrastive Learning (HGCLD) framework with diffusion enhancement for heterogeneous graph link prediction. Specifically, HGCLD first identifies the most important relation type for the link prediction task and sets it as the target relation (e.g., purchase relation). Simultaneously, it considers the remaining relations as auxiliary relations (e.g., click, add to cart, favorite, etc.) to improve the prediction of the target relation. To mitigate the noise problem, we design a hierarchical relation-aware diffusion model and propose a semantic transformation strategy for hierarchical contrastive view generation. Through the diffusion model, each auxiliary relation is transformed into the target relation semantic space to generate contrastive views, which facilitates the alignment between auxiliary relation features and the target relation semantic space. More specifically, we coordinate the forward and backward diffusion processes, where each auxiliary relation independently serves as a diffusion source, while the target relation provides a denoising training signal, thereby enabling the construction of contrastive views. In this way, the HGCLD architecture ensures that noise from a specific auxiliary relation does not propagate into the embeddings of other auxiliary relations during message passing, because the specific auxiliary relation and other auxiliary relations are propagated separately rather than being fused into an integrated representation. Furthermore, when transforming auxiliary relations into the semantic space of the target relation, the noise present in the auxiliary relations can be effectively filtered out. Furthermore, each auxiliary relation is transformed into the semantic space of the target relation using a diffusion model. This process helps accurately model the semantic transformation from each auxiliary relation to the target relation. Finally, the hierarchical contrast views are used as anchors to align the relational patterns between different contrast views and optimize the main task function.
[0026] The present invention ultimately effectively ensures that noise from a specific auxiliary relation does not propagate into the embeddings of other auxiliary relations during message delivery, and achieves accurate modeling of the semantic transformation from auxiliary relations to target relations, suppressing noise pollution to a certain extent, thereby enhancing link prediction performance.
[0027] The technical solutions provided by various embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0028] One embodiment of the present invention relates to a link prediction method. The specific process of the link prediction method of this embodiment can be as follows: Figure 1 Shown, including: Step 101: Obtain a heterogeneous graph consisting of multiple relationships, where each relationship is formed by an interactive operation of a user in the heterogeneous graph; In step 102 , the multiple relationships are divided into target relationships and multiple auxiliary relationships. The target relationship is a relationship of the same type as the relationship to be predicted, and the auxiliary relationship is a relationship other than the target relationship in the heterogeneous graph.
[0029] In step 103 , each auxiliary relation is reconstructed using a diffusion model so that the semantic features of each auxiliary relation after reconstruction are close to both the semantic features of the target relation and the semantic features of the corresponding auxiliary relation before reconstruction.
[0030] Step 104 : Determine the semantic features of each user in the heterogeneous graph based on the correlation between the semantic features of each reconstructed auxiliary relation and the semantic features of the target relation.
[0031] Step 105 : predicting possible future relationships in the heterogeneous graph based on the semantic features of each user, and completing link prediction of the heterogeneous graph.
[0032] The following is a detailed description of the implementation details of the link prediction method of this embodiment. The following content is only provided for ease of understanding and is not necessary for implementing this solution.
[0033] In steps 101 and 102, heterogeneous graphs (multi-relationship graphs) is constructed using multi-relational data, where Represents a user collection, represents the set of items, I and J represent the number of users and items, Represents edges corresponding to different types of relations. Assume there are K (K>= 2) types of user-item interactions. The kth relation interaction is represented as At the same time, the heterogeneous graph G can be divided into K subgraphs according to the relationship type. , thereby specifying the target relationship type subgraph (for example, purchase relationship) as the prediction target, and the remaining relationship type subgraph = As an auxiliary relationship.
[0034] In step 102, inspired by the excellent ability of diffusion models in capturing the complex data generation process, the present invention proposes a cross-type semantic transformation strategy, which uses a hierarchical graph diffusion model to construct a comparative view, such as Figure 2 As shown. Fundamentally, this embodiment designs a cross-type semantic conversion strategy between auxiliary relations and target relations, creates a comparative view through a hierarchical graph diffusion model, and converts each auxiliary relation individually into the target relation semantic space through the hierarchical graph diffusion model, thereby achieving accurate modeling of the semantic conversion between the target relation and the auxiliary relation, and then accurately extracting the relevant information for generating the comparative view. In addition, it ensures that during the message passing process, the noise from the specific features of the auxiliary relations does not penetrate into the embeddings of other auxiliary relations, which is achieved by propagating each auxiliary relation separately. This method embeds specific relationship features and other auxiliary relationship features independently, rather than merging them into an integrated embedding, and can effectively filter out the noise in the auxiliary relations in the process of mapping the auxiliary relations to the target relationship semantic space.
[0035] (1) Diffusion process: Reconstruct each auxiliary view by performing the inverse process , so that relevant information for contrast view generation can be identified. Therefore, noise is introduced into each original auxiliary image in the diffusion stage. In the embedding of , as described in Equation 1. In this case, This is done by Obtained based on GNNs encoding.
[0036] ; Where I represents the identity matrix, t∈{1…T} represents the diffusion step, N represents the Gaussian distribution, and at each step t, using ∈(0,1)to adjust the size of the introduced Gaussian noise. When T→∞, the state Converges to a standard Gaussian distribution.
[0037] 2) Reverse process: In the reverse process, this embodiment focuses on the Start gradually rebuilding the representation The diffusion model is trained to remove the introduced noise so that the neural network can be used to extract reconstruction , as shown in Formula 2:
[0038] (2) in, and Represents the mean and covariance of the Gaussian distribution, which can be obtained by Parameterized neural network derived by reparameterizing the mean , as shown in Equation 3, the noise added at time step t can be effectively learned.
[0039] (3) in, Using Multi-Layer Perceptron (MLP) to implement and time step t to calculate the predicted value To reconstruct the embedding of each auxiliary graph , this embodiment uses the embedding of the target graph and the embedding of each auxiliary graph As the evidence lower bound (ELBO), the sampling time step t is selected from {1, 2, …, T} to update the model parameters, as shown in Equation 4. In this case, By applying to the target graph The GNNs encoding is obtained.
[0040] (4) Formula 4 includes two components: reconstruction loss term and semantic conversion loss Therefore, this model makes and and Tight alignment helps update model parameters. In this way, each auxiliary relation embedding Mapping to target relational semantic space using diffusion model . This process allows for the accurate representation of semantic transformations between target and auxiliary relations, enhancing the effective extraction of relevant information for generating contrastive views. In addition, the hierarchical graph diffusion model generates multiple contrastive views independently, ensuring that noise originating from a specific auxiliary relation does not spread to the embeddings of other auxiliary relations during message passing. In addition, in the process of mapping the auxiliary relation to the semantic space of the target relation, the noise it contains can be effectively reduced. Then, we used it to reconstruct the contrast view embedding and auxiliary relationship diagram Therefore, the reconstructed contrast view effectively reduces the noise impact of heterogeneous graphs in link prediction and explicitly models the semantic transformation of heterogeneous link relationships.
[0041] In step 103, GCNs are able to extract high-level collaborative information between users and perform well in terms of in-depth understanding and effective utilization of complex relationships in multi-relational recommendation systems. In addition, the noise in the auxiliary relations can be effectively filtered out during the conversion to the target relation semantic space. The HGCLD model uses GCNs to learn multiple reconstructed auxiliary relation graphs. and target relationship diagram To generate the main view, we can use Formula 5:
[0042] (5) in, Auxiliary diagram including reconstruction and target relationship diagram The specific adjacency matrix under the k-th relationship, D represents its corresponding degree matrix, Represents the first Layer embedding matrix, which includes contrast view embeddings and the target view embed ,in Represents the activation function, and the final node embedding is obtained after L iterations , by aggregating node embeddings of different relationship types , we can get the final node embedding , which is expressed as Formula 6.
[0043] (6) Among them, AGG represents the aggregation function, such as Sum, Mean, and Pooling, and K represents the number of relationship types. In this way, the main view can effectively capture the relationships of various relationship types in the link prediction heterogeneous graph while reducing the impact of noise.
[0044] By leveraging the correlation between various relations in the link prediction heterogeneous graph, this model uses views of different relations as anchors for the InfoNCE loss and optimizes the main objective function using the ELBO loss in Formula 4. The contrast loss for user U is defined as Formula 7: (7) in, and τ denote the cosine similarity and temperature, respectively. Indicates that the same node in different contrasting views is considered to be positive, while Any two different nodes corresponding to different contrast views are considered as negative pairs. By adopting this approach, the model parameters are trained to increase the similarity between positive pairs and decrease the similarity between negative pairs, which helps alleviate the data sparsity problem. The contrast loss of item V is defined in a similar way. The model jointly optimizes the main objective function and the contrast loss function to train the model parameters, which can be expressed using Formula 8:
[0045] (8) Among them, use Adjust the effect of the model parameter Θ, using Adjust the impact of contrast loss, the main objective function is recorded as , can be expressed by formula 9, where represents the predicted score of the positive term v related to user u, and represents the predicted score of the negative term v related to user u.
[0046] For the link prediction task, this embodiment uses the final embedding obtained by formula 6 To make predictions, the BPR loss function (Formula 9) is used to optimize the prediction results.
[0047] (9) It can be seen that this embodiment provides a hierarchical graph contrast learning framework (HGCLD). The overview of the HGCLD model framework is as follows: Figure 3 As shown in Figure 2, layered graph diffusion integrates a cross-category semantic transformation module to construct multiple contrasting views. GCNs encoding is used to learn embeddings for multiple contrasting views. Finally, contrasting views are used as anchors to align user relationship patterns across views.
[0048] In a specific embodiment, the link prediction method of the present invention can be applied to heterogeneous information networks such as e-commerce platforms, leveraging auxiliary relationships such as user clicks, add-to-carts, and likes to improve the accuracy of predictions for primary relationships (e.g., purchase relationships). This embodiment primarily includes the following:
[0049] 1. We introduce an effective multi-relation learning model that integrates a hierarchical relation-aware graph diffusion model and a hierarchical contrastive learning paradigm to learn multiple relations. By leveraging the hierarchical diffusion model to construct a hierarchical contrastive view, we effectively prevent noise from specific auxiliary relations from entering the embeddings of other auxiliary relations during message passing, thereby more accurately extracting relevant information for the link prediction task.
[0050] 2. We propose a cross-type semantic conversion strategy that leverages auxiliary relationships (e.g., click, add to cart, favorite) to facilitate the prediction of target relationships (e.g., purchase). Furthermore, when converting auxiliary relationships into the semantic space of the target relationship, we effectively filter out noise in the auxiliary relationships.
[0051] Taking the actual e-commerce scenario as an example, the HGCLD workflow is as follows: 1. Input data and preprocessing.
[0052] Original data: User A's history: User A recently browsed items B, C, and D, including a large number of random clicks (such as accidentally clicking on item C); User A added items B and D to their shopping cart; and User A ultimately purchased item B. The interaction data of all users constitutes a global heterogeneous information network.
[0053] Data partitioning: Target relationship subgraph : Contains only purchase relationships (e.g., user A → purchase → product B).
[0054] Auxiliary relationship subgraph : It is the click relationship subgraph (user A → click → product B / C / D); It is the add-to-cart relationship subgraph (user A → add to cart → product B / D).
[0055] 2. Layered Diffusion Denoising and Semantic Alignment Auxiliary relations spread independently (with For example: First, forward diffusion adds noise, then reverse denoises. During the reverse denoising process, cross-type semantic conversion is performed. This makes the denoised click relationship close to the original click data and the target purchase relationship embedding.
[0056] Output: Generate denoised click view , where the edge weight of user A→click→product C decreases, and the edge weight of product B / D increases significantly.
[0057] 3. Multi-relational contrastive learning and prediction Embedding Aggregation: Using GCNs to Learn Target Graphs Separately And the auxiliary image after denoising , For example, the final embedding of user A incorporates the purchase graph Direct preference (product B), click map after denoising Potential interest (product B / D), shopping cart image after denoising clear intention (goods B / D).
[0058] Contrast loss optimization: Through InfoNCE loss, user A can click on the view and add to cart view , but are far away from the embeddings of irrelevant users (such as user X).
[0059] Final prediction: Calculate the prediction score of user A for the product D that he did not purchase ; Based on BPR loss, optimize model parameters to make > > (User A is more likely to have a purchasing relationship with product B, followed by D, and finally the noise product C).
[0060] 4. Result Output Prediction list: The probability of user A making a purchase in the future is ranked as follows: Item B (purchased) > Item D (added to cart but not purchased) > Item C (noise click).
[0061] In a real e-commerce platform, the system will prioritize recommending product D to user A based on the probability of user A making a purchase in the future, rather than irrelevant product C. By fully utilizing the purchase relationship predicted by the present invention in an actual e-commerce platform, the accuracy of the system's recommendations can be greatly improved.
[0062] The link prediction method of the present invention has the following beneficial effects: 1. We propose a hierarchical graph contrastive learning framework with diffusion enhancement (HGCLD) for heterogeneous graph link prediction. This method introduces an effective multi-relation learning model and a cross-type semantic transformation strategy.
[0063] 2. We introduce an effective multi-relation learning model that integrates a hierarchical relation-aware graph diffusion model and a hierarchical contrastive learning paradigm to learn multiple relations. By leveraging the hierarchical diffusion model to construct a hierarchical contrastive view, we effectively prevent noise from specific auxiliary relations from entering the embeddings of other auxiliary relations during message passing, thereby more accurately extracting relevant information for the link prediction task.
[0064] 3. We propose a cross-type semantic conversion strategy that leverages auxiliary relationships (e.g., click, add to cart, favorite) to facilitate the prediction of target relationships (e.g., purchase). Furthermore, when converting auxiliary relationships into the semantic space of the target relationship, we effectively filter out noise in the auxiliary relationships.
[0065] 4. We address the data noise issue in heterogeneous graph learning for link prediction, particularly the noise contamination between different relations. Some techniques utilize diffusion models to uniformly transform all auxiliary relation data into the target relation semantic space. However, noise originating from the characteristics of certain auxiliary relations may be transferred to the embeddings of other auxiliary relations during message propagation, exacerbating the impact of noise and compromising the quality of enhanced contrast views.
[0066] 5. Existing methods struggle to effectively model the complex transformation patterns between heterogeneous relations for link prediction. This paper designs a hierarchical relation-aware graph diffusion model with a cross-type semantic transformation strategy. This model accurately represents the semantic transformations between target and auxiliary relations, effectively extracting relevant information for generating comparative views. Furthermore, mapping auxiliary relations into the semantic space of target relations effectively reduces the noise they contain.
[0067] Compared to link prediction models based on traditional GNNs, this method can effectively distinguish the evolution patterns of different links, improving prediction accuracy. Its application in link prediction is no longer limited to homogeneous graphs. This method utilizes heterogeneous graph neural networks based on a diffusion model, aiming to enhance the modeling capabilities of complex link structures through a probabilistic generation mechanism.
[0068] Compared to heterogeneous graph neural network (HGNN)-based link prediction models such as HetGNN, MAGNN, and HGT, this paper adopts a hierarchical relation-aware graph diffusion model and a hierarchical contrastive learning paradigm to learn multiple relationships. It also proposes a cross-type semantic transformation strategy that extracts key task-related link features through iterative noise removal and semantic reconstruction. This effectively reduces heterogeneous semantic noise and explicitly models semantic transformation patterns between multiple types of links.
[0069] Compared with recent attempts to introduce SSL technology (such as contrastive learning) into the link prediction framework, this paper abandons traditional feature masking or random walk strategies to deal with noise, and instead adopts a hierarchical relational perception graph diffusion model and a hierarchical contrastive learning paradigm to learn multiple relations; a cross-type semantic conversion strategy is proposed, which can effectively filter out the noise in the auxiliary relations when converting them into the target relation semantic space, generating high-quality contrast views with less noise.
[0070] Compared with the link prediction model based on the traditional graph generation method, the present invention no longer relies on specific statistical feature modeling, can adapt to the needs of heterogeneous link prediction, and can achieve better results in link-level denoising tasks.
[0071] Compared with models such as DiffGraph, the present invention coordinates the forward and backward diffusion processes and treats each auxiliary relation independently as a diffusion source, ensuring that the noise from a specific auxiliary relation will not propagate into the embeddings of other auxiliary relations during message passing, because the specific auxiliary relation and other auxiliary relations are propagated separately instead of fusing them into an integrated representation.
[0072] The steps of the various methods above are divided only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are within the scope of protection of the present invention. Adding insignificant modifications or introducing insignificant designs to the algorithm or process without changing the core design of the algorithm and process are all within the scope of protection of the invention.
[0073] Another embodiment of the present invention relates to a link prediction device. The implementation details of the link prediction device of this embodiment are described in detail below. The following content is provided only for ease of understanding and is not required for implementing this solution. The link prediction device of this embodiment includes: The relationship acquisition module is used to obtain a heterogeneous graph consisting of multiple relationships, each of which is formed by the user's interactive operation in the heterogeneous graph; A relationship partitioning module is used to partition multiple relationships into target relationships and multiple auxiliary relationships. The target relationship is a relationship of the same type as the relationship to be predicted, and the auxiliary relationship is a relationship other than the target relationship in the heterogeneous graph. A relationship processing module is used to reconstruct each auxiliary relationship separately through a diffusion model so that the semantic features of each auxiliary relationship after reconstruction are close to the semantic features of the target relationship and the semantic features of the corresponding auxiliary relationship before reconstruction; A user feature determination module is used to determine the semantic features of each user in the heterogeneous graph based on the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship; The link prediction module is used to predict the possible future relationships in the heterogeneous graph based on the semantic features of each user and complete the link prediction of the heterogeneous graph.
[0074] It is not difficult to find that this embodiment is an apparatus embodiment corresponding to the above-mentioned method embodiment, and this embodiment can be implemented in conjunction with the above-mentioned method embodiment. The relevant technical details and technical effects mentioned in the above-mentioned embodiment are still valid in this embodiment, and to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the above-mentioned embodiment.
[0075] It is worth noting that all modules involved in this embodiment are logical modules. In actual applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, to highlight the innovations of the present invention, this embodiment does not include units that are not closely related to solving the technical problems proposed by the present invention. However, this does not mean that other units do not exist in this embodiment.
[0076] Another embodiment of the present invention relates to a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the link prediction method of the above-mentioned embodiments.
[0077] The memory and processor are connected using a bus, which can include any number of interconnected buses and bridges. The bus connects various circuits of one or more processors and memories. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits. These are all well known in the art and are therefore not described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over a wireless medium via an antenna. Furthermore, the antenna receives data and transmits it to the processor.
[0078] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.
[0079] Another embodiment of the present invention relates to a computer-readable storage medium storing a computer program, which implements the above method embodiment when executed by a processor.
[0080] That is, those skilled in the art will understand that all or part of the steps in the above-described method embodiments can be implemented by instructing the relevant hardware through a program. The program is stored in a storage medium and includes a number of instructions for causing a device (such as a microcontroller or chip) or a processor to execute all or part of the steps in the method embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0081] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present invention, and that in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present invention.
Claims
1. A link prediction method, characterized in that: The method comprises: Obtain a heterogeneous graph consisting of multiple relationships, where each relationship is formed by the user's interactive operation in the heterogeneous graph; Divide multiple relationships into target relationships and multiple auxiliary relationships, where the target relationship is the same type as the relationship to be predicted, and the auxiliary relationship is the relationship other than the target relationship in the heterogeneous graph; Each auxiliary relation is reconstructed separately through the diffusion model, so that the semantic features of each auxiliary relation after reconstruction are close to the semantic features of the target relation and the semantic features of the corresponding auxiliary relation before reconstruction. Determine the semantic features of each user in the heterogeneous graph based on the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship; Based on the semantic features of each user, the possible future relationships in the heterogeneous graph are predicted to complete the link prediction of the heterogeneous graph.
2. The link prediction method according to claim 1, wherein: The method of reconstructing each auxiliary relation by using the diffusion model so that the semantic features of each auxiliary relation after reconstruction are close to the semantic features of the target relation and the semantic features of the corresponding auxiliary relation before reconstruction includes: Through the diffusion model, the semantic features of each auxiliary relationship are reconstructed using the following formula, so that the semantic features of each auxiliary relationship after reconstruction are close to the semantic features of the target relationship and the semantic features of the corresponding auxiliary relationship before reconstruction: Forward diffusion is performed using the following formula: ; The following formula is used for reverse denoising: ; ; The model parameters of the diffusion model are updated using the following formula: ; Where, is the semantic feature of the auxiliary relationship, , This is done by Based on graph neural network encoding, is the number of auxiliary relations, is the semantic feature of the target relation, , , represents the diffusion step, N represents the Gaussian distribution, at each step t, using ∈(0,1)to adjust the size of the introduced Gaussian noise. When T→∞, the state Converges to the standard Gaussian distribution, and represents the mean and covariance of the Gaussian distribution, derived through a neural network parameterized by θ, Using a multilayer perceptron implementation, , is the reconstruction loss term, is the semantic conversion loss term.
3. The link prediction method according to claim 1, wherein: The determining of the semantic features of each user in the heterogeneous graph according to the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship includes: Through the graph convolutional neural network, the following formula is used to determine the semantic features of each user in the heterogeneous graph based on the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship: ; ; Where, The specific adjacency matrix under the kth relation containing the reconstructed auxiliary relation and target relation, D represents the corresponding degree matrix, Represents the graph convolutional neural network Layer embedding matrix, including the semantic features of the processed auxiliary relations Semantic features of the relationship with the target , Represents the activation function, and after L iterations, the user's semantic features are obtained. , Represents an aggregate function, Indicates the relationship type.
4. The link prediction method according to claim 3, wherein: The graph convolutional neural network is trained using the following loss function: ; Where, and τ represent cosine similarity and temperature respectively, Represents the same user in different reconstructed auxiliary relations as a positive pair, Any two different users corresponding to different reconstructed auxiliary relations are regarded as negative pairs.
5. The link prediction method according to claim 4, characterized in that: The graph convolutional neural network updates the model parameters in the following way: ; ; Where, Used to adjust the influence of model parameters Θ, Used to adjust the impact of loss, the objective function is , represents the predicted score of the positive term v related to user u, represents the predicted score of the negative term v related to user u.
6. A link prediction device, characterized in that: The device comprises: The relationship acquisition module is used to obtain a heterogeneous graph consisting of multiple relationships, each of which is formed by the user's interactive operation in the heterogeneous graph; A relationship partitioning module is used to partition multiple relationships into target relationships and multiple auxiliary relationships. The target relationship is a relationship of the same type as the relationship to be predicted, and the auxiliary relationship is a relationship other than the target relationship in the heterogeneous graph. A relationship processing module is used to reconstruct each auxiliary relationship separately through a diffusion model so that the semantic features of each auxiliary relationship after reconstruction are close to the semantic features of the target relationship and the semantic features of the corresponding auxiliary relationship before reconstruction; A user feature determination module is used to determine the semantic features of each user in the heterogeneous graph based on the correlation between the semantic features of each reconstructed auxiliary relationship and the semantic features of the target relationship; The link prediction module is used to predict the possible future relationships in the heterogeneous graph based on the semantic features of each user and complete the link prediction of the heterogeneous graph.
7. A computer device, characterized in that: include: at least one processor; And, a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the link prediction method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the link prediction method according to any one of claims 1 to 5 is implemented.