A personalized recommendation method and device based on knowledge graph
By building a knowledge graph in the recommendation system, using the interactive data between users and items and item attribute information, and training a multi-layer perceptron model for recommendation, the problem that the existing recommendation system fails to make full use of item attribute information and achieves a more accurate recommendation effect.
Patent Information
- Application Number
- CN202210055478.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-18
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-01-18
Smart Images

Figure CN114445180B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of recommendation methods based on deep learning, and specifically to a personalized recommendation method and device based on knowledge graph. Background Art
[0002] In recent years, as the scale of e-commerce continues to expand, the number of product categories has become increasingly complex, and the problem of information overload has become very serious. How to select practical information from massive amounts of information has become a hot topic for many scholars. The goal of the recommendation system is to provide users with product recommendations among the many products on e-commerce websites, thereby helping users choose more suitable products.
[0003] In the prior art, traditional recommendation methods generally use the user's interactive information on items to obtain user preferences. Although the algorithm is relatively simple, the data input into the recommendation model of this method is relatively single, and other user behavior data is not fully utilized. Therefore, it is impossible to fully obtain user preferences, and its recommendation effect needs to be improved. In order to solve the above problems, recommendation methods based on deep learning methods in the prior art have been widely used. Generally, the neural network model is trained based on explicit feedback such as ratings, likes, purchases, or implicit feedback such as browsing records and forwarding records as samples. The neural network model uses its own feature extraction and learning functions to capture user preferences and make recommendations. However, the neural network model rarely considers the attribute characteristics of the product, resulting in less than ideal recommendation results. A recommendation algorithm based on collaborative filtering can be used to recommend items. However, the current recommendation system based on collaborative filtering mainly faces the following problems:
[0004] (1) The existing technology only uses single interaction data and does not fully utilize the rich attribute information of items. For example, it only uses the user's purchase or click behavior of items, but does not take the attribute information of items such as brand and origin into consideration in the recommendation system.
[0005] (2) The real needs of users are not explored. That is, the sample of the recommendation system does not include whether the user buys a certain brand of goods because the user likes the brand or the specific product.
[0006] Therefore, there is a technical problem in the prior art that the recommendation results are not accurate enough. Summary of the invention
[0007] The purpose of this invention is to provide a personalized recommendation method based on knowledge graph to make more accurate recommendations to users.
[0008] In order to achieve the above object, the technical solution adopted by the present invention is:
[0009] The present invention provides a personalized recommendation method based on knowledge graph, comprising the following steps:
[0010] S1: Abstract users, items, and item attribute values into entity nodes, establish a first edge based on the relationship between users and items, and use the attribute relationship between items and item attribute values as the second edge, thereby constructing a collaborative knowledge graph containing users and items, and obtaining embedded representations between entity nodes based on the collaborative knowledge graph, wherein the relationship between users and items includes: a purchase relationship between users and items, a click relationship between users and items, or a combination thereof;
[0011] S2: For the connection path between user u in the entity node and item i in the entity node, the connection path is aggregated according to the embedding of each entity node to obtain the embedding representation of the connection path;
[0012] S3: Use the embedded representations between entity nodes and the embedded representations of connection paths to train a pre-built model until the model converges to obtain a target prediction model, wherein the target prediction model is used to recommend items to users, wherein the pre-built model includes: a multi-layer perceptron model.
[0013] Optionally, acquiring embedding representations between entity nodes according to the collaborative knowledge graph includes:
[0014] For each entity node in the knowledge graph, obtain the neighbor nodes of the entity node, and update the embedding representation of the entity node according to the embedding of the neighbor nodes and the embedding of the relationship between the entity node and the neighbor nodes;
[0015] For each entity node in the collaborative knowledge graph network after the entity node is updated, return to execute the step of obtaining the neighbor nodes of the entity node until the set update condition is met, wherein the set update condition includes: the number of updates.
[0016] Optionally, updating the embedding representation of the entity node according to the embedding of the neighbor nodes and the embedding of the relationship between the entity node and the neighbor nodes includes:
[0017] Using the formula, Calculate the embedding representation of the entity node, where
[0018] is the embedding representation of the entity node h after iterative update of layer l; ReLU is the activation function; is the trainable second weight matrix of the lth layer; e h (l-1) is the embedding representation of the l-1 layer of entity node h; is the l-1 level embedding representation of the neighborhood of entity h, and is the neighborhood embedding of entity node h, W1 is the first trainable weight matrix, e t The embedding of the tail entity, r h,t is the embedding of the relation r between node h and node t, is the concatenation operation symbol; b1 is the first bias.
[0019] Optionally, step S2 includes:
[0020] Obtaining a connection path between a user u in an entity node and an item i in an entity node in the collaborative knowledge graph, wherein the number of entity nodes included in the connection path is preset;
[0021] For each connection path, using a recurrent neural network to update the output of the hidden state of each node on the connection path according to the embedding of each entity node on the connection path;
[0022] The average pooling operation is used to aggregate the connection paths between user u and item i.
[0023] Optionally, the using a recurrent neural network to update the output of the hidden state of each node on the connection path according to the embedding of each entity node on the connection path includes:
[0024] Using the formula, Calculate the output of the hidden state of each node on the connection path, where
[0025] is the recurrent neural network for p n The output of the hidden state of the ath node in the path; tanh is the activation function; W3 is the third weight matrix of the input layer; For p n The embedding of the ath node in the path; W4 is the fourth weight matrix of the hidden layer; is the output of the hidden state of the a-1th layer of the recurrent neural network; b2 is the second bias.
[0026] Optionally, the using an average pooling operation to aggregate the connection paths between the user u and the item i includes:
[0027] Using the formula, Aggregate the connection paths between user u and item i, where
[0028] P[x[is the value of the x dimension in P, and P is the final embedding representation of the aggregation of multiple paths in the connection path P(u,i) between user u and item i; is the averaging operation; n is the number of connection paths; p t[x] is the value of the x-th dimension embedded in the t-th path in the connection path between user u and item i.
[0029] Optionally, the S3 step includes:
[0030] Train the embedding representations between entity nodes and the embedding representations of connection paths in a pre-built model;
[0031] Using the formula, Calculate the prediction results corresponding to the embedding representations between entity nodes and the embedding representations of connection paths in the current iteration, where:
[0032] is the predicted score of user u for item i; MLP is the multi-layer perceptron model; e u is the embedded representation of the user node numbered u; e i is the embedding representation of the item node numbered i;
[0033] Using the formula, Calculate the loss value of the current iteration, where
[0034] is the loss value of the current iteration; ∑ is the summation symbol; R + is the set of interactions between users and items; R - It is the set of items that users have not interacted with;
[0035] When the loss value of the current iteration is greater than the set threshold, the hyperparameters of the multilayer perceptron model are updated using the back propagation algorithm, and the step of calculating the prediction results corresponding to the embedding representations of the entity nodes and the embedding representations of the connection paths in the current iteration is returned until the model converges;
[0036] When the loss value of the current iteration is less than or equal to the set threshold, the model is judged to have converged and the target model is obtained.
[0037] The present invention also provides a personalized recommendation device based on knowledge graph, the device comprising:
[0038] A construction module is used to abstract users, items, and item attribute values into entity nodes, establish a first edge based on the relationship between users and items, and use the attribute relationship between items and item attribute values as a second edge, thereby constructing a collaborative knowledge graph including users and items, and obtaining embedded representations between entity nodes according to the collaborative knowledge graph, wherein the relationship between users and items includes: a purchase relationship between users and items, a click relationship between users and items, or a combination thereof;
[0039] An aggregation module is used to aggregate the connection paths between user u in the entity node and item i in the entity node according to the embedding of each entity node to obtain an embedding representation of the connection path;
[0040] A training module is used to train a pre-built model using embedded representations between entity nodes and embedded representations of connection paths until the model converges to obtain a target prediction model, wherein the target prediction model is used to recommend items to users, wherein the pre-built model includes: a multi-layer perceptron model.
[0041] Optionally, the building module is used to:
[0042] For each entity node in the knowledge graph, obtain the neighbor nodes of the entity node, and update the embedding representation of the entity node according to the embedding of the neighbor nodes and the embedding of the relationship between the entity node and the neighbor nodes;
[0043] For each entity node in the collaborative knowledge graph network after the entity node is updated, return to execute the step of obtaining the neighbor nodes of the entity node until the set update condition is met, wherein the set update condition includes: the number of updates.
[0044] Optionally, the building module is used to:
[0045] Using the formula, Calculate the embedding representation of the entity node, where
[0046] is the embedding representation of the entity node h after iterative update of layer l; ReLU is the activation function; is the trainable second weight matrix of the lth layer; eh( l-1 ) is the embedding representation of the l-1 layer of entity node h; is the l-1 level embedding representation of the neighborhood of entity h, and is the neighborhood embedding of entity node h, W1 is the first trainable weight matrix, e t The embedding of the tail entity, r h,t is the embedding of the relation r between node h and node t, is the concatenation operation symbol; b1 is the first bias.
[0047] The advantages of the present invention are:
[0048] Applying the embodiments of the present invention, the present invention explicitly models the high-order connectivity of the knowledge graph in an end-to-end manner in the collaborative knowledge graph, iteratively updates the nodes continuously by aggregating neighbor nodes, recursively propagates embeddings from the neighbors of the entity nodes to enrich the expression of node embeddings, so that each user node and item node contains its information from the neighborhood, and the user embedding and item embedding will be more fully accurate; and mine the path between users and items in the knowledge graph, use a recurrent neural network to process the path, use an average pooling operation to aggregate the representations of multiple paths, and finally obtain an embedded expression of the path. Compared with the prior art, the present invention not only utilizes the interaction data between users and items, but also utilizes the rich attribute information of items in the knowledge graph as the embedding value of the entity node. Compared with the traditional recommendation method using a single interaction data, the present invention can make more accurate recommendations.
[0049] Moreover, the present invention not only performs update and iterative learning on item nodes, but also updates and iterates learning on user nodes. Compared with the traditional method, it can not only learn the updated representation of items, but also learn the updated representation of users in the knowledge graph.
[0050] Finally, the present invention enhances the expression of user preferences by mining the paths between users and items in the knowledge graph and processing them using a recurrent neural network, which can improve the performance of recommendations and make them explainable. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram of the principle of a personalized recommendation method based on knowledge graph provided by an embodiment of the present invention;
[0052] Figure 2 A schematic diagram of a process of a personalized recommendation method based on a knowledge graph provided in an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of the aggregation and update principle of entity nodes in a personalized recommendation method based on a knowledge graph provided in an embodiment of the present invention.
[0054] Figure 4 A schematic diagram of the principle of a recurrent neural network processing path for a personalized recommendation method based on a knowledge graph provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0056] Figure 1 A schematic diagram of the principle of a personalized recommendation method based on a knowledge graph provided by an embodiment of the present invention, Figure 2A flowchart of a personalized recommendation method based on knowledge graph provided by an embodiment of the present invention is shown in FIG. Figure 1 and Figure 2 As stated,
[0057] S1. Abstract users, items, and item attribute values into entity nodes, establish a first edge based on the relationship between users and items, and use the attribute relationship between items and item attribute values as the second edge, thereby constructing a collaborative knowledge graph including users and items, and obtaining embedded representations between entity nodes based on the collaborative knowledge graph, wherein the relationship between users and items includes: a purchase relationship between users and items, a click relationship between users and items, or a combination thereof.
[0058] Exemplarily, users, items, and item attribute values are used as entity nodes, and the edges between users and items are established by using the user's purchase relationship with the item, the click relationship with the item, the attention relationship with the item, etc. It can be understood that the edges corresponding to different relationships between users and items are also different. In addition, in practical applications, the same item may have different brands, and the same item of the same brand may also have different origins. The brand of the item and the origin of the item can be used as the attribute value of the item, and the edge between the item and the brand, the edge between the brand of the item and the origin of the item, and the edge between the origin of the item and the item can all be used as attributes.
[0059] First, user embedding and item embedding are acquired. The representation of an entity node is updated by aggregating neighbor nodes around the entity node in the collaborative knowledge graph, which is a knowledge graph containing user nodes. The final embedding representation of user nodes and item nodes is obtained through multiple rounds of updates. Figure 3 A schematic diagram of the entity node aggregation update principle in a personalized recommendation method based on knowledge graph provided by an embodiment of the present invention, such as Figure 3 As shown in (a), the entity node e represents the user h Respectively with the entity node e representing the item t1 、e t2 、e t3 Connection, for entity node e h The specific process is as follows:
[0060] Step 1.1: Use the actual purchase information y of user u for item i u,i The construction formula (1) is as follows:
[0061]
[0062] In formula (1), 1 means that user u purchased item i, and 0 means that user u did not purchase item i.
[0063] Step 1.2: Based on the information of an entity node edge, the collaborative knowledge graph is formalized as a triple of (h, r, t) in the form of head entity-relationship-tail entity. The triple indicates that there is a relationship r between the head entity h and the tail entity t. Taking the user and the item as an example, the user is the head entity and the item is the tail entity. The relationship refers to the purchase information that the user purchased the item. The corresponding triple is "(a certain user, purchase, a certain item)". If a certain user has a purchase behavior for a certain item, the value of formula (1) is 1.
[0064] Similarly, the user's attention behavior to an item can be: the user pays attention to an item of a certain brand, and the corresponding triple can be "(a certain user, attention, an item of a certain brand)", where both the brand and the item can be used as entity nodes, and the two are connected by attributes, and the brand name can be used as the attribute value of the brand entity node, and the item name can be used as the attribute value of the item entity node. Then, the corresponding triples can be established, and several triples can be used to represent the collaborative knowledge graph using formula (2):
[0065] G={(h,r,t)|h,t∈E,r∈R} (2),
[0066] Among them, G is the item knowledge graph, E is the entity node set, R is the relationship set, and R can be one or a combination of purchase relationship, click relationship, attention relationship, origin relationship, and brand relationship.
[0067] Step 1.3: For each entity node h in the collaborative knowledge graph, the set of neighbor nodes of the entity node is used as the node neighborhood. For example, all entity nodes that have edge connections with the entity node can be added to the neighbor set. As shown in Formula 3:
[0068] S h ={t|(h,r,t)∈G} (3),
[0069] Among them, S h It is the set of all neighbor nodes of entity node h, which can be expressed as the neighborhood of entity node h.
[0070] Step 1.4: When updating the knowledge graph for the first time, you first need to use a knowledge graph representation learning method such as the TransR method to learn the knowledge graph to assign an initial embedding representation to each entity node, and then use the formula for each entity node.
[0071]
[0072] Aggregate the embedding representations of all neighboring nodes of the entity node to obtain the neighborhood embedding representation of the entity node h, where
[0073] is the neighborhood embedding of entity node h, W1 is the first trainable weight matrix, e t is the embedding representation value of the tail entity, r h,t is the embedding representation value of the relationship r between node h and node t, It is the splicing operation symbol;.
[0074] Step 1.5: Connect the entity node to its neighborhood using the formula:
[0075] Calculate the embedding representation of the entity node, where
[0076] is the embedding representation of the entity node h after iterative update of layer l; ReLU is the activation function; is the trainable second weight matrix of the lth layer; e h (l-1) is the embedding representation of the l-1 layer of entity node h; is the l-1 layer embedding representation of the neighborhood of entity h, and b1 is the first bias.
[0077] It should be emphasized that the first weight matrix and the second weight matrix can be trained using the pre-collected triplets and the manually annotated item recommendation data corresponding to the triplets, and then the trained first weight matrix and the second weight matrix can be used for item recommendation.
[0078] Step 1.6: The final user embedding and item embedding can be represented by the user nodes and item nodes that have been updated in multiple layers. The embedding of the user node can be represented by formula (6) and the embedding of the item node can be represented by formula (7):
[0079]
[0080]
[0081] S2: For the connection path between user u in the entity node and item i in the entity node, the connection path is aggregated according to the embedding of each entity node to obtain the embedding representation of the connection path. This step can mine the path between users and items in the collaborative knowledge graph and define the node length of the path to control the number of paths.
[0082] Step 2.1, based on the user's purchase, click or attention behavior on the item, obtain the connection between user u and item i in the collaborative knowledge graph as a path. In order to limit the number of paths, the threshold of the number of path nodes is set to 6. For example, the relationship between the user and the item is purchase, but the attributes of the item can also be used as a path, for example: user u-purchase-item 1-a certain brand-item 2. This path can use the two relationships of purchase and brand to connect user u and item 2. Then the qualified connection path between user node u and item node i is represented as:
[0083] P(u,i)=(p1,p2,…,p n ) (8), where P(u,i) represents the set of paths between user u and item i, and n represents the number of paths.
[0084] Step 2.2: Input each path into the recurrent neural network to connect the paths p n Taking a node as an example, the recurrent neural network uses the formula,
[0085]
[0086] Processing connection path p n Calculate the output of the hidden state of each node on the connection path, where
[0087] is the recurrent neural network for p n The output of the hidden state of the ath node in the path can represent the entire path p n ,Right now tanh is the activation function; W3 is the third weight matrix of the input layer; For p n The embedding of the ath node in the path; W4 is the fourth weight matrix of the hidden layer; is the output of the hidden state of the a-1th layer of the recurrent neural network; b2 is the second bias. Usually, the hidden state output of the last node on the connection path can be expressed as the output of the entire path.
[0088] Step 2.3: Use average pooling to aggregate multiple paths in P(u,i). Using the formula, Aggregate the connection paths between user u and item i, where
[0089] P[x] is the value of the x dimension in P, and P is the final embedding representation of the aggregation of multiple paths in the connection path P(u,i) between user u and item i; is the averaging operation; n is the number of connection paths; p t[x] is the value of the x-th dimension embedded in the t-th path in the connection path between user u and item i.
[0090] Optionally, the S3 step includes.
[0091] S3: Use the embedded representations between entity nodes and the embedded representations of connection paths to train a pre-built model until the model converges to obtain a target prediction model, wherein the target prediction model is used to recommend items to users, wherein the pre-built model includes: a multi-layer perceptron model.
[0092] Figure 4 A schematic diagram of a recurrent neural network processing path principle of a personalized recommendation method based on a knowledge graph provided by an embodiment of the present invention, such as Figure 4 As shown, the user embedding item embedding obtained in step S1 and the user-item path embedding obtained in step S2 are input into the multi-layer perceptron to predict the possibility of interaction. The loss function is defined and the model is trained to achieve the optimal value. Finally, the possibility of the target user interacting with each item is obtained, and all possibilities are sorted in descending order, and the top N items are selected to recommend to the user. The specific process of step 3 is as follows:
[0093] Step 3.1: Get the user’s final embedding representation e from step S1 u and the final embedding representation of the item i ; Get the final representation P of the user-item path from step S2 (u,i) Finally, the data is input into the multi-layer perceptron to predict the score of user u for item i.
[0094] In the multi-layer perceptron model, using the formula,
[0095]
[0096] Calculate the prediction results corresponding to the embedding representations between entity nodes and the embedding representations of connection paths in the current iteration, where:
[0097] is the predicted score of user u for item i; MLP is a multi-layer perceptron model, which uses ReLU as the activation function of the hidden layer and sigmoid as the activation function of the output layer to control the output score between [0,1]. The closer the score is to 1, the more likely the user is to interact with the item, and vice versa. u is the embedded representation of the user node numbered u; e i is the embedding representation of the item node numbered i.
[0098] Step 3.2, then, using the loss function,
[0099]
[0100] Calculate the model loss value in the current iteration, where R + and R - Indicates the set of user items that have interacted and the set that have not interacted. The multi-layer perceptron model can uniformly sample non-interacted items j for each user u, learn parameters through back propagation, and then make the model converge.
[0101] When the loss value of the current iteration is greater than the set threshold, the hyperparameters of the multilayer perceptron model are updated using the back propagation algorithm, and the step of calculating the prediction results corresponding to the embedding representations of the entity nodes and the embedding representations of the connection paths in the current iteration is returned until the model converges;
[0102] When the loss value of the current iteration is less than or equal to the set threshold, the model is judged to have converged and the target model is obtained.
[0103] The target model evaluates the possibility of the target user in the data to be predicted input into the model interacting with each item, sorts all the possibilities in descending order, and selects the top N items to recommend to the user.
[0104] An embodiment of the present invention provides a personalized recommendation device based on a knowledge graph, the device comprising:
[0105] A construction module is used to abstract users, items, and item attribute values into entity nodes, establish a first edge based on the relationship between users and items, and use the attribute relationship between items and item attribute values as a second edge, thereby constructing a collaborative knowledge graph including users and items, and obtaining embedded representations between entity nodes according to the collaborative knowledge graph, wherein the relationship between users and items includes: a purchase relationship between users and items, a click relationship between users and items, or a combination thereof;
[0106] An aggregation module is used to aggregate the connection paths between user u in the entity node and item i in the entity node according to the embedding of each entity node to obtain an embedding representation of the connection path;
[0107] A training module is used to train a pre-built model using embedded representations between entity nodes and embedded representations of connection paths until the model converges to obtain a target prediction model, wherein the target prediction model is used to recommend items to users, wherein the pre-built model includes: a multi-layer perceptron model.
[0108] In a specific trial mode of an embodiment of the present invention, the building module is used to:
[0109] For each entity node in the knowledge graph, obtain the neighbor nodes of the entity node, and update the embedding representation of the entity node according to the embedding of the neighbor nodes and the embedding of the relationship between the entity node and the neighbor nodes;
[0110] For each entity node in the collaborative knowledge graph network after the entity node is updated, return to execute the step of obtaining the neighbor nodes of the entity node until the set update condition is met, wherein the set update condition includes: the number of updates.
[0111] In a specific trial mode of an embodiment of the present invention, the building module is used to:
[0112] Using the formula, Calculate the embedding representation of the entity node, where
[0113] is the embedding representation of the entity node h after iterative update of layer l; ReLU is the activation function; is the trainable second weight matrix of the lth layer; e h (l-1) is the embedding representation of the l-1 layer of entity node h; is the l-1 level embedding representation of the neighborhood of entity h, and is the neighborhood embedding of entity node h, W1 is the first trainable weight matrix, e t The embedding of the tail entity, r h,t is the embedding of the relation r between node h and node t, is the concatenation operation symbol; b1 is the first bias.
[0114] The embodiments described in the present invention are merely descriptions of the preferred implementation modes of the present invention, and are not intended to limit the concept and scope of the present invention. Without departing from the design concept of the present invention, various modifications and improvements made to the technical solutions of the present invention by engineers and technicians in this field should fall within the protection scope of the present invention. The technical contents for which protection is sought in the present invention have all been recorded in the claims.
Claims
1. A personalized recommendation method based on knowledge graph, characterized in that: The following steps are involved: S1: Abstract users, items, and item attribute values into entity nodes, establish a first edge based on the relationship between users and items, and use the attribute relationship between items and item attribute values as the second edge, thereby constructing a collaborative knowledge graph containing users and items, and obtaining embedded representations between entity nodes based on the collaborative knowledge graph, wherein the relationship between users and items includes: a purchase relationship between users and items, a click relationship between users and items, or a combination thereof; S2: For the connection path between user u in the entity node and item i in the entity node, the connection path is aggregated according to the embedding of each entity node to obtain the embedding representation of the connection path; S3: using the embedded representations between entity nodes and the embedded representations of connection paths to train a pre-built model until the model converges, to obtain a target prediction model, wherein the target prediction model is used to recommend items to the user, wherein the pre-built model includes: a multi-layer perceptron model; Wherein, obtaining the embedding representation between entity nodes according to the collaborative knowledge graph includes: For each entity node in the knowledge graph, obtain the neighbor nodes of the entity node, and update the embedding representation of the entity node according to the embedding of the neighbor nodes and the embedding of the relationship between the entity node and the neighbor nodes; For each entity node in the collaborative knowledge graph network after the entity node is updated, return to execute the step of obtaining the neighbor nodes of the entity node until the set update condition is met, wherein the set update condition includes: the number of updates; The updating of the embedding representation of the entity node according to the embedding of the neighbor nodes and the embedding of the relationship between the entity node and the neighbor nodes includes: Using the formula, Calculate the embedding representation of the entity node, where is the embedding representation of the entity node h after l layers of update; ReLU is the activation function; is the trainable second weight matrix of the lth layer; is the embedding representation of the l-1 layer of entity node h; is the l-1 level embedding representation of the neighborhood of entity h, and is the neighborhood embedding of entity node h, W1 is the first trainable weight matrix, e t is the embedding of the tail entity, r h,t is the embedding of the relation r between node h and node t, is the concatenation operation symbol; b1 is the first bias; S h is the set of all neighbor nodes of entity node h; For each entity node in the collaborative knowledge graph network after the entity node is updated, return to execute the step of obtaining the neighbor nodes of the entity node until the set update condition is met, wherein the set update condition includes: the number of updates; Wherein, the step S2 comprises: Obtaining a connection path between a user u in an entity node and an item i in an entity node in the collaborative knowledge graph, wherein the number of entity nodes included in the connection path is preset; For each connection path, using a recurrent neural network to update the output of the hidden state of each node on the connection path according to the embedding of each entity node on the connection path; The average pooling operation is used to aggregate the connection paths between user u and item i.
2. The personalized recommendation method based on knowledge graph according to claim 1, characterized in that: The method of updating the output of the hidden state of each node on the connection path according to the embedding of each entity node on the connection path by using a recurrent neural network includes: Using the formula, Calculate the output of the hidden state of each node on the connection path, where is the recurrent neural network for p n The output of the hidden state of the ath node in the path; tanh is the activation function; W3 is the third weight matrix of the input layer; For p n The embedding of the ath node in the path; W4 is the fourth weight matrix of the hidden layer; is the output of the hidden state of the a-1th layer of the recurrent neural network; b2 is the second bias.
3. The personalized recommendation method based on knowledge graph according to claim 1, characterized in that: The method of using the average pooling operation to aggregate the connection paths between the user u and the item i includes: Using the formula, Aggregate the connection paths between user u and item i, where P[x] is the value of the x dimension in P, and P is the final embedding representation of the aggregation of multiple paths in P(u,i); is the averaging operation; n is the number of connection paths; p t [x] is the value of the xth dimension embedded in the tth path; P(u,i) represents the set of paths between user u and item i.
4. The personalized recommendation method based on knowledge graph according to claim 1, characterized in that: The step S3 comprises: Train the embedding representations between entity nodes and the embedding representations of connection paths in a pre-built model; Using the formula, Calculate the prediction results corresponding to the embedding representations between entity nodes and the embedding representations of connection paths in the current iteration, where: is the predicted score of user u for item i; MLP is the multi-layer perceptron model; e u is the embedded representation of the user node numbered u; e i is the embedding representation of the item node numbered i; Using the formula, Calculate the loss value of the current iteration, where is the loss value of the current iteration; ∑ is the summation symbol; R + is the set of interactions between users and items; R - It is the set of items that users have not interacted with; When the loss value of the current iteration is greater than the set threshold, the hyperparameters of the multilayer perceptron model are updated using the back propagation algorithm, and the step of calculating the prediction results corresponding to the embedding representations of the entity nodes and the embedding representations of the connection paths in the current iteration is returned until the model converges; When the loss value of the current iteration is less than or equal to the set threshold, the model is judged to have converged and the target model is obtained.
5. A personalized recommendation device based on knowledge graph, characterized in that: The device comprises: A construction module is used to abstract users, items, and item attribute values into entity nodes, establish a first edge based on the relationship between users and items, and use the attribute relationship between items and item attribute values as a second edge, thereby constructing a collaborative knowledge graph including users and items, and obtaining embedded representations between entity nodes according to the collaborative knowledge graph, wherein the relationship between users and items includes: a purchase relationship between users and items, a click relationship between users and items, or a combination thereof; An aggregation module is used to aggregate the connection paths between user u in the entity node and item i in the entity node according to the embedding of each entity node to obtain an embedding representation of the connection path; A training module, used to train a pre-built model using the embedded representations between entity nodes and the embedded representations of connection paths until the model converges to obtain a target prediction model, wherein the target prediction model is used to recommend items to users, wherein the pre-built model includes: a multi-layer perceptron model; Wherein, the building block is used for: For each entity node in the knowledge graph, obtain the neighbor nodes of the entity node, and update the embedding representation of the entity node according to the embedding of the neighbor nodes and the embedding of the relationship between the entity node and the neighbor nodes; For each entity node in the collaborative knowledge graph network after the entity node is updated, return to execute the step of obtaining the neighbor nodes of the entity node until the set update condition is met, wherein the set update condition includes: the number of updates; The building blocks are also used to: Using the formula, Calculate the embedding representation of the entity node, where is the embedding representation of the entity node h after l layers of update; ReLU is the activation function; is the trainable second weight matrix of the lth layer; is the embedding representation of the l-1 layer of entity node h; is the l-1 level embedding representation of the neighborhood of entity h, and is the neighborhood embedding of entity node h, W1 is the first trainable weight matrix, e t is the embedding of the tail entity, r h,t is the embedding of the relation r between node h and node t, is the concatenation operation symbol; b1 is the first bias; S h is the set of all neighbor nodes of entity node h; For each entity node in the collaborative knowledge graph network after the entity node is updated, return to execute the step of obtaining the neighbor nodes of the entity node until the set update condition is met, wherein the set update condition includes: the number of updates; The aggregation module is further used to obtain a connection path between a user u in an entity node and an item i in an entity node in the collaborative knowledge graph, wherein the number of entity nodes included in the connection path is preset; For each connection path, using a recurrent neural network to update the output of the hidden state of each node on the connection path according to the embedding of each entity node on the connection path; The average pooling operation is used to aggregate the connection paths between user u and item i.