Graph contrast learning method oriented to recommendation system and based on hierarchical neighbor enhancement
By introducing a graph comparison learning method based on hierarchical neighbor enhancement in the recommendation system, the HNECL method can more accurately capture the complex relationship between the user and the item, solving the problem of insufficient supervision signals in the existing methods, and improving the accuracy and generalization ability of recommendations.
Patent Information
- Application Number
- CN202411873415.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-18
AI Technical Summary
The existing graph comparison learning methods fail to fully utilize the hierarchical structure and semantic neighbor relationships between users (or items) in the recommendation system, resulting in insufficient supervision signals and affecting the accuracy of recommendations.
A graph comparison learning method (HNECL) based on hierarchical neighbor enhancement is proposed. By constructing user-item interaction graph, user-user/item-item relationship graph, combined with graph neural network and hierarchical clustering algorithm, modeling the hierarchical structure and semantic neighbor representation of users (item) to construct joint optimization of comparison learning goals and recommended tasks.
Through more refined data augmentation strategies and contrast view construction, the HNECL method can more accurately capture the complex relationship between users and items, improve the accuracy and generalization capabilities of the recommendation system, and reduce the cost of data preparation.
Smart Images

Figure CN119646312A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of recommendation systems, and in particular relates to a graph contrast learning method based on hierarchical neighbor enhancement for recommendation systems. Background Art
[0002] Recommendation systems are widely used on major Internet platforms. They learn user and item representations from historical interaction data (clicks, ratings, purchases, etc.) 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 supervision signals. To alleviate this problem, graph contrast learning is introduced into recommendation systems to learn view-independent and stable user (item) feature representations by maximizing the consistency between the established contrast-enhanced views.
[0003] Most existing graph contrastive learning methods adopt heuristic random augmentation strategies to construct 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 neighbor relationships between users (or items), failing to fully utilize the potential of contrastive learning for recommendation. Although some methods consider the neighbor relationships between nodes to some extent, they only model the relationships at a single level. Specifically, these methods either regard the interaction of nodes as a whole, only consider the structural neighbor relationships at the global level, lack the exploration of local neighbor relationships, or only model the semantic information at a single level, ignoring the fact that users (items) usually have hierarchical semantics, which results in the inability to provide sufficient supervisory contrast signals for model learning, making it difficult to mine the rich association relationships between users (items), thus affecting 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 for short) is provided to model the hierarchical neighbor representation of users (items) 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 graph
[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 layer respectively to learn user and item feature representations.
[0011] According to the three graphs, the node features are updated by combining the graph neural network and hierarchical fusion, and the output of the hierarchical fusion is used as the local and global structural neighbor representation of the node;
[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] According to the updated node features, a hierarchical clustering algorithm is executed in a bottom-up manner to obtain hierarchical prototype (centroid) features, and use them as hierarchical semantic neighbor representations of the nodes;
[0016] Step 5: Hierarchical semantic neighbor comparison learning objectives.
[0017] According to the node and its hierarchical semantic neighbor table representation, construct a hierarchical semantic neighbor comparison learning objective;
[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 Users and items form a node set, and the interactions between users and items form undirected edges. Next, the collaborative similarity between users (or items) is calculated through the common interaction history, and irrelevant information is filtered out in combination with top-K to generate a user-user relationship graph. and item-item relationship graph
[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 network "the output of the 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 local and global structural neighbor representations of the node as the positive sample pair, and other node representations as the negative sample pair, based on InfoNCE, constructing the local neighbor contrast learning objective and the global neighbor contrast learning objective respectively; combining the local and global contrast learning objectives to construct the final hierarchical structure neighbor contrast learning objective
[0025] Step 4 includes: first, taking the node representation encoded by the graph neural network as input, performing K-means clustering to obtain the prototype (centroid) representation of the first layer; then iteratively applying K-means clustering to the prototype of the bottom layer to obtain the prototype representation of the higher layer. In this way, a hierarchical prototype containing L layers can be obtained.
[0026] Step 5 includes: taking the node representation itself as the anchor point, and considering the prototypes of different layers to which the node belongs as its semantic neighbor representations at different levels; 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 this 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 learning the hierarchical neighbor comparison 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 mentioned above, the algorithm principle of the present invention is: starting from the user-item interaction characteristics, modeling the hierarchical neighbors of users (items) as a comparison view to provide effective and rich supervision signals for recommendation model learning. First, the hierarchical structure neighbor representation is modeled by using the hierarchical fusion output of the graph neural network on multiple graphs; secondly, the hierarchical semantic neighbor representation is modeled through a bottom-up hierarchical clustering algorithm; finally, a hierarchical neighbor comparison learning objective with both structural and semantic perspectives is constructed, and the model parameters are jointly optimized with the recommendation objective until the model converges.
[0030] Beneficial Effects
[0031] The graph contrast learning method proposed in the present invention can more accurately capture the complex relationship between users and items through more sophisticated data enhancement strategies and contrast view construction. This not only improves the accuracy of the recommendation system, but also enhances the generalization ability of the model in a sparse data environment. At the same time, the graph contrast learning method proposed in the present invention also utilizes a self-supervision mechanism, which can be effectively trained without additional annotation information, reducing data preparation costs and speeding up the deployment of recommendation models. Not only that, the present invention is not only applicable to recommendation systems, but can also be extended to other types of graph contrast learning tasks. In other words, it has a certain generalization significance for other types of graph contrast learning methods and recommendation tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is the overall structure diagram of the present invention;
[0033] Figure 2 It is the overall processing flow chart 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 It is the overall framework diagram of the HNECL model in the embodiment of the present invention;
[0036] Figure 5 is a flow chart of a multi-image encoding and fusion process in an embodiment of the present invention;
[0037] Figure 6 The experimental results of the commonly used recommendation data sets in the embodiments of the present invention and the 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 robustness experimental results of the HNECL model against the sparsity problem of recommendation data in the embodiment of the present invention;
[0040] Fig. 9 This is a visualization distribution comparison of node feature representation before and after HNECL is deployed 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, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways 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 only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being 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 complicated.
[0043] The present invention 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 the present invention is shown, which includes two modules: hierarchical neighbor mining and hierarchical semantic neighbor mining. First, the hierarchical neighbor mining module models the local and global neighbor representations of nodes by using the hierarchical fusion encoding results of graph neural networks on multiple graphs, and constructs a hierarchical neighbor comparison learning objective as a comparison view. Secondly, the hierarchical semantic neighbor mining module uses the node feature representation output by the previous module as input, executes the hierarchical clustering algorithm, obtains the hierarchical prototype, and regards it as the semantic neighbor representation of the node at the corresponding semantic level, and constructs the hierarchical semantic neighbor comparison learning objective on this basis. Finally, the hierarchical neighbor comparison learning objectives from 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 the 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 and 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 graph
[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 layer respectively to learn user and item feature representations.
[0062] (1) Graph encoding: Use LightGCN, a variant of graph convolutional networks, 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 lth layer on the user-item interaction graph and the user-user relationship graph is as follows:
[0063]
[0064] Here, in equations (3) and (4) represents the output result of node j at layer l-1, It is the initial feature representation of node j, 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, we can get the item feature representation 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 layer l 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 gamma uIt is calculated by:
[0070]
[0071] Among them, sim(·) represents the cosine similarity calculation function of two embeddings, d u Represents user u in The normalized degree.
[0072] Similarly, you can get the fusion output on one side of the item Fusion of 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 neighbor comparison learning objectives.
[0076] like Figure 3 As shown in Figure 2, global structural neighbor modeling finds nodes with similar interaction patterns by considering node interactions as a whole. In contrast, local structural neighbor modeling considers each user interaction individually to discover similar nodes with the same interactions.
[0077] In the embodiment of the present invention, this step selects the local and global structural neighbor representations of the node based on the output results of graph encoding and hierarchical fusion, and regards them as the enhanced view of the node to construct the hierarchical structure comparison learning target. For convenience, the user is still used as an example for explanation.
[0078] (1) Comparison of nodes with 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 the aggregate representation of items with 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 neighbors represent is a positive sample, and other users (items) are represented as negative samples to construct local structure neighbor 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 increases with the number of GNN layers. Specifically, in this embodiment of the present invention, the fusion output result of the second layer of user u is It is the output result of layer 1 That is, the weighted representation of all local structural neighbors of user u, so As the global structural neighbor representation of u.
[0084] Similarly, for the object side, the fusion result of the second layer of GNN As the global structural neighbor 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 objective:
[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] The present invention proposes to represent the hierarchical semantic information of users (items) in recommendations through hierarchical prototypes. The prototypes here can be understood as the centroids of semantically similar node clusters in the embedding space. The 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 Among them, 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. 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] Among them, sim(·) represents the cosine similarity calculation function of 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, and needs to make recommendation predictions 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 data set, 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 the model parameters by jointly optimizing the recommendation task objectives (step 6) and the hierarchical structure and semantic neighbor comparison learning objectives (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 the present invention, λ3 is the weight of the regularization term, and Θ represents the training parameters.
[0113] The default number of model training rounds is 300, and an early-stopping strategy is used to detect whether the model has converged. Specifically, when the recall rate of the model on the validation set decreases for 10 consecutive rounds, it means that the model has converged. At this time, the training is terminated and the model parameters are output for downstream recommendation result generation.
[0114] To verify the effectiveness of the present invention, the graph contrast learning method based on hierarchical neighbor enhancement for recommendation system and other methods are compared in experiments. Amazon-books, Gowalla and Yelp are used as data sets, and the Recall and NDCG evaluation indicators are 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 experimental 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 better than 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) Recommendation methods based on graph contrastive learning (GCL), including the method proposed in this paper, are significantly better than 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 the present invention achieved better recommendation performance, indicating that constructing contrastive learning objectives by modeling the hierarchical neighbor relationship of nodes can make full use of 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 represent 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 test the performance of the graph contrast learning method proposed in this invention in resisting data sparsity. The users in each data set were sorted according to the number of their interactions and divided into 5 groups: G1 to G5, with the sparsity gradually decreasing. The recommendation performance of each group was then evaluated. Figure 8 As shown in the figure, the proposed graph contrastive learning method HNECL based on hierarchical neighbor enhancement outperforms the GNN-based method LightGCN and the GCL-based method NCL in all groups. In particular, the greater the sparsity (such as G1), the greater the lead of HNECL. This further verifies the effectiveness and robustness of HNECL in resisting data sparsity problems, indicating that HNECL is better at 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 invention, the Python toolkit is used to reduce the user and item feature representations output by the model to two dimensions and visualize their distribution. Fig. 9 The distribution of user and item representations in two-dimensional space before and after HNECL is deployed to the recommendation model is shown. From the diagram, it can be seen that before HNECL is deployed, the node representations learned by the baseline method LightGCN based on GNN show a staggered dense distribution, while after HNECL is deployed, the node representations learned by the model show a more uniform distribution. Therefore, it can be explained that the graph contrast learning method proposed in the present invention can better model different user preferences and item features by learning a more uniform representation distribution, thereby improving the accuracy of recommendations.
[0122] In summary, the graph contrastive learning method based on hierarchical neighbor enhancement for recommendation systems proposed in the present invention has great advantages in providing sufficient supervision signals and alleviating the sparsity problem of recommendation data compared with the existing commonly used contrastive learning methods. 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 familiar with 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 a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still 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 in that: 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. Then build a user-user relationship graph based on the user-item interaction graph and item-item relationship graph 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 input into the graph encoding and fusion layer respectively to learn user and item feature representations; According to the three graphs, the node features are updated by combining the graph neural network and hierarchical fusion, and the output of the hierarchical fusion is used as the local and global structural neighbor 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; According to the updated node features, a hierarchical clustering algorithm is executed in a bottom-up manner to obtain hierarchical prototype features, and use the hierarchical prototype features as hierarchical semantic neighbor representations of the nodes; Step 5: Hierarchical semantic neighbor comparison learning objectives; According to the node and its hierarchical semantic neighbor table representation, construct a hierarchical semantic neighbor comparison learning objective Step 6: Recommend prediction; According to the user and item feature representation 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, which jointly optimizes the recommendation task objectives and hierarchical neighbor comparison learning objectives until the model converges, and finally outputs the trained recommendation model parameters.
2. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation system 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 the 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; First, build a user-item interaction graph in, Represents a collection of nodes. represents the neighbor matrix and 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 Among them, the matrix and The element values are as follows: m i,j =sim i,j If and only if Otherwise i,j =0; Finally, the user-user relationship graph is obtained based on the relationship matrix and item-item relationship graph 3. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation system 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 synergistic similarity between them is: in, Represents the user-item interaction graph The first-order neighbor set of node i.
4. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation system 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 characteristic of graph neural network that "the output of the node in the lth layer is the aggregated representation of the node's l-hop neighbors", for each user or item node, the first-layer fusion output result of the item or user node that interacts 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; specifically: 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 layer respectively to learn user and item feature representations; (1) Graph encoding: Use LightGCN, a variant of graph convolutional networks, to update the node feature information in the three graphs; For representation learning on the user side, the message passing process at the lth layer on the user-item interaction graph and the user-user relationship graph is as follows: Here, in equations (3) and (4) represents the output result of node j at layer l-1, is the initial feature representation of node j, usually obtained from the node ID information mapping; represents the first-order neighbor set of node j in the user-user relationship graph; Similarly, in and By passing messages on the item side of the graph, we can get the item feature representation and (2) Hierarchical fusion: On the user side, 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 layer l and Adaptive fusion is performed in a non-parametric way, and the fused result is used as the input of the next LightGCN layer: Among them, γ u represents the fusion factor of node u in layer l; Fusion factor gamma u It is calculated by: Among them, sin(·) represents the cosine similarity calculation function of two embeddings, d u Represents user u in The normalized degree in Similarly, you can get the fusion output on one side of the item Fusion of user embedding representation and item embedding representation Passed as input to the next graph neural network message propagation layer; 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:
5. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation system 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 finds nodes with similar interaction patterns by considering node interactions as a whole; in complement, local structural neighbor modeling considers each user's interaction separately to find similar nodes with the same interactions; Based on the output results of graph encoding and hierarchical fusion, local and global structural neighbor representations of nodes are selected respectively, and they are 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 (u,i), 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 the aggregate representation of items with high similarity to the target item i, so and The fusion result As the local structural neighborhood representation of user u; Similarly, for the object side, and The fusion result As the local structural neighbor representation of item i; Then, is the anchor point, and the local neighbors represent is a positive sample, and other users (items) are represented as negative samples to construct local structure neighbor comparison learning objectives: 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, τ represents the temperature coefficient, which is used to control the attention to negative samples, and B represents the node set of the 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; the fusion output result of the second layer of user u It is the output result of layer 1 That is, the weighted representation of all local structural neighbors of user u, Then, is the anchor point, and the global neighbor representation For positive samples, other users or items are represented 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 system according to claim 1, characterized in that: The step 4 is specifically as follows: First, we use the node representation encoded by the graph neural network as input and perform K-means clustering to obtain the prototype representation of the first layer. Then, we iteratively apply K-means clustering to the prototype of the bottom layer to obtain the prototype representation of the higher layer. In this way, we can obtain a hierarchical prototype containing L layers. Specifically, hierarchical prototypes are used to represent the hierarchical semantic information of users or items in recommendations. The prototypes here can be understood as the centroids of semantically similar node clusters in the embedding space. The 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: 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 Among them, K1 represents the number of prototypes in this layer; 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: C u,l =K-means(C u,l-1 ),C i,l =K-means(C i,l-1 ),2≤l≤L (14) In this way, a hierarchical prototype that can reflect the hierarchical semantic information of users (items) is obtained. and 7. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation system 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 u or an item i, u or e i As an anchor, first query the prototype representation of the lth layer to which it belongs: c u,l =query(C u,l ,u),c i,l =query(C i,l ,i). (15) 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: Among them, sim(·) represents the cosine similarity calculation function of two embeddings, τ represents the temperature coefficient, and C 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 system according to claim 1, characterized in that: The step 6 is specifically as follows: The likelihood of user interaction with 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 likelihood of user u interacting with candidate item i: 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 scores of observed interactions higher than those of unobserved interactions. in, represents the training data set, 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.
9. The graph contrast learning method based on hierarchical neighbor enhancement for recommendation system according to claim 1, characterized in that: The step 7 is specifically as follows: Taking recommendation as the main task, hierarchical neighbor comparison learning objective and As an auxiliary task, use a multi-task learning strategy to train the model and update the model parameters until convergence; finally output the trained recommendation model parameters; Specifically, the model parameters are updated by jointly optimizing the recommendation task goal and the hierarchical structure and semantic neighbor comparison learning goals in step 6. Among them, the hyperparameters λ1 and λ2 are used to control the weights of the contrastive learning objectives, and Θ represents the training parameters; The default number of model training rounds is 300, and the early stopping strategy is used to detect whether the model has converged. Specifically, when the recall rate indicator of the model on the validation set decreases for 10 consecutive rounds, it means that the model has converged. At this time, the 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
Cross-hierarchy graph contrast learning bundled commodity recommendation method
CN116611894A
Decoupling graph comparison collaborative filtering recommendation method fusing structural neighbors and semantic neighbors
CN116738069A
Citation network graph representation learning system and method based on multi-view contrastive learning
US20240104376A1
Method and apparatus for anomaly detection on graph
WO2023010502A1
Cited By
Dual contrast learning recommendation method and system, electronic equipment and storage medium
CN120707252A