A knowledge graph recommendation method fusing two-end neighbor features
By integrating knowledge graph recommendation methods that incorporate features from both ends of the network, and combining user feature extraction, item feature extraction, knowledge-aware attention, and neighbor sampling modules, this approach solves the problems of insufficient feature extraction and random sampling of neighborhood information in existing technologies, thereby improving the performance and interpretability of recommendation algorithms.
Patent Information
- Application Number
- CN202310310777.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-27
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2043-03-27
AI Technical Summary
Existing knowledge graph recommendation algorithms suffer from problems such as insufficient feature extraction, failure to consider entity weights in user preference propagation, and random sampling of neighborhood information, resulting in inadequate recommendation performance and poor interpretability.
We adopt a method that integrates features from both ends of the network. This method involves alternating between user feature extraction and item feature extraction modules, combined with a knowledge-aware attention module and a neighbor sampling module. We use the SNESO algorithm to construct a maximum connected subnet, calculate betweenness centrality to sample neighbor nodes, enrich user and item representations, and improve recommendation performance.
It improves the interpretability and performance of recommendation algorithms, alleviates the data sparsity problem, and enhances the accuracy and stability of recommendations.
Smart Images

Figure CN116304350B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge graph technology, specifically to a knowledge graph recommendation method (KAT) that integrates features of dual-end neighbors. Background Technology
[0002] Collaborative filtering-based recommendation algorithms are widely used, making recommendations based on users' historical interactions and shared preferences. However, collaborative filtering methods often face cold-start problems and sparsity issues in the user-item interaction matrix. To address these issues, researchers typically consider using user and item attributes to compensate for sparsity and improve recommendation accuracy, while knowledge graphs have received considerable attention due to their inclusion of additional facts and connections between items.
[0003] However, there is a core challenge in using knowledge graphs in recommendation systems: how to represent heterogeneous information in the vectors of users and items. To address this challenge, existing knowledge graph-based recommendation algorithms are mainly divided into three categories: (1) Embedding-based recommendation algorithms. This method maps entities and relationships in the knowledge graph to low-dimensional vectors to enrich the representation of items. Although this can make full use of the semantic relationships of the knowledge graph, it loses the multi-hop relationships of the knowledge graph during the recommendation process, and some of its results lack interpretability. (2) Path-based recommendation algorithms. This method utilizes the multi-hop structure of the knowledge graph and can extract potential features in the path. However, this type of method heavily relies on the connection pattern of the knowledge graph. Meta-paths need to be designed manually, and the time cost of designing meta-paths in complex knowledge graphs is very high. Therefore, this method is not suitable for real-time recommendation. (3) Hybrid recommendation algorithms. This method combines the above two methods and can overcome the shortcomings of each of the above two methods. However, it requires complex feature engineering to construct item attributes, resulting in high computational cost.
[0004] In addition, existing knowledge graph recommendation algorithms suffer from problems such as insufficient feature extraction, failure to consider entity weights during user preference propagation, and random sampling of neighborhood information.
[0005] Purpose of the invention
[0006] The purpose of this invention is to address the shortcomings of existing technologies by providing a knowledge graph recommendation method (KAT) that integrates features from both ends of the graph. By integrating features from both ends of the graph, the semantic information in the knowledge graph is fully explored. Furthermore, a knowledge-aware attention module is introduced into the recommendation model, and the uncertainty caused by random sampling is avoided when aggregating neighbor nodes. This can alleviate the problem caused by data sparsity, improve the interpretability of the algorithm, and enhance recommendation performance. Summary of the Invention
[0007] This invention provides a knowledge graph recommendation method that integrates features from both ends of a network, comprising the following steps:
[0008] Step 1: Construct a knowledge graph based on publicly available data It consists of a large number of entity-relation-entity triples (h,r,t), where, and These represent the knowledge graph. The triple consists of a head entity h, a relation r, and a tail entity t, and there is a relation r between the head entity h and the tail entity t. and Representing knowledge graphs A collection of entities and relations; It includes both normal and reverse relationships;
[0009] Step 2: Centered on user preference data, use the user feature extraction module to perform preference diffusion to obtain user representations, and then use the knowledge-aware attention module to enrich the user representations;
[0010] Step 3: Construct the maximum connected graph using the SNESO subnet extraction algorithm of the neighbor sampling module, calculate the node influence of the item's neighbors using betweenness centrality, selectively sample the neighbors to obtain the item representation, and then use the item feature extraction module to aggregate the neighborhood vectors to obtain a new item representation.
[0011] Step 4: Using the click-through rate prediction module, perform an inner product operation on the user representation and the new item representation to obtain the probability of the user's preference for the item.
[0012] Preferably, in step two, the user feature extraction module uses the knowledge-aware attention module to assign different attention weights to tail entities in the knowledge graph during the process of acquiring user representations, so as to reveal the different meanings represented when tail entities correspond to different head entities and relations, thus enriching the user representation; in step three, the item feature extraction module uses betweenness centrality to calculate the node influence of the item's neighbors during the process of acquiring item representations, sorts these neighbors, and performs aggregation operations on the top K neighbors according to different application scenarios, thus enriching the item representation; wherein the user feature extraction module and the item feature extraction module are performed alternately.
[0013] More preferably, the user feature extraction module can use items that users have interacted with as seeds to propagate in the knowledge graph based on users' historical records. The nodes obtained from this propagation are used to enhance users' interests. The user-item interaction is defined by assuming that the user set in a certain recommendation scenario is U = {i1, i2, ..., i...}. M The set of items is V = {j1,j2,…,j}. NA user-item interaction matrix is obtained based on the user's implicit feedback. Y = {y ij |i∈U,j∈V}, the implicit feedback includes clicks, browsing, or purchases, where the elements y in matrix Y ij It is represented as shown in equation (1):
[0014]
[0015] Among them, y ij =1 indicates that user i interacted with item j, y ij =0 indicates other cases; that is, y ij =0 does not mean that user i dislikes item j, because there are cases where user i likes item j but has not interacted with it;
[0016] definition P prop Indicates Starting with the corresponding set of entities in the knowledge graph The set of entities obtained when performing a k-level breadth-first traversal, where The set of items for which user i has interacted; the triple (h, r, t) consists of head entity h, tail entity t, and relation r; Random sampling is performed to generate a set of k-hop triples for user i, as shown in equation (2):
[0017]
[0018] When the number of sampled triples is K and At that time, the corresponding Duplicate triplets are allowed in the code;
[0019] Each item j is embedded with an item. Related, where d represents the dimension of the embedding; Each triple (h) p ,r p ,t p The importance of item j to p p Embedded by items Relational embedding and head entity embedding The result is expressed as shown in equation (3):
[0020]
[0021] Based on the weight of each triple, the user feature vector obtained by the first propagation of user i on the knowledge graph is obtained, as shown in equation (4):
[0022]
[0023] in It is regarded as the 1-order response of user i's historical interests to item j, representing the vector representation of user interests after the first round of diffusion; It is the tail entity t p Embedding;
[0024] Replace j in formula (3) with The process of repeating preference propagation yields the 2-order response of user i to item j based on its historical interests. This process is repeated within user i's... The process is iterated through the set to obtain the multi-level responses of user i to item j: The user i's preference features for item j, i.e., the user's feature vector, are represented as shown in equation (5):
[0025]
[0026] Preferably, the item feature extraction module in step two uses graph convolution to aggregate neighbor nodes and item nodes to enrich the features of the item. Specifically, N(j) is defined as the set of entities directly connected to item j in the knowledge graph. Random sampling is performed on the neighbor entities of each entity to obtain the set of adjacent entities E(j). When the number of sampled neighbors is K and the number of edges of j is less than K, duplicate entities are allowed in E(j).
[0027] Define the normalized weight of user i on relation r The importance of a relationship to a user is represented by the following formula (6):
[0028]
[0029] in This indicates that item j and entity e are related. G The relationship between them;
[0030] The neighborhood characteristics of item j are calculated by a linear combination of its neighborhoods, as shown in equation (7):
[0031]
[0032] Where e is the embedding representation of entity e. When computing the neighborhood representation of an entity, It can act as a personalized filter for user i to aggregate neighbors in specific aspects;
[0033] Let entity representation j and its neighborhood representation be... Aggregate into a new vector The representation is as shown in equation (8):
[0034]
[0035] Where W represents the linear transformation matrix, b represents the bias term, and σ represents the nonlinear function. This represents first-order neighborhood information aggregation; the item feature extraction module uses graph convolution to aggregate neighbor nodes and item nodes, thereby enriching the item's feature process. This process can extend from one layer to multiple layers until Q is completed. agg Rank aggregation.
[0036] Preferably, the knowledge-aware attention module is used to assign different attention weights to tail entities to reveal different meanings when the tail entity corresponds to different head entities and relations; assuming (h,r,t) is The p-th triple in the matrix is used to construct an attention embedding for the tail entity, as shown in equation (9):
[0037] η p =ω(h) p ,r p )·t p (9),
[0038] Where ω(h) p ,r p ) represents the attention weights for the head entity and the relation. This function is implemented by a neural network with an attention mechanism, as shown in equations (10)-(11):
[0039] s0=ReLU(W0·(h p ||r p )+b0) (10),
[0040] ω(h p ,r p )=σ(W2·ReLU(W1·s0+b1)+b2) (11),
[0041] Where ReLU is a non-linear activation function, σ represents the Sigmoid activation function, W0, W1 and W2 represent weight matrices, b0, b1 and b2 represent bias terms, and || represents the concatenation operation;
[0042] The coefficients of the entire triplet are normalized using the softmax function, as shown in equation (12):
[0043]
[0044] Finally, the embedding representation of the set of triples of the items preferred by user i is obtained, as shown in equation (13):
[0045]
[0046] Preferably, the neighbor sampling module determines the importance of neighbor nodes before aggregating neighbors; and constructs the maximum connected subnet of the knowledge graph before calculating node influence, specifically using the SNESO algorithm based on set operations to construct the node set MSN of the maximum connected subnet; the SNESO algorithm consists of four steps:
[0047] Step S1: From the knowledge graph Extract the triple (h1, r1, t1) with the largest node degree value from the subnet, and add the head entity h1 and the tail entity t1 to the set of central nodes SN of the largest connected subnet. i At this time, MSN = SN i ={h1,t1};
[0048] Step S2, using SN i Find the set of neighboring nodes NsS centered on the entity. i It is represented as shown in equation (14):
[0049]
[0050] Step S3, if NsS i If there are nodes in MSN that are not present, then these nodes are added to MSN, i.e., MSN = MSN ∪ NsS i and using NsS i Replace the central node set SN i Then proceed to step S2 to find the next-level neighbor node; otherwise, proceed to step S4.
[0051] Step S4: Return the set of nodes in the largest connected subnet, MSN; then use the constructed MSN as a complex network to calculate the influence BC of all nodes in it. The calculation method used is betweenness centrality. The betweenness of a node refers to the number of shortest paths through that node in a network, as shown in Equation (15):
[0052]
[0053] Where g st Indicates from node n s to node n t The number of shortest paths, g st (n i ) represents the shortest paths that pass through node n. i The number of paths; the calculation formula after normalizing equation (15) is shown in equation (16):
[0054]
[0055] Where x i Represents node n i The importance of nodes, c is a proportionality constant, a ij This represents the adjacency matrix of the network.
[0056] Preferably, the click-through rate prediction module in step four constructs a prediction function. To learn, among which Let Γ represent the probability that user u will interact with item v, and let Γ represent the function. The parameters; the click-through rate prediction module performs an inner product operation between the results of the user feature extraction module and the results of the item feature extraction module to obtain the prediction result, as shown in equation (17):
[0057] Attached Figure Description
[0058] Figure 1 This is a flowchart illustrating the Knowledge Graph Recommendation Method (KAT) described in this invention. Detailed Implementation
[0059] The present invention will be further described in detail below with reference to the embodiments.
[0060] It should be noted that the embodiments of the present invention are merely preferred implementations of the method described in the present invention and should not be regarded as limiting the scope of protection of the present invention. Any modifications or substitutions that do not depart from the spirit of the present invention fall within the scope of protection of the present invention, which is determined by the submitted claims.
[0061] To address the problems faced by existing knowledge graph recommendation algorithms, such as insufficient feature extraction, lack of consideration for entity weights during user preference propagation, and random sampling of neighborhood information, this invention proposes an end-to-end recommendation model, KAT. This KAT model is implemented based on knowledge graphs, and the recommendation problem based on knowledge graphs is now formulated as follows. Following the formulas of mainstream recommendation models, we assume that the user set in a certain recommendation scenario is U = {i1, i2, ..., i...} M The set of items is V = {j1,j2,…,j}. N A user-item interaction matrix is obtained based on the user's implicit feedback. Y = {y ij |i∈U,j∈V}, where as shown in equation (1):
[0062]
[0063] y ij=1 indicates that user i interacted with item j, y ij =0 indicates other cases. However, it is worth noting that implicit negative feedback, i.e., y ij A value of 0 does not necessarily mean that user i dislikes item j, because there are cases where user i likes item j but has not yet interacted with it. Furthermore, a knowledge graph is obtained. It consists of a large number of entity-relation-entity triples (h,r,t), here and Let h and t represent the head entity, relation, and tail entity of a triple in a knowledge graph, respectively, and let r be the relation between the head entity h and the tail entity t. and Representing knowledge graphs A set of entities and relations. For example, the triple (Liu Cixin, is the author of..., *The Three-Body Problem*) states that Liu Cixin is the author of the book *The Three-Body Problem*. It is worth noting that... It includes two types of relationships: normal direction and reverse direction. For example, the triple (The Three-Body Problem, written by..., Liu Cixin) indicates that the book The Three-Body Problem was written by Liu Cixin, but the relationship between "author of..." and "written by..." are two different relationships in the knowledge graph.
[0064] User-item interaction matrix Y and knowledge graph Given the given information, the next task is to predict user i's interest in items they haven't interacted with before. The prediction function will be discussed below. To learn, among which Let Γ represent the probability that user i will interact with item j, and let Γ represent the function. The parameters.
[0065] Model framework
[0066] Figure 1 This is a flowchart illustrating the Knowledge Graph Recommendation Method (KAT) described in this invention. The KAT recommendation model proposed in this invention consists of five main parts: 1) a user feature extraction module, which propagates user interests through the structure of the knowledge graph; 2) an item feature extraction module, which uses graph convolutional networks to capture local neighborhood information of nodes in the knowledge graph to enrich item features, wherein the extraction processes of user features and item features are performed alternately; 3) a knowledge-aware attention module, which generates different weights for tail entities based on different head entities and relationships, thereby generating a weighted representation of the tail entities; 4) a neighbor sampling module, which samples neighbors based on the node importance calculated using the betweenness centrality method, after extracting the maximum connected subnet of the knowledge graph using the SNESO algorithm, thus overcoming the instability of random sampling; and 5) a click-through rate prediction module, which aggregates the representations of users and items and outputs the predicted click probability. The five modules of KAT are described in detail below.
[0067] User Feature Extraction Module
[0068] Knowledge graphs contain a vast number of relationships between entities, and studying these complex relationships can reveal users' potential interests. For example, if a user has read "The Three-Body Problem," they are likely to become a fan of Liu Cixin's works and subsequently be interested in his other works, such as "The Wandering Earth." To uncover users' potential higher-order preferences within the knowledge graph, items they have interacted with in their historical records can be used as seeds to propagate throughout the knowledge graph. The nodes obtained from this propagation can then be used to reinforce users' interests.
[0069] definition P prop Indicated by Starting with the corresponding set of entities in the knowledge graph The entity set obtained when performing a breadth-first traversal at level j, where Let h represent the set of items for which user i has interacted. The triple (h, r, t) consists of the head entity h, the tail entity t, and the relation r. We... Random sampling is performed to generate a set of k-hop triples for user i, as shown in equation (2):
[0070]
[0071] When the number of sampled triples is K and At that time, the corresponding Duplicate triples are allowed.
[0072] Each project j is embedded with a project. Related, where d represents the embedding dimension. Each triple (h) p ,r p ,t p The importance of project j to p p Embedded by project Relational embedding and head entity embedding The result is expressed as shown in equation (3):
[0073]
[0074] Based on the weights of each triple, the user feature vector obtained by user i in the first propagation on the knowledge graph can be obtained, as shown in equation (4):
[0075]
[0076] in It can be viewed as the 1-order response of user i's historical interests to item j, representing the vector representation of user interests after the first round of diffusion. It is the tail entity t p Embedded.
[0077] Replace j in formula (3) with By repeating the preference propagation process, we can obtain the 2-order response of user i's historical interests to item j. This process can be performed on user i's... The process is iterated through the set, so we can ultimately obtain the multi-level response of user i to item j: The preference features of user i for item j, i.e., the user's feature vector, can be expressed as shown in equation (5):
[0078]
[0079] Item feature extraction module
[0080] In knowledge graphs, using graph convolution to aggregate neighbor nodes and item nodes can enrich item features. Therefore, a neighborhood information aggregation module, i.e., an item feature extraction module, can be introduced into KAT. Since only relationships differ in the aggregation paths, the importance of relationships to users needs to be considered when calculating the weights of corresponding paths. For example, one user might be interested in Liu Cixin's novel *The Three-Body Problem* because they admire him, while another user might be interested in *The Three-Body Problem* because it's science fiction. Therefore, users' personalized preference features can be quantified based on their emphasis on relationships.
[0081] Define N(j) as the set of entities directly connected to item j in the knowledge graph. Randomly sample the neighboring entities of each entity to obtain the set of neighboring entities E(j). When the number of sampled neighbors is K and the number of edges of j is less than K, duplicate entities are allowed in E(j).
[0082] Normalized weights of user i on relation r The importance of a relationship to a user is expressed as shown in equation (6):
[0083]
[0084] in This indicates that project j and entity e are related. G The relationship between them.
[0085] The neighborhood characteristics of item j can be calculated from the linear combination of its neighborhoods, as shown in equation (7):
[0086]
[0087] Where e is the embedding representation of entity e. When computing the neighborhood representation of an entity, It can act as a personalized filter for user i to aggregate neighbors in specific aspects.
[0088] Finally, entity representation j and its neighborhood representation need to be combined. Aggregate into a new vector This is represented as shown in equation (8):
[0089]
[0090] Where W represents the linear transformation matrix, b represents the bias term, and σ represents the nonlinear function. This represents the aggregation of first-order neighborhood information. The above process can be extended from one layer to multiple layers until Q is completed. agg Rank aggregation.
[0091] Knowledge perception attention module
[0092] When tail entities in a knowledge graph have different head entities and relations, they possess different meanings and vector representations. For example, while both *The Three-Body Problem* and *The Wandering Earth* are works by Liu Cixin and belong to the science fiction genre, *The Three-Body Problem* is a novel while *The Wandering Earth* is a short story, making them quite different. Therefore, a knowledge-aware attention embedding method can be considered to assign different attention weights to tail entities, revealing the different meanings they represent when corresponding to different head entities and relations.
[0093] Suppose (h,r,t) is The p-th triple in the array is used to construct an attention embedding for the tail entity:
[0094] η p =ω(h) p ,r p )·t p (9)
[0095] Where ω(h) p ,r p ) represents the attention weights for the head entity and the relation. This function is implemented by a neural network similar to an attention mechanism, and the specific formula is as follows:
[0096] s0=ReLU(W0·(h p ||r p (10) + b0)
[0097] ω(h p ,r p)=σ(W2·ReLU(W1·s0+b1)+b2) (11)
[0098] Where ReLU is a non-linear activation function, σ represents the Sigmoid activation function, W0, W1, and W2 represent the weight matrices, b0, b1, and b2 represent the bias terms, and || represents the concatenation operation. The softmax function is used to normalize the coefficients of the entire triplet.
[0099]
[0100] Attention weights can help determine which adjacent tail entities should receive more attention, thereby acquiring more effective knowledge.
[0101] Finally, we obtain the embedding representation of the k-th layer triplet set of items preferred by user i:
[0102]
[0103] Neighbor sampling module
[0104] To reduce the computational cost of recommendation models when sampling neighbors for items, existing knowledge graph-based recommendation models typically use random sampling when aggregating neighborhood information. However, this method not only reduces recommendation performance and model stability but also fails to fully exploit the differential impact of neighborhood information on target nodes. For example, when sampling neighbors for the target node "The Three-Body Problem," random sampling might aggregate information such as price -124.8 yuan, page count -1267 pages, and sales -29 million copies, while ignoring important information like author - Liu Cixin, award - Hugo Award, and genre - science fiction. Therefore, assessing the importance of neighbor nodes before aggregating neighbors can prevent the loss of valuable information and reduce the uncertainty of random sampling.
[0105] Since networks built using knowledge graphs are not necessarily fully connected, some nodes may be unable to participate in the calculation of node influence. To eliminate redundancy, it is necessary to construct the maximum connected subnet of the knowledge graph before calculating node influence. We use the SNESO algorithm based on set operations to construct the node set MSN of the maximum connected subnet. This algorithm has low time complexity and is faster than other subnet extraction algorithms such as SNEBF and NetworkX. The SNESO algorithm process is as follows:
[0106] I. From Knowledge Graphs Extract the triple (h1, r1, t1) with the largest node degree value from the subnet, and add the head entity h1 and the tail entity t1 to the set of central nodes SN of the largest connected subnet. i At this time, MSN = SN i ={h1,t1};
[0107] II. With SN i Find the set of neighboring nodes NsS centered on the entity. i :
[0108]
[0109] III. If NsS i If there are nodes in MSN that are not present, then these nodes are added to MSN, i.e., MSN = MSN ∪ NsS i and using NsS i Replace the central node set SN i Then proceed to step II to find the next-level neighbor node. Otherwise, proceed to step IV.
[0110] IV. Return the largest set of connected subnet nodes, MSN.
[0111] Since nodes with larger degree values have a higher probability of having the maximum connected subnet, the SNESO algorithm takes less time to extract the maximum connected subnet.
[0112] This invention uses an existing MSN network as a complex network to calculate the influence BC of all nodes. The calculation method used is betweenness centrality, where the betweenness of a node refers to the number of shortest paths through that node in a network, as shown in equation (15):
[0113]
[0114] Where g st Indicates from node n s to node n t The number of shortest paths, g st (n i ) represents the shortest paths that pass through node n. i The number of paths; the calculation formula after normalizing equation (15) is shown in equation (16):
[0115]
[0116] Where x i Represents node n i The importance of nodes, c is a proportionality constant, a ij This represents the adjacency matrix of the network.
[0117] Click-through rate prediction module
[0118] The Knowledge Graph Recommendation Method (KAT) described in this invention performs the extraction of user features and item features alternately. The user feature extraction module extracts user feature vectors. As input to the item feature extraction module, it participates in the extraction of item features. The item feature extraction module extracts... The information is used as input to the user feature extraction module to further participate in the extraction of higher-order user features. This allows the currently extracted information to be shared between the user end and the item end, improving the model's feature extraction capability in the knowledge graph. The knowledge-aware attention module calculates p in formula (3). p Previously, corresponding weights were assigned to entities to enrich their representation. The neighbor sampling module selects K neighbor nodes for aggregation based on the node influence BC calculated during neighborhood information extraction, thereby improving the value of the extracted features. Finally, we use the inner product representation of user embedding and item embedding as the predicted click probability:
[0119]
[0120] The following example further illustrates this point.
[0121] Example
[0122] A knowledge graph recommendation method (KAT) that integrates features from both ends of a graph includes the following steps:
[0123] Step 1: Construct a knowledge graph based on publicly available data. In this embodiment, three real-world datasets are selected: movies, music, and books. These three datasets differ in size and sparsity, reflecting the performance of the KAT method in the real world. The movie dataset contains nearly 200,000 implicit feedback responses from 942 users on the MovieLens website for 1674 movies. The music dataset contains listening information from 1872 users on the Last.fm online music system. The book dataset contains 100,000 ratings of books from 17860 users in the Book-Crossing community.
[0124] Step 2: Focus on user preference data to carry out preference diffusion. First, filter out the user's historical records and use the items they have interacted with as seeds to spread the preference in the knowledge graph. The nodes obtained from the diffusion can be used to enhance the user's interest. Then, use the knowledge-aware attention mechanism to assign different attention weights to the tail entities to reveal the different meanings represented when the tail entities correspond to different head entities and relationships, thus enriching the user representation.
[0125] Step 3: Construct the maximum connected graph MSN using the SNESO subnet extraction algorithm and store it as triples. Then, use the betweenness centrality method to calculate the node influence of all nodes in the MSN. Sort the neighbors of the items according to the node influence. Finally, selectively aggregate the neighbor nodes to obtain the item representation.
[0126] Specifically, the user feature extraction module and the item feature extraction module work alternately. First, the low-dimensional vector representation of all items, item_embedding, is obtained. During the diffusion of user interests, the knowledge-aware attention module is used to update the item vector representation item_embedding_att. Then, the new item vector representation is used to generate the user's first-order interests. Construct the maximum connected graph MSN using SNESO and calculate node influence using the betweenness centrality method. Select the top K neighbors and correlate them with item_embedding_att. Perform aggregation operations to obtain aggregated item vector representations. Then The data is sent to the user feature extraction module, initiating a new round of alternation between user feature extraction and item feature extraction.
[0127] Step 4: Sum the user's interests at each order to obtain a user vector representation, and perform an inner product operation with the latest item vector representation to obtain the probability of the user's preference for the item. Specifically, to prove the effectiveness of the KAT method, KAT needs to be compared with other state-of-the-art recommendation methods. The selected baseline models are: CKE, RippleNet, KGCN, KGNN-LS, and CKAN. Each dataset is divided into training, validation, and test sets in a ratio of 6:2:2. Each experiment is repeated 5 times, and the results are averaged. The KAT method needs to be evaluated using click-through rate (CTR) prediction, that is, using the trained model to predict each interaction in the test set and output the predicted click probability. Here, AUC and ACC are used to evaluate the performance of the KAT method on the CTR task. We implemented the KAT method code in PyTorch, and determined the hyperparameters by optimizing the AUC on the validation set. The hyperparameters of other baseline methods are set based on grid search.
[0128] Table 1 shows the CTR prediction results of KAT on the three datasets. Compared with these state-of-the-art baselines, KAT has improved performance on all three datasets, with the improvement in performance on the music dataset being greater than that on the movie and book datasets.
[0129] Table 1. Click-through rate prediction results using the KAT method
[0130]
[0131]
[0132] The present invention has the following beneficial effects:
[0133] The knowledge graph recommendation method provided by this invention, which integrates features from both ends of the knowledge graph, fully mines the semantic information in the knowledge graph by integrating features from both ends of the knowledge graph. It also introduces a knowledge-aware attention module into the recommendation model and avoids the uncertainty caused by random sampling when aggregating neighbor nodes. This can alleviate the problem caused by data sparsity, improve the interpretability of the algorithm, and enhance the recommendation performance.
Claims
1. A knowledge graph recommendation method that integrates features from both ends of a network, characterized in that, Includes the following steps: Step 1: Construct a knowledge graph based on publicly available data It consists of a large number of entity-relation-entity triples (h,r,t), where, and These represent the knowledge graph. The triple consists of a head entity h, a relation r, and a tail entity t, and there is a relation r between the head entity h and the tail entity t. and Representing knowledge graphs A collection of entities and relations; It includes both normal and reverse relationships; Step 2: Centered on user preference data, use the user feature extraction module to perform preference diffusion to obtain user representations, and then use the knowledge-aware attention module to enrich the user representations; In step two, the user feature extraction module uses the knowledge-aware attention module to assign different attention weights to tail entities in the knowledge graph during the process of obtaining user representations, in order to reveal the different meanings represented when tail entities correspond to different head entities and relationships, thus enriching user representations. In step three, the item feature extraction module uses betweenness centrality to calculate the node influence of item neighbors during the process of obtaining item representations, sorts these neighbors, and performs aggregation operations on the top K neighbors according to different application scenarios, thus enriching item representations. The user feature extraction module and the item feature extraction module work alternately. Step 3: Construct the maximum connected graph using the SNESO subnet extraction algorithm of the neighbor sampling module, calculate the node influence of the item's neighbors using betweenness centrality, selectively sample the neighbors to obtain the item representation, and then use the item feature extraction module to aggregate the neighborhood vectors to obtain a new item representation. Step 4: Using the click-through rate prediction module, perform an inner product operation on the user representation and the new item representation to obtain the probability of the user's preference for the item.
2. The knowledge graph recommendation method merging dual-end neighbor features according to claim 1, characterized in that, The user feature extraction module can use users' historical records as seeds to propagate items they have interacted with in the knowledge graph. The resulting nodes are used to reinforce user interests. The user-item interaction is defined as follows: assuming a user set U = {i1, i2, ..., i...} in a certain recommendation scenario... M The set of items is V = {j1,j2,…,j}. N A user-item interaction matrix is obtained based on the user's implicit feedback. Y = {y ij |i∈U,j∈V}, the implicit feedback includes clicks, browsing, or purchases, where the elements y in matrix Y ij It is represented as shown in equation (1): Among them, y ij =1 indicates that user i interacted with item j, y ij =0 indicates other cases; that is, y ij =0 does not mean that user i dislikes item j, because there are cases where user i likes item j but has not interacted with it; definition Indicated by Starting with the corresponding set of entities in the knowledge graph The set of entities obtained when performing a k-level breadth-first traversal, where The set of items for which user i has interacted; the triple (h, r, t) consists of head entity h, tail entity t, and relation r; Random sampling is performed to generate a set of k-hop triples for user i, as shown in equation (2): When the number of sampled triples is K and At that time, the corresponding Duplicate triples are allowed in the text; Each item j is embedded with an item. Related, where d represents the dimension of the embedding; Each triple (h) p ,r p ,t p The importance of item j to p p Embedded by items Relational embedding and head entity embedding The result is expressed as shown in equation (3): Based on the weight of each triple, the user feature vector obtained by the first propagation of user i on the knowledge graph is obtained, as shown in equation (4): in It is regarded as the 1-order response of user i's historical interests to item j, representing the vector representation of user interests after the first round of diffusion; It is the tail entity t p Embedding; Replace j in formula (3) with The process of repeating preference propagation yields the 2-order response of user i to item j based on its historical interests. This process is repeated within user i's... The process is iterated through the set to obtain the multi-level responses of user i to item j: The user i's preference features for item j, i.e., the user's feature vector, are represented as shown in equation (5):
3. The knowledge graph recommendation method integrating dual-end neighbor features according to claim 2, characterized in that, The item feature extraction module described in step three uses graph convolution to aggregate neighbor nodes and item nodes to enrich the features of the items. Specifically, N(j) is defined as the set of entities directly connected to item j in the knowledge graph. Random sampling is performed on the neighbor entities of each entity to obtain the set of adjacent entities E(j). When the number of sampled neighbors is K and the number of edges of j is less than K, duplicate entities are allowed in E(j). Define the normalized weight of user i on relation r The importance of a relationship to a user is represented by the following formula (6): in This indicates that item j and entity e are related. q The relationship between them; The neighborhood characteristics of item j are calculated by a linear combination of its neighborhoods, as shown in equation (7): Where e is the embedding representation of entity e; when computing the neighborhood representation of an entity, It can act as a personalized filter for user i to aggregate neighbors in specific aspects; Let entity representation j and its neighborhood representation be... Aggregate into a new vector The representation is as shown in equation (8): Where W represents the linear transformation matrix, b represents the bias term, and σ represents the nonlinear function. This represents first-order neighborhood information aggregation; the item feature extraction module uses graph convolution to aggregate neighbor nodes and item nodes, thereby enriching the item's feature process. This process can extend from one layer to multiple layers until Q is completed. agg Rank aggregation.
4. The knowledge graph recommendation method merging dual-end neighbor features according to claim 3, characterized in that, The knowledge-aware attention module is used to assign different attention weights to tail entities to reveal the different meanings represented when the tail entity corresponds to different head entities and relations; assuming (h,r,t) is... The p-th triple in the matrix is used to construct an attention embedding for the tail entity, as shown in equation (9): or p =ω(h p ,r p )·t p (9), Where ω(h) p ,r p ) represents the attention weights for the head entity and the relation. This function is implemented by a neural network with an attention mechanism, as shown in equations (10)-(11): s0=ReLU(W0·(h p ‖r p )+b0)(10), ω(h p ,r p )=σ(W2·ReLU(W1·s0+b1)+b2)(11), Where ReLU is a non-linear activation function, σ represents the Sigmoid activation function, W0, W1 and W2 represent weight matrices, b0, b1 and b2 represent bias terms, and || represents the concatenation operation; The coefficients of the entire triplet are normalized using the softmax function, as shown in equation (12): Finally, the embedding representation of the set of triples of the items preferred by user i is obtained, as shown in equation (13):
5. The knowledge graph recommendation method merging dual-end neighbor features according to claim 4, characterized in that, Before aggregating neighbors, the neighbor sampling module determines the importance of neighbor nodes; before calculating node influence, it constructs the maximum connected subnet of the knowledge graph, specifically using the SNESO algorithm based on set operations to construct the node set MSN of the maximum connected subnet; the SNESO algorithm consists of four steps: Step S1: From the knowledge graph Extract the triple (h1, r1, t1) with the largest node degree value from the subnet, and add the head entity h1 and the tail entity t1 to the set of central nodes SN of the largest connected subnet. i At this time, MSN = SN i ={h1,t1}; Step S2, using SN i Find the set of neighboring nodes NsS centered on the entity. i It is represented as shown in equation (14): Step S3, if NsS i If there are nodes in MSN that are not present, then these nodes are added to MSN, i.e., MSN = MSN ∪ NsS i and using NsS i Replace the central node set SN i Then proceed to step S2 to find the next-level neighbor node; otherwise, proceed to step S4. Step S4: Return the set of nodes in the largest connected subnet, MSN; Then, the influence BC of all nodes in the constructed MSN is calculated as a complex network. The calculation method used is betweenness centrality. The betweenness of a node refers to the number of shortest paths through that node in a network, as shown in Equation (15): Where g st Indicates from node n s to node n t The number of shortest paths, g st (n i ) represents the shortest paths that pass through node n. i The number of paths; the calculation formula after normalizing equation (15) is shown in equation (16): Where x i Represents node n i The importance of nodes, c is a proportionality constant, a ij This represents the adjacency matrix of the network.
6. The knowledge graph recommendation method fusion of dual-end neighbor features according to claim 5, characterized in that, The click-through rate prediction module described in step four constructs a prediction function. To learn, among which Let Γ represent the probability that user i will interact with item j, and let Γ represent the function. The parameters; the click-through rate prediction module performs an inner product operation between the results of the user feature extraction module and the results of the item feature extraction module to obtain the prediction result, as shown in equation (17):
Citation Information
Patent Citations
Movie recommendation method fusing attention mechanism and double-end knowledge graph
CN114329222A
Knowledge graph preference prediction recommendation method based on attention mechanism
CN115618009A