A social recommendation method based on a knowledge graph attention network
By processing user social networks and project knowledge graphs separately, and using graph convolutional networks and attention mechanisms to propagate and aggregate users and projects, this approach solves the technical problems in existing user social recommendation systems and achieves better personalized recommendation results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-07
- Publication Date
- 2026-03-27
AI Technical Summary
Existing recommendation systems tend to repeatedly recommend fixed content when recommending items that users are interested in, ignore the social relationships between users, and lack an effective user-item data transmission channel, resulting in inaccurate information fusion and increased noise.
The user's social network and project knowledge graph are processed separately. A social recommendation graph and a project knowledge graph are constructed. The TransD model is used for knowledge embedding. User and project feature vectors are aggregated through graph convolutional networks and attention mechanisms. Multi-layer feature vectors are fused to calculate the user's score for the project.
It improves the personalized recommendation effect of the recommendation system, and enhances the accuracy and efficiency of the user recommendation system through the spread of social networks. It outperforms traditional models on multiple datasets, especially the Last.FM-2K, Yelp2018, CiaoDVD, and Delicious-2K datasets.
Smart Images

Figure CN115374347B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer technology, specifically, it relates to a social recommendation method based on knowledge graph attention networks. Background Technology
[0002] Recommender systems, a popular technology in the field of big data, effectively address the information overload problem of today's internet age, providing users with more suitable and high-quality content. In recent years, recommender systems have played a vital role in e-commerce, film and music, news, and social media platforms, satisfying users' personalized needs. Traditional recommendation methods mostly utilize collaborative filtering, which achieves recommendation effects by modeling users and items, but suffers from data sparsity and cold-start problems. To address these issues, many methods currently utilize knowledge graphs and graph neural networks to build recommendation models, achieving considerable results and demonstrating good interpretability. However, some shortcomings remain. In practical recommendation scenarios, once a recommender system identifies a user's partial interests, it may repeatedly recommend the same items that interest the user, making it difficult to discover new content for them. In real life, users seek advice from social relationships when making decisions. Most models ignore the similarity between users and do not take into account the social information between users. At the same time, many models model users, projects, and project attributes together, lacking clear data transmission channels. There are incompatible relationships between users and projects, and between projects and project attributes. This can lead to entities enriching their own expression while incorporating inaccurate information, thus increasing the noise of the model. Summary of the Invention
[0003] The purpose of this invention is to solve the problems existing in the prior art and to propose a social recommendation method based on knowledge graph attention networks.
[0004] The method of this invention separates the user's social network and the project knowledge graph to avoid the impact of different relationships on the modeling. It combines the social network and the user-project bipartite graph, enabling users to capture the interaction records of similar users and projects, and recommending projects that users may be interested in but lack connection with, thereby achieving personalized project recommendations for users.
[0005] To achieve the above objectives, the present invention employs the following technical solution.
[0006] A social recommendation method based on knowledge graph attention networks includes the following steps:
[0007] S1 constructs a social recommendation graph by using user social information and user-project interaction records, with users and project entities as nodes and relationships between entities as lines; and constructs a project knowledge graph by using project triple data, with project entities as nodes and relationships between projects as lines.
[0008] S2 uses the TransD model to embed knowledge from the social recommendation graph and the project knowledge graph, obtaining vector representations of entities in the two graphs;
[0009] S3 uses a graph convolutional network model to aggregate neighborhood messages by representing the vectors of entities in the social recommendation graph. The weights of the network propagation path are calculated through an attention mechanism. The user-item bipartite graph in the social recommendation graph is first convolved to aggregate the vectors of user entities and item entities, thus obtaining user feature vectors containing neighborhood item information. Then, the user feature vectors are convolved multiple times through the social network to output feature vectors of multi-layer users.
[0010] S4 represents the project vector in the project knowledge graph, performs multiple propagation and aggregation, calculates the user's attention parameter for the relationship between projects as the propagation weight, and outputs the feature vector of multi-layer projects.
[0011] S5 merges the multi-layer user feature vectors and multi-layer item feature vectors obtained in S3 and S4 to enhance the expression effect of the neighborhood in the user and item feature vectors, and obtains the final feature vectors of users and items.
[0012] S6 calculates the user's score for a project using dot product based on the final feature vectors of the user and the project. It then optimizes the training parameters using a loss function, performs multiple training iterations, and finally sorts the projects based on the scores to output the projects that the user is interested in.
[0013] Further preferably, the content and method steps of knowledge embedding using the TransD model in S2 include:
[0014] Knowledge graph embedding technology can vectorize entities and their relationships while preserving the graph structure, making it easier for models to utilize knowledge data in the knowledge graph. The method involves learning the representation of each entity and relationship using vectors h + r ≈ t. The embedding formula is as follows:
[0015]
[0016] Where (h, r, t) represents (head entity, relation, tail entity), g(h, r, t) represents the embedding vector, and e h e hp e r e rp e t etp These represent vectors representing triples (head entity, relation, tail entity), with the subscript p indicating the projection vector of that vector. m×n Let be an m×n identity matrix. The square of the second normal form, in the formula and These represent the mapping matrices for vectors h and t, respectively, and are responsible for mapping entities from the entity space to the relation space;
[0017] The formula for the loss function in the embedding process is:
[0018]
[0019] in Let G represent the loss value, G represent the knowledge graph, (h, r, t) ∈ G represent the positive sampling triple, and (h′, r, t′) ∈ G′ represent the negative sampling triple, which is obtained by replacing entities in G. g(h, r, t) represents the embedding vector of the positive sampling, g(h′, r, t′) represents the embedding vector of the negative sampling, max() represents the maximum value function, and γ is the boundary value to control the degree of training. The larger the value, the more difficult the training.
[0020] Further preferably, the content and method steps of S3, which utilize a graph convolutional network model to achieve the propagation and aggregation of neighborhood messages, include:
[0021] By aggregating neighborhood messages, higher-order connectivity of the model is achieved. From the perspective of graph convolutional networks, the aggregation process between each layer is uniformly represented by the following formula:
[0022]
[0023] Where l is the number of layers, e (l+1) and e (l) These are the feature vectors of layer l+1 and layer l, respectively. This represents an adjacency matrix that includes self-connected entity nodes. Represented as The degree matrix, w (l) is the weight, and ReLU() is the activation function for each layer.
[0024] Further preferably, the steps and methods for calculating the weights of the network propagation path using the attention mechanism in step S3 include:
[0025] An attention mechanism is employed to assign weights to the propagation paths in the method. The score between the user and the relationship is obtained by taking the inner product of vectors. The calculation formula is as follows:
[0026]
[0027] Where r h,t This represents the relationship between the head entity h and the tail entity t, e u Let e be a user vector. r For relation vectors, Representing relation r h,t Importance score for user u;
[0028] The scores are standardized to obtain the model's attention weights, calculated using the following formula:
[0029]
[0030] in R represents the standardized attention weights. h,t This represents the relationship between the head entity h and the tail entity t, and exp() represents exponential operation with base e. This represents the set of all tail entities t in the knowledge graph that are directly connected to the head entity h.
[0031] Further preferably, the steps in S3 of performing a convolution on the user-item bipartite graph in the social recommendation graph to aggregate the vector representations of user entities and item entities to obtain user feature vectors containing neighborhood item information include:
[0032] All information about items that have interacted with the user is propagated and aggregated through a convolutional network. After one convolution, the model obtains a vector representation that aggregates the information of neighboring items.
[0033]
[0034] in For neighborhood feature vectors, Let e be the connection weight between user u and project i, representing the degree of importance user u places on the transaction type. i For project vectors, Let i represent the set of all projects i that are directly connected to user u in the user-project bipartite graph;
[0035] After calculating the neighborhood representation, the neighborhood vector needs to be merged with its own vector. The following is the formula for merging user vectors:
[0036]
[0037] in Let W be the first-layer user feature vector, W be the transformation weight, b be the bias term, and e be the bias term. u For user vectors, Let be the neighborhood feature vector, and σ() represent the nonlinear activation function of this layer.
[0038] Further preferably, the steps in S3 involving multiple convolutions of the user feature vectors via a social network include:
[0039] By disseminating user information with project semantics through social networks, the goal of social recommendation is achieved. After dissemination, the model will obtain a vector representation that aggregates neighborhood user information.
[0040]
[0041] in This represents the neighborhood feature vector of user u. The feature vector representing neighbor user u′, This represents the set of all other users u′ that are directly connected to user u in the social recommendation graph. The connection weights between users represent the degree of importance that user u places on the social relationship with user u′, and l represents the number of iteration layers in the convolutional network.
[0042] After calculating the user's neighborhood representation, the neighborhood vector needs to be merged with its own vector. The following is the formula for merging user vectors:
[0043]
[0044] in This represents the user feature representation of the l-th layer, where W is the transformation weight and b is the bias term. For the user's own vector, This represents the neighborhood feature vector of user u. Let σ represent the set of all other users u′ directly connected to user u in the social recommendation graph, and let σ() represent the non-linear activation function of this layer.
[0045] Further preferably, the steps in S4 of propagating and aggregating the project vector representation in the project knowledge graph multiple times include:
[0046] A project knowledge graph is a knowledge graph that connects project entities and attribute entities through relationships. The aggregation formula for the neighborhood of the head entity is:
[0047]
[0048] in This represents the neighborhood feature representation of the head entity. This represents the set of all tail entities t in the project knowledge graph that are directly connected to the head entity h. These are the standardized attention weights, representing the relationship r between user u and the head and tail entities. h,t The level of attention, e t The tail entity vector;
[0049] After calculating the neighborhood representation of an item, the neighborhood vector needs to be merged with its own vector. The following is the formula for merging item vectors:
[0050]
[0051] in This represents the feature representation of the item in layer l, where W is the transformation weight and b is the bias term. For the project itself, Let denot be the feature vector of all neighboring tail entities t connected to the head entity h, and σ() represent the nonlinear activation function of this layer.
[0052] Further preferably, the steps and methods for fusing multi-layer user feature vectors and multi-layer project feature vectors in S5 include:
[0053] The multi-layer vectors generated by convolution are merged using vector addition. The formula for merging user vectors is as follows:
[0054]
[0055] Where e u The final user feature vector after merging, where l is the current layer number and L represents the maximum layer number, i.e., the number of iterations for this layer. The user feature vector of layer l;
[0056] Formula for merging project vectors:
[0057]
[0058] Where e i This represents the final feature vector of the merged project, where l is the current layer number and L represents the maximum layer number, i.e., the number of iterations for this layer. This represents the feature vector of the project at layer l.
[0059] Further preferably, the steps in S6 for calculating the user's score for the item and optimizing the training parameters using a loss function include:
[0060] Calculate the user-project interaction probability score using the following formula:
[0061]
[0062] in The function f() represents the user's predicted score for the project. In this method, e is the inner product function. u Let e be a user vector. i For project vectors;
[0063] The overall loss function of this method is:
[0064]
[0065] in Let Γ() represent the loss value, Γ() be the cross-entropy loss function, U represent the user set, u represent the user, i represent the item, P represent the positive sampling set, and λ represent the regularization weight coefficient in the formula. y represents the user's predicted score for the project. ui This represents the user's true score for the project. For the calculation function, Represents the square of the second normal form.
[0066] By adopting the above solution, the beneficial effects achieved by the present invention are as follows:
[0067] (1) This invention proposes to combine user social networks and user-item bipartite graphs to construct a social recommendation graph. By using social relationships to spread user-item interaction information, users can obtain interaction records of other similar users, so as to recommend items that users are interested in but lack interaction records. Through the above method, the recommendation effect is better than the comparative models such as SVD on four datasets: Last.FM-2K, Yelp2018, CiaoDVD, and Delicious-2K.
[0068] (2) This invention proposes to process the social recommendation graph and the project knowledge graph separately, construct two data processing channels, and output user features and project feature vectors respectively, thus solving the problem of noise generation in the model.
[0069] (3) This invention proposes to use an attention mechanism to calculate weights in social network propagation, which enhances the recommendation effect of the model and makes the recommended content for users more personalized. It shows an average score of 0.88 and 0.856 in AUC and F1-Score, respectively, which is 3.17% to 31.44% higher than the baseline method. Attached Figure Description
[0070] Figure 1 This is a flowchart illustrating a social recommendation method based on a knowledge graph attention network according to the present invention.
[0071] Figure 2 Recommend knowledge graphs for social networking.
[0072] Figure 3 This is a structural diagram of the knowledge graph attention network framework SKGAN proposed in this invention.
[0073] Figure 4 This is a comparison chart of the evaluation index curves of the SKGAN model of this invention and the baseline model. Detailed Implementation
[0074] To make the technical solutions and advantages of the present invention clearer, the specific technical solutions of the present invention will be described in detail below with reference to the accompanying drawings and embodiments. The present invention is not limited to the scope of the specific embodiments.
[0075] This invention provides a social recommendation method based on a knowledge graph attention network, such as... Figure 1 The diagram shows the basic flow of the method described in this invention.
[0076] S1, using user social information and user-project interaction records, constructs a social recommendation graph with users and project entities as nodes and relationships between entities as lines. The user-project interaction matrix Y, the social network, and the project knowledge graph are used as initial inputs. After processing the initial data, two graphs are obtained: first, the social recommendation graph G1 obtained by fusing the user-project interaction matrix Y and the social network, as shown below. Figure 2 As shown, we align the two using user u, which we name the Knowledge Graph of Social Recommendation (KGSR). This graph stores the user's social relationships (e.g., friends, family) and user interaction data with items (e.g., clicks, favorites, purchases, etc.). Here, G1 is defined as... When there is a relationship between users y is 1 if the user interacts with the project, and 0 otherwise. ui A value of 1 indicates the entity is connected to another entity, otherwise a value of 0. In the diagram, this represents whether there is a relationship between entities.
[0077] Using project triples, a project knowledge graph is constructed with project entities as nodes and relationships between projects as lines. This graph, G2, represents the knowledge graph of projects and their attributes. Here, it is named the Item Knowledge Graph (IKG). G2 is defined as follows: Each triple describes the fact that the head entity is linked to the tail entity through a relation.
[0078] S2 uses the TransD model to embed knowledge from the social recommendation graph and the project knowledge graph, obtaining vector representations of entities in the two graphs. Knowledge graph embedding technology can preserve the graph structure while vectorizing entities and their relationships, making it easier for the model to utilize knowledge data in the knowledge graph.
[0079] This part corresponds to the knowledge graph embedding layer in the SKGAN model, a knowledge graph attention network framework. Figure 3The knowledge graph embedding layer is responsible for embedding the structured information of the knowledge graph. This is done by learning the representation of each entity and relation using vectors h + r ≈ t. The embedding formula is:
[0080]
[0081] Where (h, r, t) represents (head entity, relation, tail entity), g(h, r, t) represents the embedding vector, and e h e hp e r e rp e t e tp Let represent the vectors of the triples (head entity, relation, tail entity), where the subscript p indicates the projection vector of that vector, and Im×n is an m×n identity matrix. The square of the second normal form, in the formula and These represent the mapping matrices for vectors h and t, respectively, and are responsible for mapping entities from the entity space to the relation space;
[0082] The formula for the loss function in the embedding process is:
[0083]
[0084] in Let G represent the knowledge graph, (h, r, t) ∈ G represent positive sampling triples, and (h′, r, t′) ∈ G′ represent negative sampling triples, which are obtained by replacing entities in G. Let g(h, r, t) represent the embedding vector of positive sampling and g(h′, r, t′) represent the embedding vector of negative sampling. max() represents the maximum value function, and γ is the boundary value to control the degree of training. The larger the value, the more difficult the training.
[0085] S3 uses a graph convolutional network model to aggregate neighborhood messages by representing the vectors of entities in the social recommendation graph, thereby leveraging the model's higher-order connectivity. From the perspective of the graph convolutional network, the aggregation process between each layer is uniformly represented by the following formula:
[0086]
[0087] Where l is the number of layers, e (l+1) and e (l) These are the feature vectors of layer l+1 and layer l, respectively. This represents an adjacency matrix that includes self-connected entity nodes. Represented as The degree matrix, w (l) The weights are ReLU(), and the activation function for each layer is ReLU().
[0088] An attention mechanism is employed to assign weights to the propagation paths in the method. The score between the user and the relationship is obtained by taking the inner product of vectors. The calculation formula is as follows:
[0089]
[0090] Where r h,t This represents the relationship between the head entity h and the tail entity t, e u Let e be a user vector. r For relation vectors, This represents the importance score of relation r to user u;
[0091] The scores are standardized to obtain the model's attention weights, calculated using the following formula:
[0092]
[0093] in R represents the standardized attention weights. h,t This represents the relationship between the head entity h and the tail entity t, and exp() represents exponential operation with base e. This represents the set of all tail entities t in the knowledge graph that are directly connected to the head entity h;
[0094] After obtaining the attention weights, the user-item bipartite graph in the social recommendation graph is first convolved to aggregate the vector representations of user entities with the vector representations of item entities, thus obtaining a user feature vector containing neighborhood item information. Figure 3 The upper left part of the convolutional layer in the middle image is shown;
[0095] Formula for aggregating the neighborhood item vectors connected to the user:
[0096]
[0097] in For neighborhood feature vectors, Let e be the connection weight between user u and project i, representing the degree of importance user u places on the transaction type. i For project vectors, Let i represent the set of all projects i that are directly connected to user u in the user-project bipartite graph;
[0098] After calculating the neighborhood representation, the neighborhood vector needs to be merged with its own vector. The following is the formula for merging user vectors:
[0099]
[0100] in Let W be the first-layer user feature vector, W be the transformation weight, b be the bias term, and e be the bias term. u For user vectors, Let σ be the neighborhood feature vector, and let σ() represent the nonlinear activation function of this layer;
[0101] Then, the user feature vectors are convolved multiple times through the social network to output multi-layered user feature vectors. This multi-layered vector is then propagated through the social network to disseminate user information already possessing item semantics, thereby achieving the goal of social recommendation. After propagation, the model will obtain a vector representation that aggregates information from neighboring users, i.e. Figure 3 The upper right part of the convolutional layer in the middle image is shown;
[0102] Formula for aggregating other neighboring users connected to a user:
[0103]
[0104] in This represents the neighborhood feature vector of user u. The feature vector representing neighbor user u′, This represents the set of all other users u′ that are directly connected to user u in the social recommendation graph. The connection weights between users represent the degree of importance that user u places on the social relationship with user u′, and l represents the number of iteration layers in the convolutional network.
[0105] After calculating the user's neighborhood representation, the neighborhood vector needs to be merged with its own vector. The following is the formula for merging user vectors:
[0106]
[0107] in This represents the user feature representation of the l-th layer, where W is the transformation weight and b is the bias term. For the user's own vector, This represents the neighborhood feature vector of user u. Let σ represent the set of all other users u′ directly connected to user u in the social recommendation graph, and let σ() represent the non-linear activation function of this layer.
[0108] S4 represents the project vectors in the project knowledge graph, performs multiple propagation and aggregation, calculates the user's attention parameters for the relationships between projects as propagation weights, and outputs feature vectors for multi-layered projects. The project knowledge graph is a knowledge graph that connects project entities and attribute entities through relationships. The process of aggregating the project knowledge graph is as follows: Figure 3 The lower half of the convolutional layer in the middle image is shown.
[0109] The neighborhood aggregation formula for the head entity is:
[0110]
[0111] in This represents the neighborhood feature representation of the head entity. This represents the set of all tail entities t in the project knowledge graph that are directly connected to the head entity h. These are the standardized attention weights, representing the relationship r between user u and the head and tail entities. h,t The level of attention, e t The tail entity vector;
[0112] After calculating the neighborhood representation of an item, the neighborhood vector needs to be merged with its own vector. The following is the formula for merging item vectors:
[0113]
[0114] in This represents the feature representation of the item in layer l, where W is the transformation weight and b is the bias term. For the project itself, Let denot be the feature vector of all neighboring tail entities t connected to the head entity h, and σ() represent the nonlinear activation function of this layer.
[0115] S5 fuses the multi-layer user feature vectors and multi-layer item feature vectors obtained in S3 and S4 to enhance the representation effect of the neighborhood in the user and item feature vectors, obtaining the final user and item feature vectors. The multi-layer vectors generated by convolution are then merged using vector addition, as follows: Figure 3 As shown in the middle vector merging layer, it is responsible for outputting the final feature vectors of users and items;
[0116] The formula for merging user vectors:
[0117]
[0118] Where e u The final user feature vector after merging, where l is the current layer number and L represents the maximum layer number, i.e., the number of iterations for this layer. The user feature vector of layer l;
[0119] Formula for merging project vectors:
[0120]
[0121] Where e i This represents the final feature vector of the merged project, where l is the current layer number and L represents the maximum layer number, i.e., the number of iterations for this layer. This represents the feature vector of the project at layer l.
[0122] S6: Based on the final feature vectors of users and projects, calculate the user's score for the project using the dot product method, optimize the training parameters using the loss function, perform multiple training sessions, and finally sort the projects according to the scores to output the projects that the user is interested in.
[0123] The goal of this invention is to learn and train a prediction function. Right now Figure 3 The prediction layer in the middle calculates user vectors and item vectors to obtain predicted values that reflect the user's level of interest in the items, where y ui This represents the user's true score for the project, and Θ represents the function. The model parameters are used to calculate the user-project interaction probability score using the following formula:
[0124] in The function f() represents the user's predicted score for the project. In this method, e is the inner product function. u Let e be a user vector. i For project vectors;
[0125] The overall loss function of this method is:
[0126]
[0127] in Let Γ() represent the loss value, Γ() be the cross-entropy loss function, U represent the user set, u represent the user, i represent the item, P represent the positive sampling set, and θ represent the regularization weight coefficient in the formula. y represents the user's predicted score for the project. ui This represents the user's true score for the project. For the calculation function, Represents the square of the second normal form.
[0128] Experimental dataset:
[0129] The four datasets used in the experiments of this invention are all publicly available datasets containing social relationships and widely used in recommendation scenarios. Their details are shown in Table 1. Last.FM-2K is a dataset from the Last.fm music platform, including listening information from nearly 2,000 users and over 10,000 pairs of mutual friend relationships. Yelp is a business review website; the Yelp2018 dataset comes from the website's challenge and includes over 40,000 user ratings and reviews of businesses, along with social information between users and a rich project knowledge graph. The CiaoDVD dataset comes from the dvd.ciao.co.uk website, providing a large number of movie ratings and information, and allowing users to add trusted users to build social networks. The Delicious-2K dataset comes from the Delicious website and is a bookmarking system dataset containing social networks, bookmarks, and tagging information.
[0130] Table 1 Experimental Dataset Information
[0131] Last.FM-2K Yelp 2018 CiaoDVD Delicious-2K Number of users 1872 45919 30444 1867 Number of projects 3846 45538 16121 104799 Number of interactions 42346 1185068 1625480 437593 Entity Number 9366 90961 46565 160054 Types of Relationships 60 42 23 9 Triplet number 15518 1853704 1738278 452924
[0132] Model parameter settings:
[0133] For σ in the SKGAN model, we use tanh as the activation function for the last aggregation layer of the convolutional network, and ReLU as the activation function for the rest of the model. We set the maximum number of layers and dimension in the hyperparameters to L=2 and d=5, respectively. Since the number of entities in the four datasets varies, to avoid overfitting and achieve better training results, we set the learning rate η, regularization coefficient λ, and training batch size to {5×10^6} when training on the two smaller datasets, Last.FM-2K and Delicious-2K. -4 10 -4 For the Yelp2018 and CiaoDVD datasets, which have large amounts of data, the parameters are set to {10}. -2 10 -6 The dataset was used in a 7:2:1 ratio for training, testing, and evaluation, respectively. The entire training process was repeated 5 times, and the average of the output results was taken as the final result.
[0134] To verify the effectiveness of the SKGAN model, we will compare it with the following models:
[0135] SVD is a classic collaborative filtering model that trains user and item features to model based on the interaction probability obtained by multiplying the feature vectors of users and items.
[0136] CKE is a classic recommendation model that is based on collaborative filtering and integrates auxiliary information such as knowledge graphs to enhance recommendation performance.
[0137] The KGCN model introduces graph convolutional networks into the recommender system domain. It uses convolutional methods to aggregate the neighborhoods of entities in the knowledge graph, deeply mining item information and enhancing the feature representation of entities, thereby enriching the item vectors. While aggregating item vectors, it leverages an attention mechanism to learn user interests and strengthens the weights. Finally, it uses the obtained item vectors and user vectors to perform calculations and output the interaction probability.
[0138] The KGAT model further utilizes the attention mechanism and combines the user-item bipartite graph with the knowledge graph to construct a collaborative knowledge graph CKG, which can obtain higher-order association information to more deeply explore the higher-order features of users and items.
[0139] Analysis of experimental results:
[0140] This invention uses the area under the ROC curve (AUC) and the harmonic mean of precision and recall (F1-Score) as the evaluation index for the experiment. The experimental results are shown in Table 2, where the bolded index represents the optimal result.
[0141] Table 2 Experimental Results
[0142]
[0143] Through experiments, we can see that the SVD model performs worse than the other four models due to the lack of auxiliary information such as knowledge graphs. KGCN and KGAT make better use of the convolution effect of knowledge graphs. Based on information propagation, they better mine higher-order associations in knowledge graphs. At the same time, they use attention mechanisms to obtain users' preference scores for relations r in knowledge graphs, so as to better update the weights in graph convolution. Therefore, they outperform CKE in terms of results. The SKGAN of this invention incorporates social networks on the basis of the other four models, combines them with knowledge graphs and attention mechanisms, and explores users' potential interests by utilizing the propagation effect of users' social information in the network. Thus, it shows generally optimal results in AUC and F1 scores.
[0144] Figure 4 The middle section shows line graphs obtained through experiments for various models in Top-K recommendation scenarios, using Recall@K as the evaluation metric. From... Figure 4The comparison between (a) and (b) shows that in the larger Yelp 2018 dataset, the SKGAN model, utilizing high-quality social networks, demonstrates the best performance and better leverages denser data. The graph convolutional network, after multiple training iterations, better extracts user and item features from the knowledge graph. Due to the sparse nature of the Last.FM-2K dataset, social networks struggle to function effectively, resulting in similar performance for KGCN, KGAT, and SKGAN, with final recall rates close to CKE. However, all three ultimately outperform the SVD model, which only uses collaborative filtering. Figure 4 In (c), because the CiaoDVD dataset focuses on the quality of users' social information, the recall rate of the SKGAN model in this invention is slightly higher than that of other datasets. Figure 4 In (d), the performance of the various models did not differ significantly. Ultimately, the SKGAN model demonstrated good recommendation performance across various recommendation scenarios.
[0145] Model structure analysis:
[0146] This section will analyze the model and discuss the performance of the SKGAN model under different network structures, using the AUC value under different aggregation layers and sampling numbers as the evaluation standard;
[0147] First, the sampling number of SKGAN during aggregation was set to 4, and the number of aggregation layers in the graph convolutional network was adjusted to 1, 2, 3, and 4 respectively. The experimental results are shown in Table 3. It can be seen that with a sampling number of 4 and an aggregation layer count of 2, the model performs best overall on the four datasets. As the number of convolutional layers increases from 3 to 4, the model's performance rapidly declines. This result indicates that when the number of layers is 1, the model is insufficient to fully realize neighborhood aggregation and cannot effectively utilize auxiliary and social information. When the number of layers is large, the excessive propagation of messages in social networks and knowledge graphs leads to a rapid increase in the number of nodes in the relationship chain, resulting in a large amount of useless information mixed with user and item features, causing the model to lose its effectiveness.
[0148] Table 3. AUC values of SKGAN under different numbers of convolutional network layers.
[0149] L 1 2 3 4 Last.FM-2K 0.795 0.782 0.713 0.648 Yelp 2018 0.969 0.984 0.803 0.522 CiaoDVD 0.887 0.912 0.791 0.625 Delicious-2K 0.813 0.830 0.623 0.587
[0150] With a fixed number of convolutional layers (2), we set the sampling number to 2, 4, 8, 16, 32, and 64 respectively to compare and observe the changes in the model's AUC value. The experimental results are shown in Table 4. SKGAN performs better when the sampling number is 4 or 8. This result indicates that a small sampling number cannot fully utilize the role of neighboring nodes, while a large sampling number introduces redundant information into the model, generating noise and affecting model accuracy. Therefore, setting a smaller number of aggregation layers and a moderate sampling number for SKGAN can better enhance the model's recommendation performance.
[0151] Table 4. AUC values of SKGAN under different sampling conditions
[0152] K 2 4 8 16 32 64 Last.FM-2K 0.724 0.796 0.785 0.681 0.652 0.633 Yelp 2018 0.873 0.961 0.983 0.976 0.941 0.927 CiaoDVD 0.867 0.896 0.913 0.904 0.840 0.835 Delicious-2K 0.764 0.828 0.821 0.796 0.757 0.714
[0153] This invention proposes a recommendation model, SKGAN, based on a knowledge graph attention network. This model mines the relationships between social networks and user-item bipartite graphs to incorporate similar user features into user representations. It employs an attention mechanism to calculate the degree of user emphasis on propagation relationships and further enriches feature representations through multi-layer convolutional aggregation, resulting in personalized user features. Finally, it calculates user features and item features output from the item knowledge graph. This model separates users from the item knowledge graph during feature propagation, avoiding interference from item attributes and entities in user representations. It also utilizes similar users from social information to recommend potentially interesting items to users even without interaction relationships. Experiments show that this model has high accuracy, outperforming other models, and is suitable for recommendation scenarios with social information, such as e-commerce and music.
[0154] The above description outlines the basic principles and implementation schemes of this invention and is not intended to limit the invention. The experimental results demonstrate the advantages and effects of this invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this invention should be included within the scope of the claims.
Claims
1.A social recommendation method based on a knowledge graph attention network, characterized in that, The method comprises the following steps: S1, constructing a social recommendation graph by taking user and item entities as nodes and the relationship between entities as lines through user social information and user-item interaction records; constructing an item knowledge graph by taking item entities as nodes and the relationship between items as lines through item triple data; S2, performing knowledge embedding on the social recommendation graph and the item knowledge graph using a TransD model to obtain vector representations of entities in the two graphs; S3, using a graph convolution network model to realize the propagation and aggregation of neighborhood messages, calculating the weight of the network propagation path through an attention mechanism, and performing one convolution on the user-item bipartite graph in the social recommendation graph to aggregate the vector representations of item entities in the user entity vector representations, thereby obtaining a user feature vector containing neighborhood item information, and then performing multiple convolutions on the user feature vector through the social network to output multiple layers of user feature vectors; S4, performing multiple propagation and aggregation on the item vector representations in the item knowledge graph, calculating the attention parameters of the user-item relationship as the propagation weight, and outputting multiple layers of item feature vectors; S5, fusing the multiple layers of user feature vectors and multiple layers of item feature vectors obtained in S3 and S4 to strengthen the expression effect of the neighborhood in the user and item feature vectors, and obtaining the final feature vectors of the user and the item; S6, calculating the score of the user for the item by using the dot product method according to the final feature vectors of the user and the item, optimizing the training parameters by using the loss function, performing multiple training, and finally ranking according to the score to output the items of interest to the user. 2.The social recommendation method based on knowledge graph attention network according to claim 1, characterized in that, The content and method steps of knowledge embedding using the TransD model in S2 include: The knowledge graph embedding technology can preserve the graph structure while vectorizing the entities and their relationships, which facilitates the model to utilize the knowledge data in the knowledge graph. The method learns the expression of each entity and relationship through the vector h+r≈t, and the embedding formula is: where (h, r, t) denotes (head entity, relation, tail entity), g(h, r, t) denotes the embedding vector, e h , e hp , e r , e rp , e t , e tp denote the vector of the triple (head entity, relation, tail entity) respectively, subscript p denotes the projection vector of the vector, I m×n is an m x n identity matrix, denotes the square number of the second norm, in the formula, h and t denote the mapping matrix of vectors h and t respectively, responsible for mapping entities from entity space to relation space; The loss function formula in the embedding process is: wherein represents a loss value, G represents a knowledge graph, (h, r, t) e G represents a positive sampled triple, (h', r', t') e G' represents a negative sampled triple, which is obtained by replacing an entity in G, g(h, r, t) represents an embedding vector of the positive sampling, g(h', r', t') represents an embedding vector of the negative sampling, max() represents a maximum value function, and γ is a boundary value to control the degree of training, the greater the value of which, the more difficult the training. 3.The social recommendation method based on knowledge graph attention network according to claim 1, characterized in that, The content and method steps of realizing the propagation and aggregation of neighborhood messages using the graph convolution network model in S3 include: According to the neighborhood message aggregation, the high-order connectivity of the model is realized, and from the perspective of the graph convolution network, the aggregation process between each layer is uniformly represented by the following formula: where l is the number of layers, e (l+1) and e (l) are the feature vectors of l+1 and l layers, respectively, denotes the adjacency matrix including self-connections of entity nodes, denotes the degree matrix as , w (l) is the weight, and ReLU() is the activation function of each layer. 4.The social recommendation method based on knowledge graph attention network according to claim 1, characterized in that, The content and method steps of calculating the weight of the network propagation path using the attention mechanism in S3 include: The attention mechanism is used to set the weight of the propagation path in the method, and the dot product between vectors is used to obtain the score value between the user and the relationship, and the calculation formula is: where r h,t represents the relationship between the head entity h and the tail entity t, e u is the user vector, e r is the relationship vector, represents the relationship r h,t the importance score for the user u; The score value is standardized to obtain the attention weight of the model, and the formula is: wherein denotes the normalized attention weight, r h,t denotes the relation between the head entity h and the tail entity t, exp( ) denotes the exponential operation with base e, denotes the set of all tail entities t in the knowledge graph that are directly connected to the head entity h. 5.The social recommendation method based on knowledge graph attention network according to claim 1, characterized in that, The content and method steps of performing one convolution on the user-item bipartite graph in the social recommendation graph to aggregate the vector representations of item entities in the user entity vector representations to obtain a user feature vector containing neighborhood item information in S3 include: After one convolution, the model will obtain a vector representation of the aggregated neighborhood item information: wherein is a neighborhood feature vector, is a connection weight between user u and item i, indicating the attention of user u on the transaction type, e i is an item vector, denotes the set of all items i in the user-item bipartite graph that are directly connected to user u; After calculating the neighborhood expression, the neighborhood needs to be combined with the self vector, and the following is the user vector combination formula: where is the first layer user feature vector, W is the transformation weight, b is the bias term, e u is the user vector, is the neighborhood feature vector, σ() represents the non-linear activation function of this layer. 6.The social recommendation method based on knowledge graph attention network according to claim 1, characterized in that, The content and method steps of S3 include: The user information with project semantics is spread through the social network, so as to achieve the purpose of social recommendation. After spreading, the model will obtain the vector representation of the aggregated neighborhood user information: wherein denotes a neighborhood feature vector of a user u, denotes a feature vector of a neighbor user u', denotes a set of other users u' that are directly connected to the user u in the social recommendation graph, is a connection weight between the user and other users, which indicates the attention degree of the social relationship between the user u and u', and l denotes the number of iteration layers of the convolution network. After calculating the user neighborhood expression, the neighborhood needs to be combined with the self vector, and the following is the user vector combination formula: wherein represents the user feature representation of the lth layer, W is the transformation weight, and b is the bias term, is the user self vector, represents the neighborhood feature vector of user u, represents the set of other users u' that are directly connected to user u in the social recommendation graph, and σ() represents the non-linear activation function of the layer. 7.The social recommendation method based on knowledge graph attention network according to claim 1, characterized in that, The content and method steps of S4 include: The project knowledge graph is a knowledge graph formed by connecting project entities and attribute entities through relationships. The neighborhood of the head entity is aggregated by the following formula: wherein denotes the head entity neighborhood feature representation, denotes the set of tail entities t in the project knowledge graph that are directly connected to the head entity h, is the normalized attention weight, denoting the degree of attention of the user u to the relationship r between the head entity and the tail entity h,t e t is the tail entity vector; After calculating the project neighborhood expression, the neighborhood needs to be combined with the self vector, and the following is the project vector combination formula: wherein represents the item feature representation of the l-th layer, W is the transformation weight, and b is the bias term, is the item itself vector, represents the feature vector of all neighboring tail entities t connected to the head entity h, and σ() represents the non-linear activation function of the layer. 8.The social recommendation method based on knowledge graph attention network according to claim 1, characterized in that, The content and method steps of S5 include: The multi-layer user feature vectors and multi-layer project feature vectors are combined by adding vectors, and the user vector combination formula is: where e u is the merged final user feature vector, l is the current layer, L represents the maximum number of layers, i.e., the number of iterations of the layer, is the user feature vector of the l layer; The project vector combination formula is: where e i is the final item feature vector after merging, l is the current layer, L represents the maximum number of layers, i.e. the number of iterations of the layer, is the item feature vector of layer l. 9.The social recommendation method based on knowledge graph attention network according to claim 1, characterized in that, The content and method steps of S6 include: The user and project interaction probability score is calculated according to the following formula: wherein represents the predicted score of a user for an item, the function f() represents In this method is the inner product function, e u is the user vector, e i is the item vector; The overall loss function of the method is: wherein represents a loss value, Γ() is a cross-entropy loss function, U represents a user set, u represents a user, i represents an item, P represents a positive sampling set, and λ in the formula is a weight coefficient of regularization, represents a predicted score of a user for an item, y ui is a true score of a user for an item, is a calculation function, represents a square number of the second norm.
Citation Information
Patent Citations
Social interest recommendation method and system based on graph convolution matrix decomposition
CN111523051A
Case similarity calculation method and system based on graph convolution
CN114169429A