A Recommendation Method and System Based on Graph Contrastive Learning and Social Network Enhancement
By introducing graph comparison learning and social networks into the recommendation system, generating metapaths and computing high-order neighbor feature representations, the problem of insufficient historical behavior data of cold-start users is solved, and more accurate and robust user interest modeling and recommendation effects are achieved.
Patent Information
- Application Number
- CN202111301586.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-04
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2041-11-04
AI Technical Summary
The existing recommendation system is not effective in cold start scenarios, mainly due to insufficient supervision data for model learning due to insufficient user historical behavior data.
Using a recommendation method based on graph comparison learning and social network enhancement, different types of metapaths are generated by constructing interactive two-part graphs and social networks, high-order neighbor feature representations of nodes are calculated using graph neural networks, and more robust user and item feature representations are obtained through comparison loss functions.
In the cold start user scenario, the recommendation method of graph comparison learning and social network enhancement can better model user interest preferences, improve the accuracy and robustness of recommendations, and enhance the performance of the recommendation system.
Smart Images

Figure CN114036406B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to data mining, social networks, and recommendation systems, and particularly to a recommendation method and system based on graph contrast learning and social network enhancement. Background Art
[0002] With the rapid development of the Internet, the data on the network shows an explosive growth trend. For users, it has become increasingly difficult to quickly find the information or items they want from the vast amount of data, which is the problem of information overload. In this context, personalized recommendation systems have gradually developed. Its core idea is to analyze and mine the historical behavior data of users, obtain the interest preferences of users through a certain model, and then use this model to predict the items or information that users may be interested in and recommend them to users. The personalized recommendation system does not require users to accurately describe their own needs, but models based on the historical behavior of users and actively provides information that meets the interests and needs of users. Therefore, when the historical behavior of users is insufficient, the recommendation effect is often relatively poor, which is the cold start problem.
[0003] In recent years, various social platforms have developed rapidly, providing a large amount of user social data, such as user friendship relationships, user like behaviors, user forwarding behaviors, etc., which has had a profound impact on the recommendation system. The well-known American third-party survey agency Nielsen surveyed the factors that affect users' belief in a certain recommendation. The survey results show that 90% of users trust the recommendations of their friends, and 70% of users trust the comments of other users on advertised products on the Internet. From this survey, it can be seen that the recommendations of friends are very important for increasing users' trust in the recommendation results. For users with little historical behavior, we can recommend items by analyzing the preferences of their friends. In this way, the social network can improve the performance of recommendations in cold start scenarios.
[0004] Although the social network can alleviate the cold start problem of the recommendation system to a certain extent, it still does not fundamentally solve the cold start problem, that is, the historical behavior data of users is too small, resulting in insufficient supervised data for the recommendation model to learn. The emergence of graph contrast learning has brought a new solution to this problem.
[0005] Most of the mainstream methods in current machine learning are supervised learning methods, which rely on manually labeled tags. However, the manually labeled tags are often sparse. Therefore, training a model using supervised learning methods requires a large amount of labeled data, and the resulting model is sometimes "fragile". The information provided by the data itself is much richer than the sparse tags. Therefore, directly using the data itself to provide supervision information can better guide the learning process, which is self-supervised learning. Graph contrastive learning is a type of self-supervised learning. It is performed on graph data by constructing positive and negative example samples of the data to learn the feature representations of the samples. Currently, graph contrastive learning has achieved good results in tasks such as node classification, but few studies have considered how to introduce graph contrastive learning in the recommendation scenario to enhance the performance of the recommendation system. Summary of the Invention
[0006] Objective of the Invention: Aiming at the problems and deficiencies existing in the above-mentioned existing recommendation technologies, the objective of the present invention is to provide a recommendation method and system based on graph contrastive learning and social network enhancement. In the process of obtaining the interest preferences of users, the graph contrastive learning technology is used to obtain more robust and complete feature representations of users and items, so as to better model the interests of cold-start users, improve the recommendation effect for cold-start users, and further enhance the performance of the recommendation system.
[0007] Technical Solution: To achieve the above objective of the invention, the technical solution adopted by the present invention is a recommendation method based on graph contrastive learning and social network enhancement, including the following steps:
[0008] (1.1) For the currently given user historical behavior data and social data, extract the interaction records of users with items from the historical behavior data to form an interaction bipartite graph, and represent the adjacency matrix of the interaction bipartite graph as R. Obtain the friend relationships from the social data to form a social network, and represent the adjacency matrix of the social network as S;
[0009] (1.2) Based on the adjacency matrix obtained in step (1.1), first generate the adjacency matrices of different types of meta-paths to obtain the high-order neighbors of the nodes. Then use the graph neural network to calculate the third feature representation of the first-order neighbors and the fifth feature representation of the high-order neighbors of each node respectively. Use the contrastive loss function, the third feature representation, the fifth feature representation, and the gradient descent method to make the contrastive loss function converge, and obtain the sixth feature representation of the converged nodes;
[0010] (1.3) Based on the feature representations obtained in step (1.2), use the graph neural network to calculate the feature representations of users and items for calculating preference scores. Then, according to the interaction records obtained in step (1.1), use the Bayesian personalized ranking loss function to continuously update and optimize the graph neural network recommendation model;
[0011] (1.4) Based on the graph neural network recommendation model obtained in step (1.3), obtain the feature representations of all users and items. Then, for each user, calculate the vector similarity between the user and the items not recommended to the user, and select the items with the top-ranked vector similarities to recommend to the user.
[0012] Further, step (1.2) includes the following steps:
[0013] (2.1) First, define four types of meta-paths and the calculation methods of their adjacency matrices: user-item-user is RR T , user-user-item is SR, item-user-item is R T R, user-user-user is SS; for each type of meta-path, use the adjacency matrix R of the interaction bipartite graph and the adjacency matrix S of the social network to perform the corresponding matrix multiplication to obtain the adjacency matrix corresponding to the meta-path;
[0014] (2.2) Use the graph attention network to aggregate the first-order user neighbors and first-order item neighbors of each node to obtain the first feature representation of the first-order user neighbors and the second feature representation of the first-order item neighbors. Then, use the first attention mechanism at the type level to aggregate the first feature representation and the second feature representation to obtain the third feature representation of the first-order neighbors of the node; then use the graph convolutional network to aggregate each meta-path associated with the node to obtain the fourth feature representation of each meta-path, and then use the second attention mechanism at the meta-path level to aggregate different meta-paths to obtain the fifth feature representation of the high-order neighbors of the node;
[0015] (2.3) According to the third feature representation and the fifth feature representation generated in step (2.2), use the third feature representation and the fifth feature representation of the same node as positive examples, and use the third feature representation and the fifth feature representation of different nodes as negative examples to generate positive and negative example pairs. Then, use the contrast loss function and the gradient descent method for training, and continuously update all feature representations. After the contrast loss function converges, obtain the feature representations of all nodes.
[0016] Further, step (1.3) includes the following steps:
[0017] (3.1) Use the sixth feature representation obtained in step (1.2) as the initial feature representation of all nodes, and then use the graph neural network to perform the aggregation operation of neighbor nodes for each node as the seventh feature representation of each node;
[0018] (3.2) Construct positive and negative example pairs for training the recommendation model based on the interaction records obtained in step (1.1), and use the Bayesian personalized ranking loss function and the gradient descent method to update the feature representations of each user node and item node and the parameters of the graph neural network recommendation model. After the loss converges, obtain the final feature representations of users and items.
[0019] A recommendation system based on graph contrast learning and social network enhancement includes the following steps:
[0020] (4.1) A data processing module for preprocessing the historical behavior data and social data of users to form an interaction bipartite graph and a social network, and saving them in the form of an adjacency matrix;
[0021] (4.2) A graph contrast learning module to obtain the first-order neighbors and high-order neighbors of all nodes according to the interaction bipartite graph and the social network, use the graph neural network to obtain the feature representations of the first-order neighbors and high-order neighbors, and then obtain the feature representations of all nodes through graph contrast learning training;
[0022] (4.3) A recommendation module for performing supervised learning based on the historical interaction records of users and the pre-trained node representations to obtain a trained recommendation model, and for the input user, a list of items recommended for him can be returned.
[0023] Beneficial effects: Aiming at the cold start problem of the recommendation system, the present invention first introduces a social network to make up for the shortage of sparse historical behavior data of users in the recommendation scenario. In the actual recommendation scenario, a user's behavior preference is likely to be influenced by his friends. Introducing a social network can obtain the user's behavior preference from the perspective of friends rather than the perspective of interaction records. Then use the graph data itself to construct a supervision signal, and perform a pre-training process on the feature representations of users and items through graph contrast learning, which can make more full use of the original data, enhance the training effect, and obtain more robust node feature representations. Then optimize the recommendation model based on the pre-trained feature representations and interaction records, which can better obtain the user's behavior preference and make the recommendation model produce better recommendation effects in cold start or data sparse scenarios. Brief Description of the Drawings
[0024] Figure 1 is the flowchart of the method of the present invention.
[0025] Figure 2 is the system framework diagram of the present invention.
[0026] Figure 3 is the meta-path example diagram of the present invention.
[0027] Specific Embodiments
[0028] The present invention will be further illustrated below in conjunction with the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and not to limit the scope of the present invention. After reading the present invention, those skilled in the art's various equivalent modifications of the present invention all fall within the scope defined by the appended claims of this application.
[0029] The present invention discloses a recommendation method and system based on graph contrast learning and social network enhancement. The method flow chart is as Figure 1 shown, and it includes the following steps: First, for the historical behavior data and social data of a given user, extract the interaction records of the user with items from the historical behavior data to form an interaction bipartite graph, and extract the friend relationships between users from the social data to form a social network; then generate different types of meta-paths based on the interaction graph and the social network to obtain the high-order neighbors of each node, and then use a graph neural network model to calculate the first-order neighbor feature representation and high-order neighbor feature representation of each node, and update and optimize the feature representation of the node by comparing these two feature representations; next, further update and optimize the recommendation model and the vectors of the nodes according to the interaction records of the user with items; finally, in the recommendation module, for the user who needs to recommend items, calculate the vector similarity between it and each item, and select the items with higher similarity to recommend to the user.
[0030] The system framework of the present invention is as Figure 2 shown, and it includes four parts: construct an interaction bipartite graph and a social network according to the historical behavior data and social data of a given user; use graph contrast learning to train on the graph according to the interaction bipartite graph and the social network to obtain the feature representations of all users and items; train the recommendation model based on the feature representations of users and items obtained by graph contrast learning and the interaction records of users; for the user who needs to recommend items, use the trained recommendation model to output the list of items recommended to it.
[0031] The specific implementation manners are described as follows:
[0032] 1. Construct an interaction bipartite graph and a social network according to the historical behavior data and social data of a given user
[0033] For the historical behavior data of a given user, if the data provides whether the user likes or has interacted with an item, then only extract those historical behaviors indicating that the user likes or has interacted as interaction records; if the data provides the user's rating for the item, a threshold can be set according to the rating score range to extract historical behaviors with scores higher than this threshold as the interaction records of this user. For example, if the rating is an integer from 1 to 5, then set the threshold to 3. When the user rates an item 4 or 5, take this record as the user's interaction record. Then, based on the user's interaction records, construct an interaction matrix. Each row of the matrix represents the interaction situation of a user with all items, and each column represents the interaction situation of an item by all users. For example, the value of the m-th row and n-th column being 1 indicates that user m has interacted with item n, and the value being 0 indicates no interaction. Use this interaction matrix to represent the interaction bipartite graph, that is, if user m and item n have an interaction, then there is an edge connecting them on the graph. Hereinafter, use R to represent the adjacency matrix of the interaction bipartite graph.
[0034] For the given user's social data, only take those positive relationships such as friendship as the user's social records, and then construct the adjacency matrix of the social network. Each row of the matrix represents whether a user has a social relationship with other users. For example, the value of the m-th row and n-th column being 1 indicates that user m and user n are friends, and there is an edge connecting them on the graph. Hereinafter, use S to represent the adjacency matrix of the social network. The interaction bipartite graph and the social network together form a heterogeneous graph, which respectively describe the interaction relationship and social relationship on this heterogeneous graph.
[0035] 2. According to the interaction bipartite graph and the social network, use graph contrast learning to perform pre-training on the graph to obtain the feature representations of all users and items
[0036] Currently, the mainstream recommendation models using graph neural networks directly learn user preferences based on the user's historical interaction records, and the initial feature representations of all nodes are randomly initialized, which is bound to be affected by data sparsity. That is, for users with insufficient historical behaviors, it is difficult for us to accurately obtain their preferences. Therefore, in this process, before using the recommendation model, it is necessary to first introduce graph contrast learning to mine supervision information based on the graph data itself, and then pre-train the feature representations of all nodes according to the mined supervision information. After the graph contrast learning ends, the feature representation of each node is no longer a randomly initialized feature representation, but a feature representation that integrates some information of the interaction bipartite graph and the social network itself. Using this feature representation to initialize the parameters of the recommendation model can effectively improve the performance of the subsequent recommendation process.
[0037] Since the interaction bipartite graph and the social network describe the neighbors of each node on the graph, the first-order neighbors of each node can be directly obtained from R and S. In addition, different types of meta-paths on the graph describe different semantic relationships for obtaining the preference characteristics of the current user and item. For example, those users who have interacted with the same item as a certain user may be closer to the preference of that user than other users. Based on this idea, several meta-path relationships are predefined to capture the semantic relationships between higher-order neighbors and current neighbors, such as user-item-user, etc. For each meta-path, the corresponding adjacency matrix can be obtained by matrix multiplication using the adjacency matrices of the interaction bipartite graph and the social network. Figure 3 This is a simple use case illustration of meta-paths. The left legend represents a heterogeneous graph composed of an interaction bipartite graph and a social network, where the edge between users indicates that the two users are friends with each other, and the edge between a user and an item indicates that the user has interacted with the item; the right legend illustrates four different types of meta-paths on this graph.
[0038] Through different types of meta-paths, higher-order neighbors with different semantic relationships to the current node can be obtained. The following lists the semantic information carried by different types of meta-paths and the matrix calculation rules for generating these meta-paths:
[0039] (1) user-item-user, representing other users who have interacted with the same item as the current user, and the matrix calculation rule is RR T ;
[0040] (2) user-user-item, representing the items interacted with by the friends of the current user, and the matrix calculation rule is SR;
[0041] (3) item-user-item, representing other items that have been interacted with by the same user as the current item, and the matrix calculation rule is R T R;
[0042] (4) user-user-user, representing the friends of the friends of the current user, and the matrix calculation rule is SS.
[0043] For the same user node, its first-order neighbors and higher-order neighbors both partially reflect the preference of this user, and the same is true for item nodes. Therefore, the feature representations of the first-order and higher-order neighbors of the same node should tend to be the same, while those of different nodes should tend to be different. Therefore, next, based on the obtained first-order neighbors and higher-order neighbors, graph contrastive learning is used to train the node feature representations:
[0044] (1) The first-order neighbors of a user include two different types of nodes: users and items. Moreover, the influence degrees of neighbor nodes of the same type on the current node may also vary. Here, the graph attention network is first used to aggregate neighbors of the same type respectively to obtain the feature representations of the first-order user neighbors and the first-order item neighbors, denoted as the first feature representation and the second feature representation respectively. Then, a type-level attention mechanism is used to fuse the first feature representation and the second feature representation, that is, to obtain the feature representation of the first-order neighbors of this user, denoted as the third feature representation. The type-level attention mechanism here is denoted as the first attention mechanism, and the calculation method is as follows:
[0045]
[0046]
[0047] Among them, β 1 represents the attention weight of the first-order item neighbors, β 2 represents the attention weight of the first-order user neighbors, FNN represents the feed-forward neural network, h u represents the feature representation of the current user, represents the feature representation of the first-order item neighbors, represents the feature representation of the first-order user neighbors, || represents the vector concatenation operation;
[0048] For an item, its neighbors are only of one type, i.e., users. Therefore, only the first-order user neighbors need to be aggregated, and there is no need to introduce the first attention mechanism;
[0049] (2) For the high-order neighbors of a node, first, the graph convolution network is used to aggregate the feature representations of the neighbor nodes belonging to the same meta-path to obtain the feature representation of each meta-path, denoted as the fourth feature representation. Then, since different meta-paths represent different semantic relationships, here, a semantic-level attention mechanism is used again to aggregate the feature representations of the high-order neighbors on different meta-paths, that is, to obtain the feature representation of the high-order neighbors of this user, denoted as the fifth feature representation. The semantic-level attention mechanism here is denoted as the second attention mechanism, and the calculation is as follows:
[0050]
[0051]
[0052] Among them, q p represents the weight corresponding to the meta-path p, v is the introduced attention vector, W and b are trainable parameters, represents the feature representation of the meta-path p related to the user u, β p represents the final attention weight of the meta-path, P uDenote the set of meta - paths related to user \(u\), and \(\exp\) represents the exponential function with base \(e\) (the natural constant);
[0053] (3) After obtaining the node representations of the first - order and high - order neighbors, construct the InfoNCE contrastive loss function. The positive examples are the third and fifth feature representations of the same node, and the negative examples are the third and fifth feature representations of different nodes. Its calculation method is as follows:
[0054]
[0055]
[0056]
[0057] where \(\text{sim}\) represents the cosine similarity, and \(\tau\) is the hyperparameter in InfoNCE. represents the feature representation of the first - order neighbors of node \(i\). represents the feature representation of the high - order neighbors of node \(i\), \(N\) i represents the set of negative sample nodes of node \(i\), \(U\) represents the set of users, and \(I\) represents the set of items. and respectively represent two different contrastive losses in the intermediate process, \(L\) gcl represents the final contrastive loss, and \(\log\) represents the logarithmic function with base \(e\) (the natural constant);
[0058] Then use the gradient descent method to optimize and train the above - mentioned model parameters and the feature representations of nodes. After the loss converges, obtain the pre - trained feature representations of all nodes, denoted as the sixth feature representation.
[0059] 3. Train the recommendation model based on the feature representations of users and items obtained by graph contrastive learning and the interaction records of users
[0060] Now, each node on the graph has the sixth feature representation that can reflect the structural characteristics of the graph data itself. However, the sixth feature representation is not explicitly optimized under the guidance of user interaction records. Next, use the interaction records to optimize the recommendation model. The recommendation model includes three parts: obtaining feature representations according to the input, aggregating neighbor nodes, and calculating preference scores. The specific optimization process is as follows:
[0061] (1) Use the pre - trained feature representations to initialize the feature representations of all users and items in the recommendation model;
[0062] (2) For each user and item node, use a graph neural network recommendation model to aggregate neighbor nodes and obtain more robust feature representations of users and items, denoted as the seventh feature representation. Here, the graph neural network recommendation model can select graph neural network models such as GCN, GraphSAGE, and GAT. The aggregation operation can be performed multiple times, so as to fuse the influence of higher-order neighbors. For example, aggregating once can be regarded as aggregating the influence of first-order neighbor nodes, and aggregating twice can be regarded as aggregating the influence of first-order and second-order neighbor nodes. However, generally, it is not recommended to exceed two aggregations. If the number of aggregations is too large, too much noise will be introduced into the feature representation of the current node, which will have a negative impact on the feature representation of the current node;
[0063] (3) After obtaining the seventh feature representations of all users and items, the preference score of a certain user for a certain item can be obtained by calculating the vector inner product of the feature representations. After obtaining the preference score, training can be carried out according to the preference score, continuously updating the feature representations of users and items, so that the preference score of the user for the interacted items finally approaches 1, and the preference score for the non-interacted items approaches 0. However, this training method requires calculating the preference scores of each user for all items, and the computational complexity is too high. And in the actual scenario, generally a batch of items is recommended to the user, and its scale is much smaller than the scale of all items. Therefore, in fact, only the relative ranking between items needs to be concerned. The items ranked higher are the items to be recommended, and the true preference scores of the items are actually not important. Therefore, a better approach here is to sample positive and negative examples for each user, and then use a pairwise type of loss function for training, so that the preference score of the user for the positive example is greater than that for the negative example. Specifically as follows:
[0064] Construct positive and negative example samples according to the user interaction records. The positive example is the item interacted by the user, and the negative example is the item not interacted by the user. Calculate the inner product of the user and the positive and negative example items as the preference scores of the user for them, and then construct a Bayesian Personalized Ranking (hereinafter referred to as BPR) loss function. The calculation method is as follows:
[0065]
[0066] where σ is the Sigmoid function, represents the predicted preference score of user u for item i, γ||θ|| is the regularization term, u represents the current user, i represents the positive example item, j represents the negative example item, D represents the positive and negative example training set, and L rec represents the BPR loss;
[0067] Optimize the entire recommendation model using the gradient descent method. After the loss converges, the preference scores calculated by the recommendation model for positive example items by users should generally be higher than those for negative example items.
[0068] 4. For users who need to recommend items, use the trained recommendation model to output a list of items recommended for them.
[0069] Since each user has interaction records, these items can be directly deleted from the set of all items as the set of items that the user has not interacted with. If a user has never interacted with any item, then all items are items that the user has not interacted with.
[0070] Input the user and the un-interacted items into the recommendation model to obtain their final feature representations, and use the inner product to calculate the vector similarity between them as the user's preference score for these items. The calculation method is as follows:
[0071] V u = GNN(u)
[0072] V i = GNN(i)
[0073]
[0074] Among them, u represents the id of user u, i represents the id of item i, V u represents the feature representation obtained by inputting user u into the recommendation model, V i represents the feature representation obtained by inputting item i into the recommendation model, and GNN represents the graph neural network recommendation model. is the predicted preference score of user u for item i;
[0075] Sort all the preference scores, and select the items with the top rankings as the items that the user may be interested in and recommend them to the user.
[0076] The specific implementation manner of the present invention also provides a recommendation system based on graph contrast learning and social network enhancement, as Figure 2 shown, including:
[0077] 1. A data processing module that preprocesses the original user historical behavior and social data, extracts the user interaction record data, constructs a social network and an interaction bipartite graph, and stores these two graphs in the form of an adjacency matrix;
[0078] 2. Graph contrastive learning module: According to the constructed social network and interaction bipartite graph, different types of meta-paths are generated and stored in the form of an adjacency matrix. Then, the first-order neighbors and high-order neighbors of each node are obtained. After that, a graph neural network is used to obtain the feature representations of the first-order neighbors and high-order neighbors, and graph contrastive learning is used to train the feature representations of all nodes to obtain pre-trained node feature representations;
[0079] 3. Use a graph neural network as a recommendation model and initialize the model with the pre-trained feature representations. Then, perform supervised learning on the recommendation model according to the generated user interaction records to obtain a trained recommendation model;
[0080] 4. Recommendation module: Whenever the recommendation system receives the requested user ID, it can call the recommendation model to obtain the feature representations of the user and un-interacted items, calculate the vector similarity between the user and un-interacted items, use this as the user's preference score, and generate a recommendation list by taking the top-ranked items and return it to the user.
[0081] The present invention is different from the existing recommendation models using graph neural networks. Aiming at the cold start problem of the recommendation system, a social network is first introduced to supplement the deficiency of sparse historical behavior data of users in the recommendation scenario. For cold start users, their behavior preferences can be obtained from the perspective of their friends rather than from the perspective of interaction records. Then, the graph data itself is used to construct supervision signals, and a pre-training process of the feature representations of users and items is carried out through graph contrastive learning. This can make more full use of the original data, enhance the training effect, and obtain more robust node feature representations. After that, the recommendation model is optimized based on the pre-trained feature representations and interaction records, which can better obtain the behavior preferences of users and make the recommendation model produce better recommendation effects in cold start or data sparse scenarios.
[0082] For the above advantages, GCN and NGCF are used as graph neural network recommendation models for comparison with the present invention, and detailed experiments are carried out on the real dataset Epinions to prove. The results are shown in Table 1. The Epinions dataset is a real dataset constructed by collecting user data on the Epinions.com website, which includes the historical behavior data and social data of users. Since both the historical behavior data and social data in this dataset are very sparse, Epinions is a sparse recommendation dataset, and using Epinions can fully verify the above advantages of the present invention.
[0083] Table 1: The improvement effect of graph contrastive learning on the recommendation model in the present invention
[0084]
Claims
1. A recommendation method based on graph contrast learning and social network enhancement, characterized in that, it includes the following steps: (1.1) For the currently given user historical behavior data and social data, extract the interaction records of users with items from the historical behavior data to form an interaction bipartite graph, the adjacency matrix of the interaction bipartite graph is represented by R, obtain the friend relationship from the social data to form a social network, and the adjacency matrix of the social network is represented by S; (1.2) Based on the adjacency matrix obtained in the step (1.1), first generate the adjacency matrices of different types of meta-paths to obtain the high-order neighbors of the nodes, and then use graph neural networks to calculate the third feature representation of the first-order neighbors of each node and the fifth feature representation of the high-order neighbors respectively. Use the contrast loss function, the third feature representation, the fifth feature representation and the gradient descent method to make the contrast loss function converge, and obtain the sixth feature representation of the converged nodes; (1.3) Based on the feature representation obtained in the step (1.2), use graph neural networks to calculate the feature representations of users and items for calculating preference scores, and then according to the interaction records obtained in the step (1.1), use the Bayesian personalized ranking loss function to continuously update and optimize the graph neural network recommendation model; (1.4) Based on the graph neural network recommendation model obtained in the step (1.3), obtain the feature representations of all users and items, and then for each user, calculate the vector similarity between the user and the items not recommended to the user, and select the items with the top-ranked vector similarity to recommend to the user; The step (1.2) includes the following steps: (2.1) First, define four types of meta-paths and the calculation methods of their adjacency matrices: user-item-user is RR T , user-user-item is SR, item-user-item is RR T R, user-user-user is SS; for each type of meta-path, use the adjacency matrix R of the interaction bipartite graph and the adjacency matrix S of the social network to perform the corresponding matrix multiplication to obtain the adjacency matrix corresponding to the meta-path; (2.2) Use the graph attention network to aggregate the first-order user neighbors and first-order item neighbors of each node to obtain the first feature representation of the first-order user neighbors and the second feature representation of the first-order item neighbors, and then use the first attention mechanism at the type level to aggregate the first feature representation and the second feature representation to obtain the third feature representation of the first-order neighbors of the node; Then use the graph convolutional network to aggregate each meta-path associated with the node to obtain the fourth feature representation of each meta-path, and then use the second attention mechanism at the meta-path level to aggregate different meta-paths to obtain the fifth feature representation of the high-order neighbors of the node; (2.3) According to the third feature representation and the fifth feature representation generated in the step (2.2), use the third feature representation and the fifth feature representation of the same node as positive examples, and use the third feature representation and the fifth feature representation of different nodes as negative examples to generate positive and negative example pairs, and then use the contrast loss function and the gradient descent method for training, and continuously update all feature representations. After the contrast loss function converges, obtain the feature representations of all nodes; The step (1.3) includes the following steps: (3.1) Use the sixth feature representation obtained in the step (1.2) as the initial feature representation of all nodes, and then use graph neural networks to perform the aggregation operation of neighbor nodes for each node as the seventh feature representation of each node; (3.2)Construct positive and negative example pairs for training the recommendation model based on the interaction records obtained in step (1.1), and use the Bayesian personalized ranking loss function and the gradient descent method to update the feature representations of each user node and item node and the parameters of the graph neural network recommendation model. After the loss converges, obtain the final feature representations of users and items.
2. A recommendation system based on graph contrast learning and social network enhancement, characterized in that, it includes the following modules: (4.1) A data processing module for preprocessing the historical behavior data and social data of users to form an interaction bipartite graph and a social network, and storing them in the form of an adjacency matrix; (4.2) A graph contrast learning module that obtains the first-order neighbors and high-order neighbors of all nodes according to the interaction bipartite graph and the social network, obtains the feature representations of the first-order neighbors and high-order neighbors using a graph neural network, and then obtains the feature representations of all nodes through graph contrast learning training; (4.3) A recommendation module that performs supervised learning based on the historical interaction records of users and the pre-trained node representations to obtain a trained recommendation model, and for the input user, can return a list of items recommended for him; In the figure contrastive learning module, four meta-paths and their adjacency matrix calculation methods are first defined: user-item-user is RR T , user-user-item is SR, item-user-item is RR T R, user-user-user is SS; for each type of meta-path, the adjacency matrix R of the interaction bipartite graph and the adjacency matrix S of the social network are used for corresponding matrix multiplication to obtain the adjacency matrix corresponding to the meta-path; Use a graph attention network to aggregate the first-order user neighbors and first-order item neighbors of each node to obtain the first feature representation of the first-order user neighbors and the second feature representation of the first-order item neighbors, and then use a type-level first attention mechanism to aggregate the first feature representation and the second feature representation to obtain the third feature representation of the first-order neighbors of this node; then use a graph convolutional network to aggregate each meta-path associated with this node to obtain the fourth feature representation of each meta-path, and then use a meta-path-level second attention mechanism to aggregate different meta-paths to obtain the fifth feature representation of the high-order neighbors of this node; According to the third feature representation and the fifth feature representation, use the third feature representation and the fifth feature representation of the same node as positive examples, and use the third feature representation and the fifth feature representation of different nodes as negative examples to generate positive and negative example pairs, and then use the contrast loss function and the gradient descent method for training, and continuously update all feature representations. After the contrast loss function converges, obtain the feature representations of all nodes.
Citation Information
Patent Citations
Multi-relation collaborative filtering algorithm based on graph neural network
CN111523047A
Recommendation method and system based on hybrid graph structured modeling
CN111881350A