A graph contrastive learning method based on hierarchical neighbor enhancement for recommender systems

By constructing a hierarchical neighbor-enhanced graph comparative learning method and utilizing graph neural networks and hierarchical clustering algorithms, the problem of modeling hierarchical neighbor relationships between users (items) in recommendation systems is solved, which improves recommendation accuracy and generalization ability. It is suitable for recommendation systems and other graph comparative learning tasks.

CN119646312BActive Publication Date: 2025-09-26TONGJI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411873415.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-09-26
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

Existing graph comparative learning methods fail to fully utilize the hierarchical neighbor relationships between users (items) in recommendation systems, resulting in insufficient recommendation accuracy. Existing methods require manual intervention and ignore the structural and semantic neighbor relationships of nodes.

Method used

By constructing user-item interaction graphs, user-user relationship graphs, and item-item relationship graphs, using graph neural networks for hierarchical fusion, combined with hierarchical clustering algorithms, building hierarchical structures and semantic neighbor comparison learning objectives, jointly optimizing recommendation task objectives, and learning user and item feature representations.

Benefits of technology

It improves the accuracy of recommendation systems and their generalization capabilities in sparse data environments, reduces data preparation costs and speeds up model deployment. It is suitable for recommendation systems and other graph comparative learning tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646312B_ABST
    Figure CN119646312B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of recommendation systems, and in particular relates to a graph comparative learning method based on hierarchical neighbor enhancement for recommendation systems. It includes: constructing a user-item interaction graph, a user-user relationship graph, and an item-item relationship graph based on user-item interaction records; combining a graph neural network and updating node features in a hierarchical fusion manner to obtain local and global structural neighbor representations of nodes; executing a hierarchical clustering algorithm in a bottom-up manner, and using the generated hierarchical prototype (center of mass) features to model the hierarchical semantic neighbor representations of nodes; constructing hierarchical structural neighbor and hierarchical semantic neighbor comparative learning objectives of nodes based on the two types of neighbor representations, and optimizing user and item representations through backpropagation; and generating downstream recommendation results based on the optimized user and item representations. This method improves the accuracy of the recommendation system and also enhances the generalization ability of the model in a sparse data environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of recommendation systems, and in particular relates to a graph comparative learning method based on hierarchical neighbor enhancement for recommendation systems. Background Art

[0002] Recommender systems are widely used on major internet platforms. They learn user and item representations from historical interaction data (clicks, ratings, purchases, and other behaviors) to predict users' ratings or preferences for items and provide personalized services. However, in real-world recommendation scenarios, user-item interactions are often very sparse, resulting in insufficient supervisory signals. To alleviate this problem, graph contrastive learning has been introduced into recommendation systems. By maximizing the consistency between established contrast-enhanced views, it learns stable, view-independent user (item) feature representations.

[0003] Most existing graph contrastive learning methods adopt heuristic random augmentation strategies, constructing contrastive views by performing random perturbations on the user-item interaction graph or adding random noise of the same scale to each node on the graph. However, such methods are not universal, require manual intervention, and ignore the rich structural and semantic neighborhood relationships between users (or items), failing to fully exploit the potential of contrastive learning for recommendation. Although some methods consider the neighborhood relationships between nodes to some extent, they only model the relationships at a single level. Specifically, these methods either treat the node interactions as a whole, only considering the global-level structural neighborhood relationships and lacking the exploration of local neighborhood relationships, or only modeling the semantic information at a single level, ignoring the fact that users (items) generally have hierarchical semantics. As a result, they cannot provide sufficient supervisory contrast signals for model learning, making it difficult to mine the rich association relationships between users (items), which in turn affects the accuracy of recommendations. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to model the hierarchical neighbor relationship between users (items) in recommendation data. A graph contrastive learning method based on hierarchical neighbor enhancement (HNECL) is provided. The hierarchical neighbor representation of users (items) is modeled from two perspectives, structural and semantic. Hierarchical structural neighbor and hierarchical semantic neighbor contrast learning objectives are constructed as contrast views. Then, they are jointly optimized with the recommendation task objectives to learn a recommendation model.

[0005] Technical solution of the present invention:

[0006] A graph contrastive learning method based on hierarchical neighbor enhancement for recommendation systems includes the following steps:

[0007] Step 1: Build a user-item interaction graph and a user-user / item-item relationship graph.

[0008] First, a user-item interaction graph is constructed based on the input user-item interaction data. Then build a user-user relationship graph based on the user-item interaction graph and item-item relationship diagram

[0009] Step 2: Graph encoding and fusion.

[0010] The user-item interaction graph, user-user relationship graph, and item-item relationship graph generated in step 1 are input into the graph encoding and fusion layers respectively to learn user and item feature representations.

[0011] Based on the three graphs, we combine graph neural networks and perform node feature updates in a hierarchical fusion manner, and use the output of the hierarchical fusion as the local and global structural neighborhood representations of the nodes.

[0012] Step 3: Construct a hierarchical neighbor comparison learning objective.

[0013] constructing a hierarchical neighbor comparison learning objective based on the node and its local and global neighbor representations;

[0014] Step 4: Hierarchical semantic representation.

[0015] Based on the updated node features, a hierarchical clustering algorithm is executed in a bottom-up manner to obtain hierarchical prototype (center of mass) features, and use them as hierarchical semantic neighbor representations of the nodes;

[0016] Step 5: Hierarchical semantic neighbor comparison learning objectives.

[0017] Constructing a hierarchical semantic neighbor comparison learning objective based on the node and its hierarchical semantic neighbor table representation;

[0018] Step 6: Recommend prediction.

[0019] The probability of user interaction items is predicted based on the user and item feature representations learned in step 2, and the Bayesian Personalized Ranking (BPR) function is used to construct the recommendation task optimization objective.

[0020] Step 7: Model training.

[0021] A multi-task learning strategy is used for model training, jointly optimizing the recommendation task objectives and the hierarchical neighbor comparison learning objectives until the model converges. Finally, the trained recommendation model parameters are output.

[0022] Furthermore, the step 1 includes: first converting the input user-item interaction data into a user-item interaction graph Among them, users and items constitute a node set, and the interactions between users and items constitute undirected edges. Then, the collaborative similarity between users (or items) is calculated through the common interaction history, and the irrelevant information is filtered out by top-K to generate a user-user relationship graph. and item-item relationship diagram

[0023] Step 2 includes: using LightGCN to and The node features are updated in the three graphs, and at each layer, the output results of the three graphs are non-parametrically fused, and the fused user (item) representation is used as the input of the next layer; according to the characteristic of graph neural networks that "the output of a node in the lth layer is the aggregated representation of the node's l-hop neighbors", for each user (item) node, the first-layer fusion output result of the item (user) nodes that interact with it is used as the local structural neighbor representation of the node, and the second-layer fusion output result of the node is used as its global structural neighbor representation.

[0024] Step 3 includes: using the node representation as the anchor point, the node's local and global structural neighbor representations as positive sample pairs, and other node representations as negative sample pairs, respectively constructing local neighbor contrast learning objectives and global neighbor contrast learning objectives based on InfoNCE; combining the local and global contrast learning objectives to construct the final hierarchical structure neighbor contrast learning objective

[0025] Step 4 involves first performing K-means clustering on the node representations encoded by the graph neural network as input to obtain the prototype (centroid) representation of the first layer; then iteratively applying K-means clustering to the prototypes of the bottom layer to obtain prototype representations of higher layers. In this way, a hierarchical prototype containing L layers can be obtained.

[0026] Step 5 includes: taking the node representation as the anchor point, and considering the prototypes of different layers to which the node belongs as the semantic neighbor representations of different layers; at each semantic level, taking the prototype corresponding to the node, i.e., the semantic neighbor representation, as the positive sample pair for comparison, and other prototypes as the negative sample pair, and constructing the semantic contrastive learning target of the layer based on PCL; combining the contrastive learning targets of all layers to form the final hierarchical semantic neighbor contrastive learning target

[0027] Step 6 includes: calculating the likelihood (i.e., probability) of user interaction candidate items based on the encoded user and item feature representations, and then using the Bayesian personalized ranking function to construct the recommendation task learning objective

[0028] Step 7 includes: taking the recommendation goal as the main task and the hierarchical neighbor comparison learning goal and As an auxiliary task, a multi-task learning strategy is used to train the model and update the model parameters until convergence. Finally, the trained recommendation model parameters are output.

[0029] As described above, the algorithm of this invention works as follows: Based on the characteristics of user-item interactions, it models hierarchical neighborhoods of users (items) as a comparative view, providing effective and rich supervisory signals for recommendation model learning. First, it utilizes the hierarchical fusion output of graph neural networks across multiple graphs to model a hierarchical structural neighborhood representation. Secondly, it uses a bottom-up hierarchical clustering algorithm to model a hierarchical semantic neighborhood representation. Finally, it constructs a hierarchical neighborhood comparison learning objective from both structural and semantic perspectives, and jointly optimizes the model parameters with the recommendation objective until the model converges.

[0030] Beneficial effects

[0031] The graph comparative learning method proposed in this paper uses more sophisticated data augmentation strategies and comparative view construction to more accurately capture the complex relationships between users and items. This not only improves the accuracy of the recommendation system but also enhances the model's generalization capabilities in sparse data environments. Furthermore, the graph comparative learning method proposed in this paper utilizes a self-supervisory mechanism, enabling effective training without the need for additional labeled information, reducing data preparation costs and accelerating the deployment of recommendation models. Furthermore, this method is applicable not only to recommendation systems but can also be extended to other types of graph comparative learning tasks. In other words, it has certain generalization significance for other types of graph comparative learning methods and recommendation tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is the overall structural diagram of the present invention;

[0033] Figure 2 This is a flowchart of the overall process of the present invention;

[0034] Figure 3 This is an example diagram of node-level neighbors according to an embodiment of the present invention;

[0035] Figure 4 : is the overall framework diagram of the HNECL model in an embodiment of the present invention;

[0036] Figure 5 is a flowchart of a multi-image encoding and fusion process according to an embodiment of the present invention;

[0037] Figure 6 The experimental results of the embodiments of the present invention based on commonly used recommendation datasets and comparative experiments with other graph comparison learning methods are shown;

[0038] Figure 7 is the ablation learning experiment result in the embodiment of the present invention;

[0039] Figure 8 The following are the experimental results of the robustness of the HNECL model against the sparsity problem of recommendation data in an embodiment of the present invention;

[0040] Figure 9 This is a visual distribution comparison of node feature representation before and after deploying HNECL to the recommendation task in an embodiment of the present invention. DETAILED DESCRIPTION

[0041] The following describes the embodiments of the present invention through specific examples. Those skilled in the art will readily understand the other advantages and benefits of the present invention from the disclosure herein. The present invention may also be implemented or applied through various other specific embodiments, and the details in this specification may be modified or altered based on different viewpoints and applications without departing from the spirit of the present invention.

[0042] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.

[0043] This paper explores graph contrastive learning and recommendation tasks, and proposes an effective graph contrastive learning method based on hierarchical neighbor enhancement. Figure 3 Examples of local and global neighbors of nodes (taking users as an example) from the perspective of graph structure and examples of multi-layer semantic information of nodes (taking items as an example) from the perspective of semantic space are shown.

[0044] Figure 4 The overall framework of the model proposed in this invention is presented, which includes two modules: hierarchical neighbor mining and hierarchical semantic neighbor mining. First, the hierarchical neighbor mining module uses the hierarchical fusion encoding results of graph neural networks on multiple graphs to model the local and global neighbor representations of the node, and uses them as comparison views to construct a hierarchical neighbor comparison learning objective. Secondly, the hierarchical semantic neighbor mining module uses the node feature representation output by the previous module as input, executes a hierarchical clustering algorithm, obtains a hierarchical prototype, and regards it as the semantic neighbor representation of the node at the corresponding semantic level, and constructs a hierarchical semantic neighbor comparison learning objective on this basis. Finally, the hierarchical neighbor comparison learning objectives from the two perspectives are jointly optimized with the recommendation task objectives to help improve the quality of user and item feature representation and improve recommendation accuracy.

[0045] The specific algorithm is as follows: Figure 4 )

[0046] Step 1: Construct user-item interaction graph and user-user / item-item relationship graph.

[0047] Step 1 first constructs a user-item interaction graph based on the observed user-item interaction data, and then constructs a user-user relationship graph and an item-item relationship graph based on this.

[0048] In order to more clearly illustrate the specific implementation method of the present invention, the following definitions are made:

[0049] Definition of user and item collections: Represents a collection of users, Represents a collection of items.

[0050] Definition of user-item interaction matrix: represents the observed user-item interaction matrix, where if user u interacts with item i, then the corresponding element r u,i =1, otherwise r u,i =0.

[0051] First, build a user-item interaction graph in, Represents a collection of nodes, represents the neighbor matrix, which is defined as follows:

[0052]

[0053] Then, a user-user relationship graph and an item-item relationship graph are constructed based on the co-similarity between users (or items), where the co-similarity can be calculated through the common interaction history.

[0054] The embodiment of the present invention uses the Jaccard similarity coefficient to define collaborative similarity. Formally, given any two users (or items) The synergistic similarity between them is:

[0055]

[0056] in, Represents the user-item interaction graph The first-order neighbor set of node i.

[0057] In order to avoid introducing noise, top-K is used to filter out node pairs with low collaborative similarity to obtain the relationship matrix and Among them, the matrix and The element values ​​are as follows:

[0058] m i,j =sim i,j If and only if Otherwise i,j =0.

[0059] Finally, the user-user relationship graph is obtained based on the relationship matrix and item-item relationship diagram

[0060] Step 2: Graph encoding and fusion (e.g. Figure 5 )

[0061] The user-item interaction graph, user-user relationship graph, and item-item relationship graph generated in step 1 are input into the graph encoding and fusion layers respectively to learn user and item feature representations.

[0062] (1) Graph Encoding: LightGCN, a variant of the graph convolutional network, is used to update the node feature information in the three graphs. Taking the representation learning on the user side as an example, the message passing process of the first layer on the user-item interaction graph and the user-user relationship graph is as follows:

[0063]

[0064] Here, in formulas (3) and (4) represents the output result of node j in the l-1 layer, is the initial feature representation of node j, which is usually obtained by mapping the node ID information. represents the first-order neighbor set of node j in the user-user relationship graph.

[0065] Similarly, in and By passing messages on the item side of the graph, the item feature representation can be obtained and

[0066] (2) Hierarchical fusion: Figure 5 As shown, taking the user side as an example, for each user u, in order to capture the user-item interaction graph Interaction information and user-user relationship graph in The collaborative information of the output of the l layer and Adaptive fusion is performed in a non-parametric way, and the fused result is used as the input of the next LightGCN layer:

[0067]

[0068] Among them, γ u Represents the fusion factor of node u in layer l.

[0069] Fusion factor γ uCalculated in the following way:

[0070]

[0071] Among them, sim(·) represents the cosine similarity calculation function of two embeddings, d u Represents user u in The degree after normalization.

[0072] Similarly, you can get the fusion output of one side of the item Fused user embedding representation and item embedding representation It will be passed as input to the next GNN message propagation layer.

[0073] After L layers of encoding and fusion, average pooling is used as the readout function to calculate the final embedding representation of user and item nodes:

[0074]

[0075] Step 3: Construct hierarchical structure neighbor comparison learning objectives.

[0076] like Figure 3 As shown in Figure 3, global structural neighbor modeling considers node interactions as a whole to find nodes with similar interaction patterns. In addition, local structural neighbor modeling considers each user interaction individually to find similar nodes with the same interactions.

[0077] In this embodiment of the present invention, this step selects local and global structural neighbor representations of nodes based on the output of graph encoding and hierarchical fusion, and uses these as enhanced views of the nodes to construct hierarchical structure comparison learning objectives. For convenience, the user is still used as an example for explanation.

[0078] (1) Comparison between nodes and local structural neighbors: Given an interaction (u,i), note that when l = 1, It happens to be the aggregate representation of all users who have interacted with the target item i, It happens to be an aggregate representation of items that have a high similarity to the target item i, so and The fusion result As the local structural neighborhood representation of user u.

[0079] Similarly, for the object side, and The fusion result As the local structural neighborhood representation of item i.

[0080] Then, is the anchor point, and the local neighbor representation is a positive sample, and other users (items) are represented as negative samples to construct local structure neighborhood comparison learning objectives:

[0081]

[0082] in, represents the set of items that user u has interacted with, represents the set of all users who have interacted with the target item i. sim(·) represents the cosine similarity calculation function of two embeddings, and τ represents the temperature coefficient, which is used to control the attention paid to negative samples. Represents the set of nodes (users or items) for this training batch.

[0083] (2) Comparison between nodes and global structural neighbors: According to the message passing mechanism of graph neural networks, the receptive field of a node becomes larger as the number of GNN layers increases. Specifically, in the embodiment of the present invention, the fusion output result of the second layer of user u is Is the output result of the first layer That is, the weighted representation of all local structural neighbors of user u, so As the global structural neighborhood representation of u.

[0084] Similarly, for the object side, the fusion result of GNN layer 2 is As the global structural neighborhood representation of item i.

[0085] Then, is the anchor point, and the global neighbor representation is a positive sample, and other users (items) are represented as negative samples to build a global structure neighbor comparison learning goal:

[0086]

[0087] Finally, the local and global structured neighbor contrast learning objectives are combined to form the final hierarchical structured neighbor contrast learning objective:

[0088]

[0089] Step 4: Hierarchical semantic representation.

[0090] This paper proposes to represent the hierarchical semantic information of users (items) in recommendations through hierarchical prototypes. Prototypes here can be understood as the centroids of semantically similar node clusters in the embedding space. Hierarchical prototypes are obtained by executing a bottom-up hierarchical K-means clustering algorithm. An L-layer hierarchical K-means clustering algorithm includes the following steps:

[0091] I. Represent the users and items output in step 3 As input, perform K-means clustering once to obtain the first-level user prototype and item prototypes Where K1 represents the number of prototypes in this layer.

[0092] II. The prototypes of the next 2 to L layers are obtained by iteratively performing K-means clustering on the basis of the prototypes of the lower layer, namely:

[0093] C u,l =K-means(C u,l-1 ),C i,l =K-means(C i,l-1 ),1≤l≤L (14)

[0094] In this way, a hierarchical prototype that can reflect the hierarchical semantic information of users (items) is obtained. and

[0095] Step 5: Hierarchical semantic neighbor comparison learning objectives.

[0096] The prototypes of different levels generated in step 4 represent the compact representations of similar users (items) at different semantic levels. Therefore, the prototype representations of different levels to which each user (item) belongs are used as the semantic neighbor representations of different levels. Given a user u (or item i), with e u (or e i ) is the anchor point, and first query the prototype representation of the lth layer to which it belongs:

[0097] c u,l =query(C u,l ,u),c i,l =query(C i,l ,i). (15)

[0098] Then, with c u,l (or c i,l ) is a positive sample, and the other prototypes of this layer are negative samples. The semantic neighbor comparison learning objective of the lth layer is constructed:

[0099]

[0100] Where sim(·) represents the cosine similarity calculation function between two embeddings, τ represents the temperature coefficient, and C represents the prototype set of the corresponding level.

[0101] Finally, the semantic neighbor comparison learning objectives of each layer are combined to form the final hierarchical semantic neighbor comparison learning objective:

[0102]

[0103] Step 6: Recommend prediction.

[0104] The present invention is aimed at the field of recommendation systems, which require prediction of recommendations based on learned user and item feature representations. First, the vector inner product is used to predict the likelihood of user u interacting with candidate item i.

[0105]

[0106] The recommendation task learning objective is then defined using the Bayesian Personalized Ranking (BPR) loss function, which is widely adopted in the recommendation field. This loss function constrains user and item representation learning by making the prediction scores of observed interactions higher than those of unobserved interactions.

[0107]

[0108] in, Represents the training dataset, i represents the items that user u has interacted with, j represents the items that user u has not interacted with, and σ represents the Sigmoid activation function.

[0109] Step 7: Model training.

[0110] The present invention uses a multi-task learning strategy for model training and updates model parameters by jointly optimizing the recommendation task goal (step 6) and the hierarchical structure and semantic neighbor comparison learning goals (steps 3 and 5).

[0111]

[0112] Among them, the hyperparameters λ1 and λ2 are used to control the weight of the contrastive learning objective proposed in this invention, λ3 is the weight of the regularization term, and Θ represents the training parameter.

[0113] The default number of model training rounds is 300, and an early-stopping strategy is used to detect model convergence. Specifically, when the recall rate of the model on the validation set decreases for 10 consecutive rounds, the model has converged. At this point, training is terminated and the model parameters are output for downstream recommendation generation.

[0114] To verify the effectiveness of the present invention, a comparative experiment was conducted between the proposed graph contrastive learning method based on hierarchical neighbor enhancement for recommendation systems and other methods. Amazon-books, Gowalla, and Yelp were used as datasets, and the Recall and NDCG evaluation indicators were used to evaluate the recommendation effect. The Recall value measures the accuracy of the recommendation, and the NDCG value measures the quality of the ranking result. The comparative experiment results can be found in Figure 6 .

[0115] In the comparative experiment, it can be found from the comparative experimental results that

[0116] (1) The recommendation method based on graph neural network (GNN) is superior to the traditional recommendation method based on multi-layer perceptron (MLP), which shows that graph neural network can effectively capture the high-order connectivity between users (items) and improve the quality of node representation.

[0117] (2) Graph contrastive learning (GCL)-based recommendation methods, including the method proposed in this paper, are significantly superior to GNN-based methods, indicating that introducing graph contrastive learning into the recommendation field can effectively alleviate the data sparsity problem in recommendation scenarios and improve recommendation performance.

[0118] (3) Compared with graph contrastive learning methods based on heuristic random enhancement (including SGL, SimGCL, etc.), the graph contrastive learning method HNECL based on hierarchical neighbor enhancement proposed in this paper achieves better recommendation performance, indicating that constructing contrastive learning objectives by modeling the hierarchical neighbor relationship of nodes can fully utilize the characteristics of recommendation data and provide richer supervision signals for model learning, thereby improving the quality of user and item feature representation and improving recommendation accuracy.

[0119] In order to better explain the effectiveness of the relevant strategies proposed in this paper on recommendation tasks, ablation learning is performed on the key modules. Specifically, several variants of the generation model based on the Hierarchical Structure Neighbor Mining (HSTR) module and the Hierarchical Semantic Neighbor Mining (HSEM) module are experimentally analyzed. Figure 7 As shown, for the HSTR module, "W / o hStr" means removing the entire HSTR module, "O lStr" and "O gStr" respectively mean retaining only the local and global structural neighbor comparison learning objectives. R represents the Recall index, and N represents the NDCG index. It can be seen from the results that removing the entire structural neighbor comparison learning module will seriously weaken the recommendation performance of the model, while the performance of a single local or global neighbor comparison strategy is still ahead of the baseline method NCL. In short, the experimental results verify the effectiveness of the local and global structural neighbor comparison strategies proposed in the present invention. For the HSEM module, "W / ohSem" means removing the entire HSEM module, and "OsSem" means only adopting a single-layer semantic neighbor comparison strategy. From the experimental results, on the one hand, removing the semantic neighbor comparison will significantly weaken the model performance, and on the other hand, the single-layer semantic neighbor comparison is not as good as the multi-layer semantic neighbor comparison. The experimental results from both aspects verify the effectiveness of the hierarchical semantic neighbor comparison strategy proposed in the present invention.

[0120] Further experiments were conducted to investigate the performance of the graph contrast learning method proposed in this paper in resisting data sparsity. The users in each dataset were sorted by the number of their interactions and divided into 5 groups: G1 to G5, with the sparsity decreasing gradually. The recommendation performance of each group was then evaluated. Figure 8 As shown, HNECL, our proposed graph contrastive learning method based on hierarchical neighbor enhancement, outperforms both the GNN-based method LightGCN and the GCL-based method NCL in all groups. In particular, the greater the sparsity (e.g., G1), the greater the lead of HNECL. This further demonstrates HNECL's effectiveness and robustness in combating data sparsity, demonstrating its superior performance in recommendation scenarios with limited interaction records.

[0121] In order to more intuitively demonstrate the improvement of the recommendation performance of the graph contrast learning method proposed in this paper, the Python toolkit is used to reduce the user and item feature representations output by the model to two dimensions and visualize their distribution. Figure 9 The figure shows the distribution of user and item representations in two-dimensional space before and after deploying HNECL to the recommendation model. The figure shows that before deploying HNECL, the node representations learned by the GNN-based baseline method LightGCN exhibited a dense and uneven distribution, while after deploying HNECL, the node representations learned by the model exhibited a more even distribution. Therefore, it can be shown that the graph contrastive learning method proposed in this paper can better model different user preferences and item characteristics by learning a more even representation distribution, thereby improving recommendation accuracy.

[0122] In summary, the graph contrastive learning method based on hierarchical neighbor enhancement for recommendation systems proposed in the present invention has great advantages over existing commonly used contrastive learning methods in providing sufficient supervision signals and alleviating the sparsity problem of recommendation data. In addition, the hierarchical neighbor modeling method designed for recommendation systems in the present invention can make full use of the characteristics of recommendation data, thereby improving the quality of recommendations.

[0123] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.

Claims

1. A graph contrastive learning method based on hierarchical neighbor enhancement for recommendation systems, characterized by: The following steps are involved: Step 1: Build a user-item interaction graph and a user-user / item-item relationship graph; First, a user-item interaction graph is constructed based on the input user-item interaction data. , and then build a user-user relationship graph based on the user-item interaction graph and item-item relationship diagram ; Step 2: Graph encoding and fusion; The user-item interaction graph, user-user relationship graph, and item-item relationship graph generated in step 1 are fed into the graph encoding and fusion layers respectively to learn user and item feature representations; According to the user-item interaction graph , User-user relationship diagram and item-item relationship diagram The three graphs are combined with graph neural networks and updated with node features in a hierarchical fusion manner, and the output of the hierarchical fusion is used as the local and global structural neighborhood representation of the node; Step 3: Construct a hierarchical neighbor comparison learning objective; Based on the nodes and their local and global neighbor representations, a hierarchical neighbor comparison learning objective is constructed. ; Step 4: Hierarchical semantic representation; Based on the updated node features, a hierarchical clustering algorithm is executed in a bottom-up manner to obtain hierarchical prototype features, which are used as the hierarchical semantic neighborhood representation of the node; Step 5: Hierarchical semantic neighbor comparison learning objectives; According to the nodes and their hierarchical semantic neighbor representations, construct hierarchical semantic neighbor comparison learning objectives ; Step 6: Recommend prediction; Based on the user and item feature representations learned in step 2, the probability of user interaction items is predicted, and the Bayesian personalized ranking function is used to construct the recommendation task optimization target ; Step 7: Model training; A multi-task learning strategy is used for model training, jointly optimizing the recommendation task objectives and the hierarchical neighbor comparison learning objectives until the model converges, and finally outputting the trained recommendation model parameters.

2. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems according to claim 1, characterized in that: The step 1 is specifically as follows: Build a user-item interaction graph based on the observed user-item interaction data, and then build a user-user relationship graph and an item-item relationship graph based on this; definition: Definition of user and item collections: Represents a collection of users, Represents a collection of items; Definition of user-item interaction matrix: represents the observed user-item interaction matrix, where if the user Interacted with items , then the corresponding element ,otherwise ; First, build a user-item interaction graph ,in, Represents a collection of nodes, represents the neighbor matrix, which is defined as follows: Then, we construct a user-user relationship graph and an item-item relationship graph based on the co-similarity between users or items, where the co-similarity is calculated through the common interaction history. In order to avoid introducing noise, top-K is used to filter out node pairs with low collaborative similarity to obtain the relationship matrix and , where the matrix and The element values ​​are as follows: If and only if ,otherwise ; Finally, the user-user relationship graph is obtained based on the relationship matrix and item-item relationship diagram .

3. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems according to claim 2, characterized in that: The co-similarity is defined by the Jaccard similarity coefficient; formally, given any two users or items , the collaborative similarity between them is: in, Represents the user-item interaction graph midpoint The set of first-order neighbors of .

4. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems according to claim 1, characterized in that: The step 2 is specifically as follows: Using LightGCN and The node features are updated in the three graphs, and at each layer, the output results of the three graphs are non-parametrically fused, and the fused user or item representation is used as the input of the next layer; according to the graph neural network "node in the first The output of the layer is the node The feature of "aggregate representation of hopping neighbors" is used. For each user or item node, the first-layer fusion output of the item or user nodes that interact with it is used as the local structural neighbor representation of the node, and the second-layer fusion output of the node is used as its global structural neighbor representation. Specifically: The user-item interaction graph, user-user relationship graph, and item-item relationship graph generated in step 1 are fed into the graph encoding and fusion layers respectively to learn user and item feature representations; (1) Graph encoding: Use LightGCN, a variant of the graph convolutional network, to update the node feature information in the three graphs; User-side representation learning, on the user-item interaction graph and user-user relationship graph The message passing process of the layer is as follows: Here, in equations (3) and (4) Representation node In the The output of the layer, is a node The initial feature representation is usually obtained from the node ID information mapping; Representation node The set of first-order neighbors in the user-user relationship graph; exist and Messages are passed on the item side of the graph to obtain item feature representation and ; (2) Hierarchical integration: on the user side, for each user , in order to capture the user-item interaction graph Interaction information and user-user relationship graph in The collaborative information of The output of the layer and Adaptive fusion is performed in a non-parametric way, and the fused result is used as the input of the next LightGCN layer: in, Representation node In the The fusion factor of the layer; Fusion Factor Calculated in the following way: in, Represents the cosine similarity calculation function of two embeddings, Representative User exist The degree after normalization; Get the fusion output of one side of the item ; The fused user embedding representation and item embedding representation Passed as input to the next graph neural network message propagation layer; go through After encoding and fusion of the layers, average pooling is used as the readout function to calculate the final embedding representation of user and item nodes: 。 5. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems according to claim 1, characterized in that: The step 3 is specifically as follows: Using the node representation as the anchor, the node's local and global structural neighbor representations as positive sample pairs, and other node representations as negative sample pairs, we construct local neighbor comparison learning objectives based on InfoNCE. Compare learning objectives with global neighbors ; Combine the local and global contrastive learning objectives to construct the final hierarchical structure neighbor contrastive learning objective ; Global structural neighbor modeling looks for nodes with similar interaction patterns by considering node interactions as a whole. In addition, local structural neighbor modeling considers each user interaction individually to discover similar nodes with the same interactions. Based on the output of graph encoding and hierarchical fusion, local and global structural neighbor representations of nodes are selected respectively, and regarded as enhanced views of nodes to construct hierarchical structure comparison learning objectives; (1) Comparison between nodes and local structural neighbors: On the user side, given an interaction ( ),when hour, It happens that all the target items are interacted with The aggregate representation of users, Exactly the same as the target item Aggregate representation of items with high similarity, so and The fusion result As a user The local structure of the neighbor representation; For the item side, and The fusion result As an item The local structure of the neighbor representation; Then, / is the anchor point, and the local neighbor representation / is a positive sample, and other user / item representations are used as negative samples to build local structure neighbor comparison learning objectives: in, in, Represents a user A collection of items that have been interacted with. Indicates all interacted target items The user collection of Represents the cosine similarity calculation function of two embeddings, Represents the temperature coefficient, which is used to control the attention paid to negative samples. A set of nodes representing a training batch; (2) Comparison between nodes and global structural neighbors: According to the message passing mechanism of graph neural networks, the receptive field of nodes increases with the number of GNN layers; users The fusion output result of the second layer Is the output result of the first layer That is, users The weighted representation of all local structural neighbors of Then, / is the anchor point, and the global neighbor representation is a positive sample, and other user / item representations are used as negative samples to build a global structure neighbor comparison learning objective: Finally, the local and global structured neighbor contrast learning objectives are combined to form the final hierarchical structured neighbor contrast learning objective: 。 6. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems according to claim 1, characterized in that: The step 4 is specifically as follows: First, the node representation encoded by the graph neural network is used as input, and K-means clustering is performed to obtain the prototype representation of the first layer; then K-means clustering is iteratively applied to the prototype of the lower layer to obtain the prototype representation of the higher layer; the obtained Hierarchical prototype of the layer; Specifically, the hierarchical semantic information of users or items in the recommendation is represented by hierarchical prototypes, which are the centroids of semantically similar node clusters in the embedding space. The hierarchical prototype is obtained by executing the bottom-up hierarchical K-means clustering algorithm; a The hierarchical K-means clustering algorithm consists of the following steps: In this way, a hierarchical prototype that can reflect the hierarchical semantic information of users and items is obtained. and .

7. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems according to claim 1, characterized in that: The step 5 is specifically as follows: The prototype representations of different levels to which each user or item belongs are used as the semantic neighbor representations of different levels; given a user or items ,by or As the anchor point, first query the The prototype of the layer is: Then, or is a positive sample, and the other prototypes of this layer are negative samples. Semantic neighbor comparison learning objectives of the layer: in, Represents the cosine similarity calculation function of two embeddings, represents the temperature coefficient, Represents the prototype set of the corresponding level; Finally, the semantic neighbor comparison learning objectives of each layer are combined to form the final hierarchical semantic neighbor comparison learning objective: 。 8. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems according to claim 1, characterized in that: The step 6 is specifically as follows: The likelihood of user interaction candidate items is calculated based on the encoded user and item feature representations, and then the recommendation task learning objective is constructed using the Bayesian personalized ranking function. ; Specifically, we first use the vector inner product to predict the user With candidate items The likelihood of interaction: The Bayesian personalized ranking (BPR) loss function is then used to define the recommendation task learning objective. This loss function constrains user and item representation learning by making the prediction score of observed interactions higher than the prediction score of unobserved interactions. in, represents the training dataset, Represents a user Interacted items, Represents a user Uninteracted items, Represents the Sigmoid activation function.

9. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems according to claim 1, characterized in that: The step 7 is specifically as follows: Taking the recommendation goal as the main task, the hierarchical neighbor comparison learning goal and As an auxiliary task, a multi-task learning strategy is used to train the model and update the model parameters until convergence; finally, the trained recommendation model parameters are output; Specifically, the model parameters are updated by jointly optimizing the recommendation task goal, the hierarchical structure, and the semantic neighbor comparison learning goal in step 6: Among them, the hyperparameters Used to control the weight of comparative learning objectives, represents the training parameters; The default number of model training rounds is 300, and an early stopping strategy is used to detect model convergence. Specifically, when the recall rate of the model on the validation set decreases for 10 consecutive rounds, it indicates that the model has converged. At this time, training is terminated and the model parameters are output for downstream recommendation result generation.

Citation Information

Patent Citations

  • Recommendation method and system based on graph contrast learning and social network enhancement

    CN114036406A

  • Method and apparatus for anomaly detection on graph

    WO2023010502A1