A recommendation method, recommendation network and related equipment
By using neural networks to calculate multiple directions based on knowledge graphs and user information, the problem of users having difficulty finding suitable items in massive information environments is solved, and a higher recommendation accuracy and recall rate is achieved.
Patent Information
- Application Number
- CN202011640574.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-31
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2040-12-31
AI Technical Summary
In a massive information environment, how to accurately recommend appropriate items to users and solve the problem of information overload.
By acquiring the knowledge graph and user information, at least one first direction and at least one second direction of the knowledge graph are calculated based on the neural network to obtain the recommendation result, a new recommendation method is provided.
It improves the accuracy and recall of recommendation results, and can recommend items to users more accurately.
Smart Images

Figure CN114691973B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence, and in particular to a recommendation method, a recommendation network, and related devices. Background Art
[0002] Artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is also the study of the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0003] With the development of Internet information technology, especially the rise of e-commerce, Internet content has exploded and gradually entered the era of massive data. When users are faced with a wide variety of commodities, movies, music, videos and other items, they are at a loss. This is the problem of information overload that is often mentioned.
[0004] Therefore, how to accurately recommend suitable items to users from a large number of items is a technical problem that needs to be solved urgently. Summary of the invention
[0005] The embodiments of the present application provide a recommendation method, a recommendation network, and related devices, which can run a neural network based on the knowledge graph and user information to obtain a recommendation result, wherein the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain a recommendation result, and provide a new recommendation method that can obtain more accurate recommendation results, that is, improve the precision and / or recall rate of the recommendation results, and can be applied to scenarios such as movie recommendations and game recommendations for recommending items to users.
[0006] The first aspect of the embodiment of the present application provides a recommendation method, which can be executed by a recommendation device or by a component of the recommendation device (such as a processor, a chip, or a chip system, etc.). The method includes: obtaining a knowledge graph, wherein the knowledge graph includes multiple first entities for indicating items and multiple second entities for indicating item attributes; running a neural network based on the knowledge graph and user information to obtain a recommendation result, wherein the user information indicates items or item attributes involved in the user's historical records. The recommendation result includes a recommended item, and the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain a recommendation result, wherein the first direction starts from a first entity indicating a recommended item or an item to be recommended, and the second direction starts from a first entity indicating an item involved in the user's historical records, or the second direction starts from a second entity indicating an item attribute involved in the user's historical records. Among them, the user's information may include a user identifier, items or item attributes clicked by the user, and attributes related to the user, such as the user's age, occupation, gender, etc. The items to be recommended can be understood as items that the user has not clicked on. What this recommendation method needs to do is to find recommended items suitable for recommending to the user from the items to be recommended, so as to improve the precision and recall rates. It can be understood that, in the knowledge graph, the first entity that does not indicate the items that the user has historically involved in can all be items to be recommended. Of course, in some implementations, a preliminary screening can be performed to narrow the scope of items to be recommended in the knowledge graph, so as to select some items indicated by the first entity as items to be recommended. The above-mentioned user information can indicate the items or item attributes involved in the positive events in the user's historical records. It should be understood that the user's information can be screened. The user's information used for recommendation indicates the items or item attributes involved in the positive events in the user's historical records. Among them, the items or item attributes involved in the positive events in the user's historical records can be understood as the items or item attributes indicated by the first entity or the second entity that the user has been involved in the positive event. Among them, a positive event means that the user does not explicitly express a negative or negative intention in the event (that is, dislike, disinterest, unwillingness to pay attention), or expresses positive intentions such as attention, liking, and interest. For example, items or item attributes that users click, forward, follow, comment, reward (such as coin, like), collect, browse, and browse for more than a threshold time are all positive events, while items or item attributes that users click "dislike", click "don't want to see", click "not interested", and select "don't appear on my homepage" are negative events. Items or item attributes involved in such historical records should be eliminated and prevented from being input. In addition, the first direction starts from the first entity indicating the recommended item or the item to be recommended. It can be understood that the starting point of the first direction is the first entity indicating the recommended item or the item to be recommended, and there is no limitation on which entity the first direction points to.Similarly, the second direction starts from the first entity indicating the recommended item or the item to be recommended, or the first direction starts from the second entity indicating the item attribute involved in the user's historical record. It can be understood that the starting point of the second direction is the first entity indicating the recommended item or the item to be recommended, or the starting point of the second direction is the second entity, and there is no limitation on which entity the second direction points to. For example: in the scenario of recommending movies, the starting point of the first direction is the movie that the user has not watched, and the starting point of the second direction is the movie that the user has watched, or the corresponding movie genre, etc.
[0007] In an embodiment of the present application, a neural network can be run based on the knowledge graph and the user's information to obtain a recommendation result, wherein the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain a recommendation result, providing a new recommendation method that can obtain more accurate recommendation results, that is, improve the precision and / or recall rate of the recommendation results.
[0008] Optionally, in a possible implementation manner of the first aspect, the recommendation result in the above step also includes an explanation of the recommended item, and the explanation is related to a first direction and a second direction.
[0009] In this possible implementation, on the one hand, the explanation of the recommended item can be obtained based on the first direction and the second direction. Since the explanation is related to the two directions, the rationality of the explanation can be improved. On the other hand, in addition to obtaining the recommended item, the recommendation method can also obtain the explanation of the recommended item, which can explain the reason why the recommended item is recommended.
[0010] Optionally, in a possible implementation of the first aspect, the above steps run a neural network based on the knowledge graph and the user's information to obtain a recommendation result, including: extracting multiple paths in the knowledge graph based on the knowledge graph and the user's information, each path indicating the association between entities at both ends of the path, one end of each path corresponding to an item to be recommended, and the other end corresponding to an item or item attribute involved in the user's historical record; inputting the multiple paths into the neural network to score the multiple items to be recommended so that the neural network obtains a recommendation result, and the neural network is used to calculate based on the first direction and the second direction of each of the multiple paths to obtain a recommendation result, for a path, the first direction is one end of the path pointing to the other end of the path, and the second direction is the other end of the path pointing to one end of the path.
[0011] In this possible implementation, multiple recommended items can be scored through multiple paths, and a neural network can be used to calculate based on the first direction and the second direction of each of the multiple paths to obtain a recommendation result, so that both directions of the path are considered when scoring, which is more accurate than the recommendation result obtained from only a single direction in the prior art. In actual applications, multiple recommended items will be calculated based on the first direction and the second direction of each of the multiple paths to obtain multiple recommended items, and then the final recommendation result is obtained based on the ranking of the recommended items. In this way, several recommended items can be preset, so more accurate recommended items can be given.
[0012] Optionally, in a possible implementation of the first aspect, the above steps run a neural network based on the knowledge graph and user information to obtain a recommendation result, including: inputting the knowledge graph and user information into the neural network; the neural network extracts multiple paths in the knowledge graph based on the knowledge graph and user information, each path indicating the association between entities at both ends of the path, one end of each path corresponds to an item to be recommended, and the other end corresponds to an item or item attribute involved in the user's historical record; scoring the multiple items to be recommended based on the first direction and the second direction of each of the multiple paths so that the neural network obtains a recommendation result, for a path, the first direction is one end of the path pointing to the other end of the path, and the second direction is the other end of the path pointing to one end of the path.
[0013] In this possible implementation, multiple items to be recommended can be scored based on the first direction and the second direction of each of the multiple paths, so that both directions of the paths are considered when scoring, which is more accurate than the recommendation results obtained from only a single direction in the prior art. In actual applications, multiple items to be recommended will be scored based on the first direction and the second direction of each of the multiple paths to obtain multiple recommended items, and then the final recommendation result is obtained based on the ranking of the recommended items. In this way, several recommended items can be preset, so more accurate recommended items can be given.
[0014] Optionally, in a possible implementation of the first aspect, the first direction of the above step is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector that points from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector that points from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector that points from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of an item attribute involved in the user's historical record in the path; scoring multiple items to be recommended corresponding to the multiple paths based on the first and second directions of each of the multiple paths so that the neural network obtains a recommendation result, including: for each of the multiple paths, scoring the items to be recommended corresponding to each path based on the probability that the first vector and the second vector of each path converge to an entity in each path to obtain a recommended item.
[0015] In this possible implementation, the probability of overlap of the information of the left and right flows in the path in the embedding space is calculated, and the overlap probability feature of the convergence node is calculated. The overlap probability feature is used to output a semantic-level explanation, that is, the user's preference for a certain entity node. In practical applications, multiple recommended items will be scored based on the probability that the first vector and the second vector of each path converge to an entity in each path, so as to obtain multiple recommended items, and then the final recommendation result is obtained based on the ranking of the recommended items. In this way, the items suitable for the user are placed in the front, and the user's interest points can be accurately found.
[0016] Optionally, in a possible implementation of the first aspect, the above steps also include: scoring the multiple paths based on the first direction and the second direction of each of the multiple paths to obtain an explanation of the recommendation results, wherein the explanation is a description of the association between the entities at both ends indicated by the one or more paths that obtain the recommendation results.
[0017] In this possible implementation, multiple paths can be scored based on their respective first and second directions, so that both directions of the paths are considered when scoring, which is more comprehensive and accurate than the interpretation of the recommendation results obtained from only one direction in the prior art. In actual applications, multiple paths will be scored based on their respective first and second directions to obtain multiple interpretations, and then the final recommendation results are obtained based on the sorting of the interpretations. In this way, several recommended items can be preset, so more accurate recommended items can be given.
[0018] Optionally, in a possible implementation of the first aspect, the first direction of the above step is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector that points from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector that points from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector that points from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of the item attribute involved in the user's historical record in the path; scoring the multiple paths based on their respective first and second directions to obtain an explanation of the recommendation results, including: respectively calculating the probability that the first vector and the second vector of each path converge to an entity included in each path, to obtain an explanation of the recommendation results.
[0019] In this possible implementation, the probability of the information of the left and right flows in the path overlapping in the embedding space is calculated, and the coincidence probability feature of the convergence node is calculated. The coincidence probability feature is used to output a semantic explanation, that is, the user's preference for a certain entity node. That is, the probability of the vectors of the two flows converging together is calculated. This helps to more accurately find the user's points of interest and give appropriate recommendations.
[0020] Optionally, in a possible implementation manner of the first aspect, the above steps of respectively calculating the probability that the first vector and the second vector of each path converge to an entity included in each path include:
[0021]
[0022] Among them, p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the recommended item and the items or item attributes involved in a user's historical record.
[0023] Optionally, in a possible implementation of the first aspect, the neural network in the above-mentioned steps is obtained by taking training samples as input of the neural network and training the neural network with the value of the loss function being less than a threshold as the goal, the training samples include multiple training paths, or the training samples include a knowledge graph used for training, items and / or item attributes involved in the historical records of users used for training, each training path indicates the association between entities at both ends of the training path, and both ends of each training path correspond to items or item attributes involved in the historical records of the user; the loss function includes a first loss function, and the first loss function is used to indicate the difference between the recommendation result output by the neural network and the target result, and the target result is related to the items or item attributes involved in the historical records of the user.
[0024] In this possible implementation, the neural network is trained by using the first loss function, so that the recommendation results are more accurate and in line with the user's preferences.
[0025] Optionally, in a possible implementation of the first aspect, the loss function in the above step also includes a second loss function, and the second loss function is used to indicate the difference between the word vectors of the first training vector and the second training vector in the training path of the knowledge graph used for training, and the two ends of the training path correspond to the items or item attributes involved in the user's historical records.
[0026] In this possible implementation, the purpose of the second loss function is to minimize the calculation error of the path flowing to the same node on the left and right, so that in the higher-dimensional relationship matrix in the embedding space, the word vector calculated on the left is as equal as possible to the word vector calculated on the right. That is, the second loss function can minimize the error of the two ends of the path flowing to the same node, which can solve the problem of the two ends of the path flowing to the same node in complex relationships.
[0027] Optionally, in a possible implementation of the first aspect, the loss function in the above step also includes a third loss function, which is used to indicate the difference between the calculated word vector of the first entity and the true word vector of the first entity, and / or to indicate the difference between the calculated word vector of the second entity and the true word vector of the second entity.
[0028] In this possible implementation, the third loss function can minimize the error in mapping the vectors of the head and tail nodes of the triplet to a relational space, thereby solving the problem of one-to-many and many-to-one existence of a single triplet in a complex relationship.
[0029] The second aspect of the embodiment of the present application provides a recommendation method, which can be executed by a recommendation device or by a component of the recommendation device (such as a processor, a chip, or a chip system, etc.). The method includes: obtaining a knowledge graph, a first identifier, and a second identifier, the knowledge graph includes multiple first entities for indicating items and multiple second entities for indicating item attributes, the first identifier indicates the item to be recommended, the second identifier indicates the item or item attribute involved in the user history record, the knowledge graph includes a first entity corresponding to the first identifier, and a first entity or a second entity corresponding to the second identifier; running a neural network based on the knowledge graph, the first identifier, and the second identifier to obtain an evaluation result, the evaluation result includes the probability of the item to be recommended being recommended, the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain an evaluation result, the first direction starts from the first entity corresponding to the first identifier, and the second direction starts from the first entity or the second entity corresponding to the second identifier.
[0030] In an embodiment of the present application, a neural network can be run based on the knowledge graph, the first identifier, and the second identifier to obtain the probability of the item to be recommended being recommended, wherein the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain the probability of the item to be recommended being recommended, providing a new recommendation method. In actual applications, multiple items to be recommended will be calculated based on at least one direction of the knowledge graph and at least the first and second directions to obtain multiple probabilities, and then sorted based on the probabilities to obtain the final evaluation result. In this way, several recommended items can be preset, so more accurate recommended items can be given.
[0031] Optionally, in a possible implementation of the second aspect, the evaluation results in the above steps also include a probability corresponding to a path in the knowledge graph when the item to be recommended is recommended, where one end of the path is a first entity corresponding to the first identifier, and the other end of the path is a first entity corresponding to the second identifier.
[0032] Optionally, in a possible implementation of the second aspect, the above steps run a neural network based on the knowledge graph, the first identifier and the second identifier to obtain an evaluation result, including: extracting multiple paths in the knowledge graph based on the knowledge graph, the first identifier and the second identifier, each path indicating the association between entities at both ends of the path, one end of each path corresponding to the item to be recommended, and the other end corresponding to the item or item attribute involved in the user's historical record; inputting the multiple paths into the neural network to score the multiple items to be recommended, so that the neural network obtains an evaluation result, the neural network is used to calculate based on the first direction and the second direction of each of the multiple paths to obtain a probability, for a path, the first direction is one end of the path pointing to the other end of the path, and the second direction is the other end of the path pointing to one end of the path.
[0033] In this possible implementation, multiple paths can be input into a neural network to score multiple items to be recommended, so that the neural network obtains an evaluation result in a manner that considers both directions of the path when scoring, which is more accurate than the evaluation result obtained from only a single direction in the prior art.
[0034] Optionally, in a possible implementation of the second aspect, the above steps run a neural network based on the knowledge graph, the first identifier and the second identifier to obtain an evaluation result, including: inputting the knowledge graph, the first identifier and the second identifier into the neural network; the neural network extracts multiple paths in the knowledge graph based on the knowledge graph, the first identifier and the second identifier, each path indicating the association between entities at both ends of the path, one end of each path corresponds to an item to be recommended, and the other end corresponds to an item or item attribute involved in the user's historical record; scoring multiple items to be recommended corresponding to the multiple paths based on the first direction and the second direction of each of the multiple paths, so that the neural network obtains an evaluation result, for a path, the first direction is one end of the path pointing to the other end of the path, and the second direction is the other end of the path pointing to one end of the path.
[0035] In this possible implementation, multiple recommended items corresponding to multiple paths can be scored based on the first direction and the second direction of each of the multiple paths, so that both directions of the paths are considered during scoring, which is more accurate than the evaluation result obtained from only a single direction in the prior art.
[0036] Optionally, in a possible implementation of the second aspect, the first direction of the above step is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector that points from the first entity indicating the item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector that points from the first entity of the item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector that points from the second entity of the item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of the item attribute involved in the user's historical record in the path; scoring multiple items to be recommended corresponding to multiple paths based on the first and second directions of each of the multiple paths, including: respectively calculating the probability that the first vector and the second vector of each path converge to an entity included in each path.
[0037] In this possible implementation, the probability of overlap of the information of the left and right flows in the path in the embedding space is calculated, and the overlap probability feature of the aggregation node is calculated. The overlap probability feature is used to output a semantic-level explanation, that is, the user's preference for a certain entity node. The user's interest point can be accurately found.
[0038] Optionally, in a possible implementation manner of the second aspect, the above steps of respectively calculating the probability that the first vector and the second vector of each path converge to an entity included in each path include:
[0039]
[0040] Among them, p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the recommended item and the items or item attributes involved in a user's historical record.
[0041] Optionally, in a possible implementation manner of the second aspect, the neural network in the above-mentioned steps is obtained by taking training samples as input of the neural network and training the neural network with the value of the loss function being less than a threshold as the goal, the training samples include multiple training paths, or the training samples include a knowledge graph for training, a first training identifier, and a second training identifier, the items indicated by the first training identifier and the items or item attributes indicated by the second training identifier are items or item attributes involved in the user's historical items; the loss function includes a first loss function, and the first loss function is used to indicate the difference between an evaluation result output by the neural network and a target result, and the target result is related to the items or item attributes involved in the user's historical records.
[0042] In this possible implementation, the neural network is trained by using the first loss function, so that the recommendation results are more accurate and in line with the user's preferences.
[0043] Optionally, in a possible implementation of the second aspect, the loss function in the above step also includes a second loss function, and the second loss function is used to indicate the difference between the word vectors between the first training vector and the second training vector in the training path of the knowledge graph used for training, and the two ends of the training path correspond to the items or item attributes involved in the user's historical records.
[0044] In this possible implementation, the purpose of the second loss function is to minimize the calculation error of the path flowing to the same node on the left and right, so that in the higher-dimensional relationship matrix in the embedding space, the word vector calculated on the left is as equal as possible to the word vector calculated on the right. That is, the second loss function can minimize the error of the two ends of the path flowing to the same node, which can solve the problem of the two ends of the path flowing to the same node in complex relationships.
[0045] Optionally, in a possible implementation of the second aspect, the loss function in the above step also includes a third loss function, and the third loss function is used to indicate the difference between the calculated word vector of the first entity and the true word vector of the first entity, and / or to indicate the difference between the calculated word vector of the second entity and the true word vector of the second entity.
[0046] In this possible implementation, the third loss function can minimize the error in mapping the vectors of the head and tail nodes of the triplet to a relational space, thereby solving the problem of one-to-many and many-to-one existence of a single triplet in a complex relationship.
[0047] A third aspect of an embodiment of the present application provides a recommendation device, which includes: an acquisition unit, used to acquire a knowledge graph, the knowledge graph including multiple first entities for indicating items and multiple second entities for indicating item attributes; an operation unit, used to operate a neural network based on the knowledge graph and user information to obtain a recommendation result, the user information indicates items or item attributes involved in the user's historical record, the recommendation result includes a recommended item, the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain a recommendation result, the first direction starts from a first entity indicating a recommended item or an item to be recommended, the second direction starts from a first entity indicating an item involved in the user's historical record, or the second direction starts from a second entity indicating an item attribute involved in the user's historical record.
[0048] Optionally, in a possible implementation manner of the third aspect, the recommendation result further includes an explanation of the recommended item, and the explanation is related to a first direction and a second direction.
[0049] Optionally, in a possible implementation manner of the third aspect, the operating unit of the above-mentioned communication device is specifically used to extract multiple paths in the knowledge graph based on the knowledge graph and user information, each path indicates the association between entities at both ends of the path, one end of each path corresponds to the item to be recommended, and the other end corresponds to the item or item attribute involved in the user's historical record; the operating unit is specifically used to input the multiple paths into the neural network to score the multiple items to be recommended, so that the neural network obtains a recommendation result, and the neural network is used to calculate based on the first direction and the second direction of each of the multiple paths to obtain the recommendation result, for a path, the first direction is one end of the path pointing to the other end of the path, and the second direction is the other end of the path pointing to one end of the path.
[0050] Optionally, in a possible implementation of the third aspect, the operating unit of the above-mentioned communication device is specifically used to input the knowledge graph and the user's information into the neural network; the operating unit is specifically used for the neural network to extract multiple paths in the knowledge graph based on the knowledge graph and the user's information, each path indicates the association between entities at both ends of the path, one end of each path corresponds to the item to be recommended, and the other end corresponds to the item or item attribute involved in the user's historical record; the operating unit is specifically used to score the multiple items to be recommended based on the first direction and the second direction of each of the multiple paths, so that the neural network obtains a recommendation result, for a path, the first direction is one end of the path pointing to the other end of the path, and the second direction is the other end of the path pointing to one end of the path.
[0051] Optionally, in a possible implementation of the third aspect, the first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector that points from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector that points from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector that points from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of an item attribute involved in the user's historical record in the path; the operating unit is specifically used to score the item to be recommended corresponding to each path in the multiple paths based on the probability that the first vector and the second vector of each path converge to an entity in each path, so as to obtain the recommended item.
[0052] Optionally, in a possible implementation of the third aspect, the operating unit of the above-mentioned communication device is also used to score the multiple paths based on the first direction and the second direction of each of the multiple paths to obtain an explanation of the recommendation result, and the explanation is a description of the association between the entities at both ends indicated by one or more paths that obtain the recommendation result.
[0053] Optionally, in a possible implementation of the third aspect, the first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector that points from the first entity indicating the item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector that points from the first entity of the item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector that points from the second entity of the item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of the item attribute involved in the user's historical record in the path; the running unit is specifically used to calculate the probability that the first vector and the second vector of each path converge to an entity included in each path, so as to obtain an explanation of the recommendation result.
[0054] Optionally, in a possible implementation manner of the third aspect, the operating unit of the communication device is specifically configured to calculate the probability that the first vector and the second vector of each path are converged to an entity included in each path by using the following formula:
[0055]
[0056] Among them, p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the recommended item and the items or item attributes involved in a user's historical record.
[0057] Optionally, in a possible implementation manner of the third aspect, the above-mentioned neural network is obtained by taking training samples as input of the neural network and training the neural network with the value of the loss function being less than a threshold as the goal, the training samples include multiple training paths, or the training samples include a knowledge graph used for training, items and / or item attributes involved in the user's historical records used for training, each training path indicates the association between entities at both ends of the training path, and both ends of each training path correspond to items or item attributes involved in the user's historical records; the loss function includes a first loss function, and the first loss function is used to indicate the difference between the recommendation result output by the neural network and the target result, and the target result is related to the items or item attributes involved in the user's historical records.
[0058] Optionally, in a possible implementation of the third aspect, the above-mentioned loss function also includes a second loss function, and the second loss function is used to indicate the difference between the word vectors between the first training vector and the second training vector in the training path of the knowledge graph used for training, and the two ends of the training path correspond to the items or item attributes involved in the user's historical records.
[0059] Optionally, in a possible implementation of the third aspect, the above-mentioned loss function also includes a third loss function, which is used to indicate the difference between the calculated word vector of the first entity and the true word vector of the first entity, and / or to indicate the difference between the calculated word vector of the second entity and the true word vector of the second entity.
[0060] A fourth aspect of an embodiment of the present application provides a recommendation device, which includes: an acquisition unit, used to acquire a knowledge graph, a first identifier and a second identifier, the knowledge graph including multiple first entities for indicating items and multiple second entities for indicating item attributes, the first identifier indicates an item to be recommended, the second identifier indicates an item or item attribute involved in a user history record, the knowledge graph includes a first entity corresponding to the first identifier, and a first entity or a second entity corresponding to the second identifier; an operation unit, used to operate a neural network based on the knowledge graph, the first identifier and the second identifier to obtain an evaluation result, the evaluation result includes a probability of the item to be recommended being recommended, the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain an evaluation result, the first direction starts from a first entity corresponding to the first identifier, and the second direction starts from the first entity or the second entity corresponding to the second identifier.
[0061] Optionally, in a possible implementation of the fourth aspect, the above-mentioned evaluation results also include, when the item to be recommended is recommended, a probability corresponding to a path in the knowledge graph, one end of the path is a first entity corresponding to the first identifier, and the other end of the path is a first entity corresponding to the second identifier.
[0062] Optionally, in a possible implementation manner of the fourth aspect, the operating unit of the above-mentioned communication device is specifically used to extract multiple paths in the knowledge graph based on the knowledge graph, the first identifier and the second identifier, each path indicating the association between entities at both ends of the path, one end of each path corresponds to the item to be recommended, and the other end corresponds to the item or item attribute involved in the user's historical record; the operating unit is specifically used to input the multiple paths into the neural network to score the multiple items to be recommended, so that the neural network obtains an evaluation result, and the neural network is used to calculate based on the first direction and the second direction of each of the multiple paths to obtain a probability, for a path, the first direction is one end of the path pointing to the other end of the path, and the second direction is the other end of the path pointing to one end of the path.
[0063] Optionally, in a possible implementation manner of the fourth aspect, the operating unit of the above-mentioned communication device is specifically used to input the knowledge graph, the first identifier and the second identifier into the neural network; the operating unit is specifically used for the neural network to extract multiple paths in the knowledge graph based on the knowledge graph, the first identifier and the second identifier, each path indicating the association between entities at both ends of the path, one end of each path corresponds to the item to be recommended, and the other end corresponds to the item or item attribute involved in the user's historical record; the operating unit is specifically used to score the multiple items to be recommended corresponding to the multiple paths based on the first direction and the second direction of each of the multiple paths, so that the neural network obtains an evaluation result, for a path, the first direction is one end of the path pointing to the other end of the path, and the second direction is the other end of the path pointing to one end of the path.
[0064] Optionally, in a possible implementation of the fourth aspect, the first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector that points from the first entity indicating the item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector that points from the first entity of the item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector that points from the second entity of the item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of the item attribute involved in the user's historical record in the path; the running unit is specifically used to respectively calculate the probability that the first vector and the second vector of each path converge to an entity included in each path.
[0065] Optionally, in a possible implementation manner of the fourth aspect, the operating unit of the communication device is specifically configured to calculate the probability that the first vector and the second vector of each path are converged to an entity included in each path by using the following formula:
[0066]
[0067] Among them, p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the recommended item and the items or item attributes involved in a user's historical record.
[0068] Optionally, in a possible implementation manner of the fourth aspect, the above-mentioned neural network is obtained by taking training samples as input of the neural network and training the neural network with the value of the loss function being less than a threshold as the goal, the training samples include multiple training paths, or the training samples include a knowledge graph for training, a first training identifier and a second training identifier, the items indicated by the first training identifier and the items or item attributes indicated by the second training identifier are items or item attributes involved in the user's historical items; the loss function includes a first loss function, and the first loss function is used to indicate the difference between an evaluation result output by the neural network and a target result, and the target result is related to the items or item attributes involved in the user's historical records.
[0069] Optionally, in a possible implementation of the fourth aspect, the above-mentioned loss function also includes a second loss function, and the second loss function is used to indicate the difference between the word vectors between the first training vector and the second training vector in the training path of the knowledge graph used for training, and the two ends of the training path correspond to the items or item attributes involved in the user's historical records.
[0070] Optionally, in a possible implementation of the fourth aspect, the above-mentioned loss function also includes a third loss function, which is used to indicate the difference between the calculated word vector of the first entity and the true word vector of the first entity, and / or to indicate the difference between the calculated word vector of the second entity and the true word vector of the second entity.
[0071] A fifth aspect of an embodiment of the present application provides a recommendation device, which or a component of the recommendation device (such as a processor, a chip, or a chip system) executes the method in the aforementioned first aspect or any possible implementation manner of the first aspect.
[0072] A sixth aspect of an embodiment of the present application provides a recommendation device, which or a component of the recommendation device (such as a processor, a chip, or a chip system) executes the method in the aforementioned second aspect or any possible implementation manner of the second aspect.
[0073] A seventh aspect of an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a computer, the computer executes the method in the aforementioned first aspect or any possible implementation of the first aspect, the second aspect or any possible implementation of the second aspect.
[0074] An eighth aspect of an embodiment of the present application provides a computer program product. When the computer program product is executed on a computer, it enables the computer to execute the method in the aforementioned first aspect or any possible implementation of the first aspect, the second aspect or any possible implementation of the second aspect.
[0075] A ninth aspect of an embodiment of the present application provides a recommendation device, including: a processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instructions are executed by the processor, the device implements the method in the above-mentioned first aspect or any possible implementation of the first aspect.
[0076] The tenth aspect of an embodiment of the present application provides a recommendation device, including: a processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instructions are executed by the processor, the device implements the method in the above-mentioned second aspect or any possible implementation of the second aspect.
[0077] Among them, the technical effects brought about by the third, fifth, seventh, eighth, and ninth aspects or any possible implementation methods thereof can refer to the technical effects brought about by the first aspect or different possible implementation methods of the first aspect, and will not be repeated here.
[0078] Among them, the technical effects brought about by the fourth, sixth, seventh, eighth, and tenth aspects or any possible implementation methods thereof can refer to the technical effects brought about by the second aspect or different possible implementation methods of the second aspect, and will not be repeated here.
[0079] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: obtaining a knowledge graph, and running a neural network based on the knowledge graph and the user's information to obtain recommendation results. Compared with the recommendation results obtained in the prior art by only calculating from the user's historical records as the starting point (that is, the recommendation results calculated in the prior art are calculated from a single direction). The present invention is based on at least one first direction and at least one second direction in the knowledge graph to obtain recommendation results, and provides a new recommendation method that calculates from two directions to obtain more accurate recommendation results, that is, to improve the precision and / or recall of the recommendation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0081] Figure 1 A schematic diagram of a recommended network architecture provided for an embodiment of the present application;
[0082] Figure 2 A schematic diagram of the architecture of the product implementation provided in the embodiment of the present application;
[0083] Figure 3Another schematic diagram of a system architecture provided for an embodiment of the present application;
[0084] Figure 4 A schematic diagram of a structure of a recommendation network provided in an embodiment of the present application;
[0085] Figure 5 A schematic diagram of the structure of a neural network processor provided in an embodiment of the present application;
[0086] Figure 6 A schematic diagram of a structure of a recommendation network provided in an embodiment of the present application;
[0087] Figure 7 A schematic diagram of a structure of a path in a movie recommendation scenario provided in an embodiment of the present application;
[0088] Figure 8 A flowchart of a recommended method provided in an embodiment of the present application;
[0089] Fig. 9 Another flowchart of the recommended method provided in the embodiment of the present application;
[0090] Fig.10 Another structural schematic diagram of a path in a movie recommendation scenario provided in an embodiment of the present application;
[0091] Fig.11 A schematic diagram showing a game recommendation scenario provided in an embodiment of the present application;
[0092] Fig.12 A schematic diagram showing the comparison of the accuracy of the recommendation network provided in the embodiment of the present application and the existing recommendation model;
[0093] Fig.13 A schematic diagram showing the comparison results of the recall rate between the recommendation network provided in the embodiment of the present application and the existing recommendation model;
[0094] Figure 14-16 These are several structural schematic diagrams of the devices recommended in the embodiments of this application. DETAILED DESCRIPTION
[0095] The embodiment of the present application provides a recommendation method, a recommendation network and related devices, which can run a neural network based on a knowledge graph and user information to obtain a recommendation result, wherein the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain a recommendation result, and provides a new recommendation method, which can obtain a more accurate recommendation result, that is, improve the precision and / or recall rate of the recommendation result. It can be applied to scenarios such as movie recommendations and game recommendations to recommend items to users.
[0096] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0097] The recommendation method provided in the embodiment of the present application can be applied to scenarios where items need to be recommended, such as movie recommendation, product recommendation, music recommendation, restaurant recommendation, book recommendation, web page recommendation, etc. The following briefly describes the movie recommendation scenario and the game recommendation scenario.
[0098] 1. Movie recommendation scenes.
[0099] Through the recommendation method provided in this embodiment, the neural network performs bidirectional conduction calculations (described in detail below) and concludes that when a user is a fan of Director 1 and also a fan of Actor 1, then recommending the movie "Movie 1" to him will greatly improve the user's satisfaction with the recommendation results.
[0100] 2. Game recommended scenarios.
[0101] In the scenario of recommending games to users, for example, there are many complex relationships between the recommended game 1 and the user's historical records of playing the game.
[0102] Some terms or concepts involved in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0103] 1. Neural network.
[0104] A neural network can be composed of neural units. A neural unit can be a s The output of the operation unit with the intercept 1 as input can be:
[0105]
[0106] Where, s = 1, 2, ... n, n is a natural number greater than 1, W s For X s The weight of the neural unit, b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer. The activation function can be a sigmoid function. A neural network is a network formed by connecting many of the above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0107] 2. Deep neural network.
[0108] A deep neural network (DNN), also known as a multi-layer neural network, can be understood as a neural network with many hidden layers. There is no special metric for "many" here. According to the position of different layers of DNN, the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer. Of course, a deep neural network may not include hidden layers, which is not limited here.
[0109] The work of each layer in a deep neural network can be expressed mathematically as To describe: From a physical level, the work of each layer in a deep neural network can be understood as completing the transformation from input space to output space (i.e., from row space to column space of a matrix) through five operations on the input space (a set of input vectors). These five operations include: 1. Dimension increase / reduction; 2. Enlargement / reduction; 3. Rotation; 4. Translation; 5. "Bending". Operations 1, 2, and 3 are represented by Completed, the operation of 4 is done by Completed, operation 5 is implemented by α(). The word "space" is used here because the classified object is not a single thing, but a class of things, and space refers to the set of all individuals of this class of things. Among them, W is a weight vector, and each value in the vector represents the weight value of a neuron in this layer of the neural network. The vector W determines the spatial transformation from the input space to the output space described above, that is, the weight W of each layer controls how to transform the space. The purpose of training a deep neural network is to eventually obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by many layers of vectors W). Therefore, the training process of a neural network is essentially to learn how to control spatial transformation, and more specifically to learn the weight matrix.
[0110] 3. Loss function.
[0111] In the process of training a deep neural network, because we hope that the output of the deep neural network is as close as possible to the value we really want to predict, we can compare the predicted value of the current network with the target value we really want, and then update the weight vector of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it predict lower, and keep adjusting until the neural network can predict the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the deep neural network becomes a process of minimizing this loss as much as possible.
[0112] 4. Word vector (Embedding).
[0113] Word vectors can also be called "word embedding", "vectorization", "vector mapping", "embedding", etc. Formally speaking, word vectors use a dense vector to represent an object, for example: using a vector to represent a user's identity document (ID), an item ID, etc.
[0114] 5. Knowledge graph (KG).
[0115] The knowledge graph is a semantic network that contains multiple entities and the relationships between entities. Entities are the most basic elements in the knowledge graph, where entities can be divided into first entities and second entities. The first entity is an entity used to indicate an item, and the second entity is an entity used to indicate the attributes of an item. In one implementation, the second entity is directly connected to the first entity, that is, the first entity and the second entity are arranged in an alternating manner.
[0116] Item: It is something that is distinguishable and exists independently, such as a city, a commodity, a movie, a game, etc.
[0117] Item attributes: can be regarded as the description, explanation, content, attributes, etc. of an item. Generally, the entity of an item attribute is a one-hop node directly connected to the entity of the item. For example, in the movie recommendation scenario, the movie genre of "Movie 1" is history, where "Movie 1" is equivalent to the first entity, used to indicate the movie, history is equivalent to the second entity, used to indicate the attribute of the movie, and the movie genre is the relationship between the first entity and the second entity.
[0118] 6. Triplet.
[0119] A concept in computer data structure. It is mainly used to store a compression method for sparse matrices, also called a triple table. For example, a triple consists of: entity 1 (can be called a node), the relationship between entity 1 and entity 2 (can also be called an edge), and entity 2 (can be called a node) to form a triple stored in the computer.
[0120] 7. Knowledge Representation (KG Embedding).
[0121] The main purpose is to embed the entities and relations in the knowledge graph into a continuous vector space.
[0122] 8. Cross entropy.
[0123] Cross entropy is a commonly used concept in deep learning. It is generally used to find the gap between the target value and the predicted value. Cross entropy is often used as the loss function of the neural network.
[0124] 9. L2 norm.
[0125] Also known as the Euclidean norm, it represents the Euclidean distance from the origin to the point determined by the vector X.
[0126] 10. Area under the receiver operating characteristic curve (ROC) (area under curve, AUC).
[0127] AUC is a performance indicator to measure the quality of a learner, and can quantify the classification ability expressed by the ROC curve. This classification ability is closely related to probability and threshold. The larger the AUC, the more reasonable the output probability and the more reasonable the ranking result.
[0128] 11. Recommendation accuracy rate.
[0129] Recommendation accuracy rate = number of correct information recommended / number of recommended information.
[0130] 12. Recommendation recall rate.
[0131] Recommendation recall rate = number of correct pieces of information recommended / number of pieces of information in the sample.
[0132] The neural network with recommendation function in the embodiment of the present application can also be understood as a recommendation network. In order to distinguish it from the original neural network, the neural network with recommendation function will be replaced with the recommendation network for description below.
[0133] In order to better understand the recommendation method, recommendation network and related devices disclosed in the embodiment of the present application, the system architecture used in the embodiment of the present invention is described below. Figure 1 , an embodiment of the present invention provides a recommended network architecture 100.
[0134] The recommendation method provided in the present application can be applied to the conduction calculation and loss function modules of the recommendation network architecture 100. The recommendation network architecture is a general framework for neural network training for recommendation systems, and has been increasingly widely used in recent years.
[0135] In order to solve the problem of how to obtain highly accurate recommendation results through bidirectional conduction during the calculation process of data in the embedded space, the conduction calculation module runs the recommendation network based on the knowledge graph and user information to obtain the recommendation results, which include the recommended items (or the identification of the recommended items).
[0136] The recommendation network provided in this application may be a neural network, specifically a deep neural network.
[0137] Optionally, the conduction calculation module can also solve the problem of how to obtain highly semantic interpretation information during the calculation of data in the embedding space. It takes the path as input and performs bidirectional conduction calculations from both ends of the path to calculate highly semantic interpretations at the confluence of the nodes.
[0138] The loss function module solves the problem that the accuracy of recommendations cannot be guaranteed during the training of the recommendation network. This application adds a path loss function and a node loss function, which enables the model to converge quickly while greatly improving performance indicators such as recommendation accuracy and recall, and improving the reliability of recommendation results and explanations.
[0139] The knowledge graph module is used to construct a knowledge graph or obtain an existing knowledge graph. For the description of the knowledge graph, please refer to the previous description.
[0140] The new user processing module is used to recommend some items to users through some strategies (such as random method) when there is no history record of new users, and then quickly get feedback information (such as the ID of the item clicked by the user, item attributes and other node information). Then, this data is input into the network for more accurate recommendations.
[0141] The data acquisition module is used to acquire user information, where the user information indicates items (also referred to as historical items) or item attributes (also referred to as historical item attributes) involved in the user's historical records.
[0142] Optionally, the data acquisition module can also be used to acquire user information, item information and related external knowledge, including but not limited to item attribute information (e.g., director, actor, type of movie; developer, operator, classification of game; components, time, place, who of news, etc.), user dimension features (e.g., user age, occupation, etc.), to construct knowledge graph.
[0143] The data storage module is used to store the above-mentioned related data, which is not limited here.
[0144] See also Figure 2 , Figure 2 This is a schematic diagram of the architecture of the product implemented in the embodiment of the present application. The product can be included in the recommended network architecture and can be deployed as program code on server hardware. Figure 1 Taking the recommendation network architecture shown as an example, the program code of the present application can exist in the recommendation network. When the program is running, the program code of the present application can run with the host storage and acceleration hardware {graphic processing unit (GPU), field programmable gate array (FGPA) or dedicated chip} memory of the server. The recommendation device is a device provided by the present application, which is used to input data, output recommended items and / or output explanations.
[0145] See attached Figure 3, an embodiment of the present invention provides another system architecture 300. As shown in the system architecture 300, a data collection device 360 is used to collect training samples. In the embodiment of the present application, the training samples include multiple training paths; or the training samples include a knowledge graph for training, a first training identifier and a second training identifier, and the items indicated by the first training identifier and the items or item attributes indicated by the second training identifier are items or item attributes indicated by the user's historical items; or the training samples include a knowledge graph for training, items and / or item attributes involved in the user's historical records for training, and each training path indicates the association between entities at both ends of the training path, and both ends of each training path correspond to items or item attributes involved in the user's historical records. The training samples are stored in a database 330, and a training device 320 obtains a target model / rule 301 based on the training samples maintained in the database 330. The target model / rule 301 can be used to implement the recommendation method provided in the embodiment of the present application, that is, to run a recommendation network based on the knowledge graph and the user's information to obtain a recommendation result, which includes a recommended item, and the user's information indicates items or item attributes involved in the user's historical records. Furthermore, the recommendation result may also include an explanation of the recommended item. The target model / rule 301 in the embodiment of the present application may specifically be a recommendation network, or a neural network. In the embodiment provided in the present application, the recommendation network is obtained by training training samples. It should be noted that in actual applications, the training samples maintained in the database 330 do not necessarily all come from the data acquisition device 360, but may also be received from other devices. It should also be noted that the training device 320 does not necessarily train the target model / rule 301 entirely based on the training data maintained by the database 330, but may also obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.
[0146] The target model / rule 301 obtained by training the training device 320 can be applied to different systems or devices, such as Figure 3 The execution device 310 shown in the figure may be a terminal, such as a mobile phone terminal, a tablet computer, a notebook computer, a vehicle terminal, etc., or a server or a cloud. Figure 3In the embodiment, the execution device 310 is configured with an I / O interface 312 for data interaction with an external device. The user can input data to the I / O interface 312 through the client device 340. In the embodiment of the present application, the input data may include: multiple paths; the input data may also include knowledge graphs and user information; the input data may also include knowledge graphs. The first identifier and the second identifier, wherein the first identifier indicates the item to be recommended, and the second identifier indicates the item or item attribute involved in the user's historical record. The input data may also come from a database, which is not limited here.
[0147] The preprocessing module 313 is used to preprocess the input data received by the I / O interface 312. In the embodiment of the present application, the preprocessing module 313 can be used to randomly recommend some items to the user, and then determine the historical items (it can also be understood that the historical items are items involved in the user's historical records) based on the user's feedback. The preprocessing module 313 can be used to extract multiple paths in the knowledge graph based on the knowledge graph and the user's information, and send the extracted paths to the calculation module 311.
[0148] When the execution device 310 preprocesses the input data, or when the computing module 311 of the execution device 310 performs calculations and other related processing, the execution device 310 can call the data, code, etc. in the data storage system 350 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing into the data storage system 350.
[0149] Finally, the I / O interface 312 returns the processing result, such as the recommendation result obtained above, to the client device 340 for providing to the user.
[0150] It is worth noting that the training device 320 can generate corresponding target models / rules 301 based on different training data for different goals or different tasks. The corresponding target models / rules 301 can be used to achieve the above goals or complete the above tasks, thereby providing users with the desired results.
[0151] In the attached Figure 3In the case shown in the figure, the user can manually give input data, and the manual giving can be operated through the interface provided by the I / O interface 312. In another case, the client device 340 can automatically send input data to the I / O interface 312. If the client device 340 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 340. The user can view the results output by the execution device 310 on the client device 340, and the specific presentation form can be a specific method such as display, sound, action, etc. The client device 340 can also be used as a data acquisition terminal to collect the input data of the input I / O interface 312 and the output results of the output I / O interface 312 as new sample data, and store them in the database 330. Of course, it is also possible not to collect through the client device 340, but the I / O interface 312 directly stores the input data of the input I / O interface 312 and the output results of the output I / O interface 312 as new sample data in the database 330.
[0152] It is worth noting that Figure 3 This is only a schematic diagram of a system architecture provided by an embodiment of the present invention. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. Figure 3 In the embodiment, the data storage system 350 is an external memory relative to the execution device 310. In other cases, the data storage system 350 can also be placed in the execution device 310.
[0153] like Figure 3 As shown, the target model / rule 301 is obtained through training by the training device 320. The target model / rule 301 may be a recommendation network in the embodiment of the present application. Specifically, the recommendation network provided in the embodiment of the present application may be a deep neural network.
[0154] The following introduces a chip hardware structure provided by an embodiment of the present application.
[0155] Figure 4 A chip hardware structure provided in an embodiment of the present invention includes a neural network processor 40. The chip can be arranged as follows: Figure 3 In the execution device 310 shown in FIG. 1 , the calculation module 311 is used to complete the calculation work. The chip can also be set in Figure 3 The training device 320 shown is used to complete the training work of the training device 320 and output the target model / rule 301.
[0156] The neural network processor 40 can be a neural network processor (neural-network processing unit, NPU), a tensor processing unit (tensor processing unit, TPU), or a graphics processing unit (graphics processing unit, GPU) and any other processor suitable for large-scale XOR operation processing. Take NPU as an example: the neural network processor NPU40 is mounted on the main central processing unit (central processing unit, CPU) (host CPU) as a coprocessor, and the main CPU assigns tasks. The core part of the NPU is the operation circuit 403, and the controller 404 controls the operation circuit 403 to extract data from the memory (weight memory or input memory) and perform operations.
[0157] In some implementations, the operation circuit 403 includes multiple processing units (process engines, PEs) inside. In some implementations, the operation circuit 403 is a two-dimensional systolic array. The operation circuit 403 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 403 is a general-purpose matrix processor.
[0158] For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory 402 and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 401 and performs matrix operation with matrix B, and the partial result or final result of the matrix is stored in the accumulator 408.
[0159] The vector calculation unit 407 can further process the output of the operation circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. For example, the vector calculation unit 407 can be used for network calculations of non-convolutional / non-FC layers in a neural network, such as pooling, batch normalization, local response normalization, etc.
[0160] In some implementations, the vector calculation unit 407 can store the processed output vector to the unified buffer 406. For example, the vector calculation unit 407 can apply a nonlinear function to the output of the operation circuit 403, such as a vector of accumulated values, to generate an activation value. In some implementations, the vector calculation unit 407 generates a normalized value, a merged value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 403, such as for use in a subsequent layer in a neural network.
[0161] The unified memory 406 is used to store input data and output data.
[0162] The weight data is directly transferred from the external memory to the input memory 401 and / or the unified memory 406 through the direct memory access controller (DMAC) 405, the weight data in the external memory is stored in the weight memory 402, and the data in the unified memory 506 is stored in the external memory.
[0163] The bus interface unit (BIU) 410 is used to implement the interaction between the main CPU, DMAC and instruction fetch memory 409 through the bus.
[0164] An instruction fetch buffer 409 connected to the controller 404 is used to store instructions used by the controller 404 .
[0165] The controller 404 is used to call the instructions cached in the memory 409 to control the working process of the computing accelerator.
[0166] Generally, the unified memory 406, the input memory 401, the weight memory 402 and the instruction fetch memory 409 are all on-chip memories, and the external memory is a memory outside the NPU, which can be a double data rate synchronous dynamic random access memory (DDR SDRAM), a high bandwidth memory (HBM) or other readable and writable memory.
[0167] The following is a detailed introduction to the training method and recommendation method of the recommendation network according to the embodiment of the present application in conjunction with the accompanying drawings.
[0168] First, combine Figure 5The training method of the recommendation network in the embodiment of the present application is introduced in detail. Figure 5 The method shown can be executed by a training device for a recommendation network, which can be a cloud service device or a terminal device, for example, a computer, a server, or other device with sufficient computing power to execute the training method for the recommendation network, or a system composed of a cloud service device and a terminal device. Figure 3 Training equipment in 320, Figure 4 The neural network processor 40 in is executed.
[0169] Optionally, the training method can be processed by a CPU, or by a CPU and a GPU together, or other processors suitable for neural network calculations can be used without a GPU, and this application does not impose any restrictions.
[0170] The training method includes step 501 and step 502. Step 501 and step 502 are described in detail below.
[0171] Step 501: Obtain training samples.
[0172] There are many cases of training samples in the embodiments of the present application, which are described below respectively:
[0173] 1. The training samples include multiple training paths.
[0174] Each training path indicates the association between entities at both ends of the training path, and both ends of each training path correspond to items or item attributes involved in the user's historical records.
[0175] In the embodiment of the present application, the items or item attributes involved in the positive events of the user's historical records can be understood as the items or item attributes indicated by the first entity or the second entity that the user has been involved in the positive event. Among them, a positive event means that the user does not explicitly express a negative or negative intention (that is, dislike, disinterest, unwillingness to pay attention) in the event, or expresses positive intentions such as attention, liking, and interest. For example, items or item attributes that users click, forward, pay attention to, comment, encourage (such as coin, like), collect, browse, and browse for more than a threshold time are all positive events, while users clicking "step on", clicking "don't want to see", clicking "not interested", and selecting "don't appear on my homepage" are negative events. The items or item attributes involved in such historical records should be eliminated and should be avoided from being entered.
[0176] 2. The training samples include the knowledge graph used for training and the items or item attributes involved in the user's historical records used for training.
[0177] Optionally, the knowledge graph used in training and the knowledge graph used in a specific recommendation process may be the same or different, and this is not specifically limited here.
[0178] Optionally, the training knowledge graph includes multiple triples, which are connected by the same entity.
[0179] 3. The training sample includes a knowledge graph used for training, a first training identifier, and a second training identifier.
[0180] The item indicated by the first training identifier and the item or item attribute indicated by the second training identifier are items (which may be called historical items) or item attributes (which may also be called historical item attributes) related to the user's historical items.
[0181] The identifiers (first identifier, second identifier, first training identifier, second training identifier) in the embodiments of the present application may be IDs or names, etc., and are not specifically limited here.
[0182] There are many situations of training samples in the embodiments of the present application. The above instructions are examples. It can be understood that in practical applications, the training samples can be adaptively adjusted as needed, and the specifics are not limited here.
[0183] The items in the embodiments of the present application (items to be recommended, recommended items, items involved in the user's historical records for training) can be movies, games, music, news, etc., and are not specifically limited here.
[0184] The relationship between two entities in the embodiment of the present application can be the type of movie, starring actor, director, screenwriter, etc., or the developer, publisher, operating platform, game type, hairstyle year, etc. of the game, or the singer, arranger, lyricist, etc. of the music, which is not limited here.
[0185] Step 502: Using the training sample as the input of the recommendation network, training the recommendation network with the goal of making the value of the loss function less than a first threshold, and obtaining a trained recommendation network.
[0186] The recommendation network provided in the embodiment of the present application can be an independent recommendation system with its own explanation information, or it can output explanation information for an existing recommendation system. That is, the recommendation network provided in the embodiment of the present application can output explanations of recommended items, wherein the recommended items can be recommended items output by an existing recommendation system. Of course, the recommendation network provided in the embodiment of the present application can also output the scores of recommended items and explanations of recommended items or items to be recommended.
[0187] The structure of the recommendation network in the embodiment of the present application can refer to Figure 6, a recommended network structure provided by the present application may include bidirectional conduction (or bidirectional conduction calculation).
[0188] Bidirectional conduction can be understood as calculating from at least one first direction and at least one second direction to obtain a recommendation result (for details on the calculation process, see Figure 8 , Fig. 9 The first direction starts from a first entity indicating a recommended item or an item to be recommended. The second direction starts from a first entity indicating an item involved in the user's history record; or the second direction starts from a second entity indicating an attribute of an item involved in the user's history record.
[0189] Further, the plurality of items to be recommended are scored based on the first direction and the second direction of each of the plurality of paths, and TOPK is selected as the recommended item as needed, where K is an integer greater than 1.
[0190] Exemplarily, if K is 2, the recommended items corresponding to the first two scores among the multiple recommended items are determined as the recommended items.
[0191] Alternatively, bidirectional transmission can also be understood as starting from the left and right endpoints of the path and gradually calculating towards the intermediate nodes. The path is extracted from the knowledge graph based on the knowledge graph and the user's information.
[0192] Optionally, one end of the path corresponds to the item to be recommended, and the other end of the path corresponds to the item involved in the user's historical record (also understood as a historical item) or item attribute. The intermediate node can be an item or an item attribute, which is not specifically limited here.
[0193] In an embodiment of the present application, the user's information may include the user ID, items clicked by the user (which can also be understood as historical items) or item attributes, the user's age, occupation, and other user-related information.
[0194] Optionally, the bidirectional conduction may also score the multiple paths based on the first directions and the second directions of the multiple paths respectively, so as to obtain an explanation for the recommendation result.
[0195] Further, the multiple paths are scored based on the first direction and the second direction of each of the multiple paths, and TOPK is selected as the recommended item as needed, where K is an integer greater than 1.
[0196] In the embodiment of the present application, for a path, the first direction is that one end of the path points to the other end of the path, and the second direction is that the other end of the path points to one end of the path. One end of the path corresponds to the recommended item, and the other end of the path corresponds to the historical item or the attribute of the historical item.
[0197] Exemplarily, when K is 2, the paths corresponding to the first two scores among the multiple paths are determined as the explanation for the recommendation result, or the first two probabilities among the probabilities corresponding to the convergence points in the left and right directions among the multiple paths are determined as the explanation for the recommendation result.
[0198] Furthermore, the probability of overlap of the information of the left and right flows in the path in the embedding space is calculated, and the overlap probability feature of the convergence node is calculated. The overlap probability feature is used to output a semantic-level explanation, that is, the user's preference for a certain entity node. That is, the probability of the vectors of the two flows being converged together is calculated. It is expressed as the probability of the activated connection between the recommended item and the user's historical record (the item or item attribute clicked by the user) (the larger the probability, the more significant). The purpose of this is to find the user's interest point. For example: 8 of the 10 movies that user A has watched in the past were starred by actor Actor 2. In this case, the probability of the node "Actor 2" in the path will be significant. The overlap probability can be used as an explanation of the recommended item, that is, the entity node with semantics in the path (it can also be understood as the second entity corresponding to the item attribute), which can be used to describe the user's potential preferences (such as: the name of the director of the movie, the type of book, etc.). By performing operations (such as multiplication, etc.) on the word vectors of these attribute nodes and the probabilities of the corresponding activation paths, we can obtain the feedback information of a single path (for example, feedback information = probability value * word vector of actor 2 in the embedding space, that is, the feedback information can be v * probability value p).
[0199] Figure 6 The v in the figure represents the recommended item. A pairing block corresponds to a historical item i. The recommended item v is matched with multiple historical items (i1, i2, ..., i n ), there are multiple pairing blocks (pairing block 1, pairing block 2, ..., pairing block n) between a historical item i and a to-be-recommended item v, each path includes multiple entities e and a relationship R between the entities e, where e can be a first entity for indicating an item or a second entity for indicating an attribute of an item, and m is an integer greater than 1.
[0200] Below Figure 6 The bidirectional conduction calculation is introduced by taking the pairing block 1 in FIG.
[0201] Pairing block 1 corresponds to historical item i1, and there are m paths between it and the item to be recommended v, where the first path includes: vR 1st -e1-R 2nd -...-eR end -i1, the second path includes: vR 1st -e2-R 2nd -...-eR end -i1, the mth path includes: vR1st -e m -R 2nd -...-eR end -i1. R 1st Represents the relationship matrix between the recommended item v and entity e1, R 2nd Represents the relationship matrix between entity e1 and other entities e, R end Represents the relationship matrix between other entities e and historical items i1. For the first path in pairing block 1, calculating the bidirectional conduction calculation of the first path is equivalent to calculating the probability of the vectors of the left and right flows in the first path coming together, that is, the probability of the recommended item v and historical item i1 in the first path flowing to the intermediate entity.
[0202] Optionally, since one path corresponds to one probability, the probability can be used as the score of the path, and the scores can be selected from high to low according to the needs of TOPK to obtain an explanation of the recommended items. The denominator used to calculate the probability can be the sum of the m probabilities corresponding to the m paths in a pairing block. Of course, in order to avoid a single path causing a probability of 100%, which affects the accuracy of subsequent recommendations, the denominator of the probability calculation can also be the sum of the n*m probabilities corresponding to the n*m paths in the n pairing blocks. The specifics are not limited here.
[0203] The explanation in the embodiment of the present application may be a probability, or a description of the association between entities at both ends indicated by one or more paths to obtain the recommended items.
[0204] Among them, R 2nd It can also be R end , e2 is e m , that is, a path includes at least three entities (v, e, i) and two relationship matrices (R 1st , R end ). One pairing block corresponds to one u. After calculating the u of each pairing block, the user's feedback word vector u can be obtained by directly adding or accumulating the weighted sum.
[0205] In the embodiment of the present application, the score of the recommended item is only based on the distance between the recommended item and the feedback word vector (i.e. ) is used as an example for exemplary explanation. It can be understood that the score of the item to be recommended can also be u corresponding to a pairing block, and the score of the item to be recommended can also be the feedback word vector obtained by adding multiple pairing blocks, etc., which is not limited here.
[0206] Optionally, one pairing block corresponds to one u, so u can be used as the score of the item to be recommended, and the scores are selected from high to low according to the needs of TOPK to obtain the recommended items. Of course, the feedback word vector obtained by adding u corresponding to multiple pairing blocks can also be used as the score to select the recommended items, which is not limited here.
[0207] For example, the path of recommending item v and pairing block 1 is as follows: Figure 7 As shown, the recommended item v is "Movie 2", and the relationship matrix R 1st Including: the relationship matrix of the leading actor and the relationship matrix of the type, entity e1 is actor 2, entity e2 is actor 3, entity e3 is comedy, relationship matrix R end Including: the relationship matrix of the main actors and the relationship matrix of the types. Figure 7 The first path in includes: Movie 2-Starring-Actor 2-Starring-Movie 3, the second path includes: Movie 2-Starring-Actor 3-Starring-Movie 3, and the third path includes: Movie 2-Genre-Comedy-Genre-Movie 3. One end of the first path flows from Movie 2 to Actor 2 through the relationship (Starring), and the other end of the first path flows from Movie 3 to Actor 2 through the relationship (Starring).
[0208] Optionally, the recommendation network also includes an abstract user weight and a score calculation for the item to be recommended. The abstract user weight is used to calculate the user's feedback word vector u. The score calculation is used to calculate the distance between the item to be recommended and the feedback word vector u (i.e., the score of the item to be recommended). ). Furthermore, the recommendation network can output the recommended items (i.e., recommended items) corresponding to the scores of the recommended items from high to low scores for the user, or select the scores from high to low according to the needs of TOPK to obtain the recommended items. Furthermore, the abstract user weight can also be used to update the word vector of the recommended item v, that is, p is the probability corresponding to the path with the highest probability among multiple paths in the pairing block. Of course, p can also be set to 1, that is, the word vector of the recommended item v is not updated, which is not limited here.
[0209] The recommendation results in the embodiments of the present application may include items to be recommended. The recommendation results may also include items to be recommended and explanations of the recommended items. Of course, the recommendation results may also include items to be recommended, explanations of the recommended items, and scores corresponding to the items to be recommended, etc., which are not specifically limited here.
[0210] In the embodiment of the present application, the loss function is used to indicate the difference between the recommendation result of the recommendation network and the target recommendation result. In this case, the recommendation network is trained with the goal of reducing the value of the loss function, that is, the difference between the recommendation result of the recommendation network and the target recommendation result is continuously reduced. The training process can be understood as a recommendation task. The loss function can be understood as the loss function corresponding to the recommendation task.
[0211] Optionally, if the recommendation result is the score of the item to be recommended, the score is used to describe the user's preference for the recommended item. The higher the score, the more the user likes the item to be recommended. Then, according to the needs of TOPK, the scores are selected from high to low to obtain the recommended item.
[0212] Optionally, if the recommendation result includes the score of the item to be recommended, the loss function includes a first loss function, which is used to indicate the difference between the calculated score and the actual score of the recommended item output by the recommendation network, where the actual score is the score corresponding to the historical items selected by the user, and the calculated score is the score output by the recommendation network.
[0213] Optionally, the first loss function adopts the following formula:
[0214]
[0215] Among them, if it is a binary classification scenario, y is a positive or negative sample, that is, the value is 1 or 0. Represents the distance between u and v, which can be u T The distance between and v is not limited here.
[0216] Furthermore, the loss function may also include a second loss function, which is used to indicate the difference between the word vectors of the first training vector and the second training vector in the path in the knowledge graph. For a training path, the first training vector is a vector of an entity in the training path that indicates the first entity of the item to be recommended, pointing to an entity in the training path that is adjacent to the first entity indicating the item to be recommended, and the second training vector is a vector of an entity in the training path that indicates the first entity of the item involved in the user's historical record, pointing to an entity in the training path that is adjacent to the first entity indicating the item involved in the user's historical record, or the second training vector is a vector of an entity in the training path that indicates the second entity of the item attribute involved in the user's historical record, pointing to an entity in the training path that is adjacent to the second entity of the item attribute involved in the user's historical record. During the training process, the above-mentioned items to be recommended are also items clicked by the user.
[0217] Optionally, the first training vector is a vector pointing from the first entity corresponding to the item to be recommended in the path to the adjacent entity, the second training vector is a vector pointing from the first entity corresponding to the historical item to the adjacent entity, or the second training vector is a vector pointing from the first entity corresponding to the attribute of the historical item to the adjacent entity.
[0218] In other words, the purpose of the second loss function is to minimize the calculation error of the path flowing to the same node on the left and right, so that in the higher-dimensional relationship matrix in the embedding space, the word vector calculated on the left is as equal as possible to the word vector calculated on the right.
[0219] Exemplarily, the two triplets in the training knowledge graph are "Movie 1 - Starring - Actor 1" and "Movie 1 - Starring - Actor 4". In this case, the intermediate entities "Actor 1" and "Actor 4" are not the same entity, that is, the intermediate entities cannot be aligned, which makes it difficult for the recommendation network training to converge. Therefore, the second loss function is introduced to minimize the difference in word vectors between the first training vector and the second training vector (that is, the vector obtained by "Movie 1" + "first training relationship: starring" is as equal as possible to the vector of "Movie 4" + "first training relationship: starring", so that the path calculation is correct and the convergence of the recommendation network is accelerated).
[0220] Optionally, the second loss function adopts the following formula:
[0221] min L2=∑-lnσ(max|ε im -ε′ im |).
[0222] Among them, σ is the activation function, ε im The first eigenvector representing the flow from one end of the path to the intermediate entity (or adjacent entity), ε′ im The other end of the generation path flows to the second eigenvector of the intermediate entity (or adjacent entity), and max represents the number with the largest difference in multidimensional space.
[0223] It is understandable that the above formula can also have other variations. For example, max can be replaced by avg (representing the average of the differences in multiple dimensions), ε im Replace with g(ε im ), etc., where g() represents graph calculation, and the specific formula of the second loss function can also have other variations, which are not limited here.
[0224] Furthermore, the loss function may also include a third loss function, which is used to indicate the difference between the calculated word vector of the entity and the real word vector of the entity. The entity includes a first entity indicating an item and a second entity indicating an attribute of the item.
[0225] Continuing with the above example, the purpose of the third loss function is to make the vector obtained by adding the head of the triple "Movie 1" and the relationship "Starring" equal to the vector of the dimension "Actor 1" as much as possible.
[0226] Optionally, the third loss function adopts the following formula:
[0227] minL3=Σ-lnσ(s im -M r e)+X2;
[0228]
[0229] Among them, σ is the activation function, s im Represents the flow from the head node to the tail node in the triple to obtain the calculated word vector of the tail node, s im It can be understood as the first training vector or the second training vector mentioned above, M r e is the actual word vector of the tail node, X2 is a regularization function used to avoid overfitting, and optionally, X2 is a minimum square error function.
[0230] It is understandable that the above formula can also have other variations, for example: s im Replace with g(s im ), M r e replaced by g(M r e), where g() represents graph calculation, and the specific formula of the third loss function may also have other variations, which are not limited here.
[0231] Optionally, if the loss function includes a first loss function, the value of the loss function is the value of the first loss function. If the loss function includes a first loss function and a second loss function, the value of the loss function can be the sum, average, weighted average, etc. of the value of the first loss function and the value of the second loss function, and the specific method is not limited here. Similarly, if the loss function includes a first loss function, a second loss function, and a third loss function, the value of the loss function can be the sum, average, weighted average, etc. of the value of the first loss function, the value of the second loss function, and the third loss function, and the specific method used to determine the value of the loss function is not limited here.
[0232] Optionally, the value of the loss function can be calculated as follows:
[0233]
[0234] Among them, λ1, λ2, and λ3 are adjustable coefficients, which can be set according to actual needs and are not specifically limited here.
[0235] On the one hand, the recommendation network provided in the present application can score the recommended items by means of bidirectional conduction calculation to obtain the recommended items. The paths can also be scored to obtain an explanation of the recommended items, that is, to obtain an explanation of the semantic information between any two connected entities. On the other hand, the loss function provided in the embodiment of the present application can improve the accuracy of the recommendation network during the training process (for details, please refer to the following evaluation recommendation network and the corresponding description of Table 1). Specifically, the second loss function provided in the embodiment of the present application can solve the problem of the two ends of the path flowing to the same node in a complex relationship by minimizing the error of the two ends of the path flowing to the same node. The third loss function in the embodiment of the present application can solve the problem of one-to-many and many-to-one problems of a single triple in a complex relationship by minimizing the error of the vectors of the two nodes at the head and tail of the triplet mapped to a relational space.
[0236] It should be noted that the training process may also use other training methods instead of the aforementioned method, which is not limited here.
[0237] The recommended method of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0238] See also Figure 8 In one embodiment of the recommendation method in the present application, the execution subject of the method can be a cloud service device or a terminal device, for example, a computer, a server, or other recommendation device with sufficient computing power to execute the recommendation method, or a system composed of a cloud service device and a terminal device. Figure 3 The execution device 310, Figure 4 The neural network processor 40 in.
[0239] Optionally, the execution subject of the method may be a CPU, a CPU and a GPU, or other processors suitable for neural network calculations may be used instead of a GPU, and the specifics are not limited here.
[0240] The recommendation method in the embodiment of the present application can be applied to scenarios such as movie recommendation, game recommendation, music recommendation, news recommendation, etc., which are not limited to the specific ones here. The recommendation method provided in the embodiment of the present application is described below using the movie recommendation scenario as an example.
[0241] The method includes:
[0242] Step 801: Obtain the knowledge graph.
[0243] The knowledge graph in the embodiment of the present application includes a plurality of first entities for indicating items and a plurality of second entities for indicating item attributes. The knowledge graph may be an existing knowledge graph or a newly constructed knowledge graph, which is not specifically limited here.
[0244] In addition, for the description of knowledge graph, please refer to the previous term explanation and Figure 1 The corresponding description will not be repeated here.
[0245] The knowledge graph in the embodiment of the present application may have the function of associating with the user historical records (it can also be understood that the knowledge graph can distinguish which items in the knowledge graph have not been clicked by the user and which items have been clicked by the user, that is, the path can be directly selected according to the knowledge graph), or it may not have the function of associating with the user historical records (it can also be understood that the user's identification, the item's identification and the knowledge graph are required to determine the path), which is not specifically limited here.
[0246] The knowledge graph in the embodiment of the present application can be a knowledge graph constructed for one user, or a knowledge graph constructed for multiple users, which is not specifically limited here.
[0247] If it is a newly constructed knowledge graph, first obtain user information, item information (recommended items and historical items) and related external knowledge, which includes but is not limited to item attribute information (for example: the director, actor, type of the movie; the developer, operator, classification of the game; the composition, time, place, who of the news, etc.), user dimension characteristics (for example: the user's age distribution, occupation, etc.). Of course, the above information can also be filtered, that is, group recommendations for different users, for example: group users with similar age distribution, so as to improve recommendation efficiency. Among them, recommended items are items that users have not clicked (for example: movies that users have not watched), and historical items are items that users have clicked (for example: movies that users have watched before).
[0248] Optionally, if it is a new user, there may be less item information, and some strategies (such as random method) can be used to recommend some items to the user first, and after receiving feedback information, the item information and / or item attribute information can be obtained.
[0249] Optionally, after obtaining the above information, triples may be constructed first, and then the triples of the same nodes may be connected to construct a knowledge graph for recommendation.
[0250] For example, one triple includes: movie name: "Movie 1" - relationship: starring - entity: actor 1, and another triple includes: movie name: "Movie 4" - relationship: starring - entity: actor 1. These two triples have a common entity node (actor 1), so the two triples are connected through actor 1.
[0251] Step 802: Run the recommendation network based on the knowledge graph and the user's information to obtain recommendation results.
[0252] The recommendation network used in this step can be obtained through the above Figure 5 It can be constructed by the method in , or it can be constructed by other methods, which are not limited here.
[0253] In the embodiment of the present application, there are multiple situations in which the recommendation network is run based on the knowledge graph and the user's information, which are described below respectively:
[0254] The first one is to run the recommendation network with the path as input.
[0255] Based on the knowledge graph and user information, multiple paths are extracted from the knowledge graph, and each path indicates the association between entities at both ends of the path.
[0256] Optionally, multiple paths are input into the recommendation network to score multiple items to be recommended, so that the recommendation network obtains recommendation results.
[0257] The second method is to run the recommendation network with the knowledge graph and user information as input.
[0258] The knowledge graph and user information are input into the recommendation network, which extracts multiple paths in the knowledge graph based on the knowledge graph and user information, and each path indicates the association between entities at both ends of the path.
[0259] Optionally, the user information may include a first identifier and a second identifier. The first identifier indicates the item to be recommended, the second identifier indicates the historical item or the attribute of the historical item, and the knowledge graph includes a first entity corresponding to the first identifier, and a first entity or a second entity corresponding to the second identifier.
[0260] Optionally, the plurality of items to be recommended are scored based on the first direction and the second direction of each of the plurality of paths, so that the recommendation network obtains a recommendation result.
[0261] It is understandable that the above methods are just examples. In actual applications, there may be other input methods, which are not specifically limited here.
[0262] Regardless of the above input methods, the purpose of the above methods is to determine multiple paths and then obtain recommendation results. The recommendation results may include recommended items, and the recommendation results may also include explanations of the recommended items (which can also be understood as evaluation results). The recommendation results may also include recommended items and explanations of the recommended items, which are not specifically limited here.
[0263] Optionally, for each of the multiple paths, the to-be-recommended item corresponding to each path is scored based on the probability that the first vector and the second vector of each path converge into an entity in each path to obtain the recommended item.
[0264] Optionally, the multiple paths are scored based on their respective first directions and second directions to obtain an explanation of the recommendation result, where the explanation is a description of the association between entities at both ends indicated by one or more paths that obtain the recommendation result.
[0265] Combine the following Fig. 9 For instructions on how to get recommendation results based on multiple paths, see Fig. 9 , obtaining recommendation results based on multiple paths can include the following steps:
[0266] Step 8021: Calculate the first vector and the second vector of the path in the knowledge graph.
[0267] Among them, the first vector is consistent with the direction of the first direction, and the second vector is consistent with the direction of the second direction. For a path, the first vector is a vector from the first entity indicating the item to be recommended in the path, pointing to the entity in the path that is adjacent to the first entity indicating the item to be recommended, and the second vector is a vector from the first entity of the historical item in the path, pointing to the entity in the path that is adjacent to the first entity of the historical item, or the second vector is a vector from the second entity of the historical item attribute in the path, pointing to the entity in the path that is adjacent to the second entity of the historical item attribute.
[0268] For the convenience of description, the first entity used to indicate an item in the embodiment of the present application is defined as a first recommendation entity and a first historical entity, that is, the first entity indicating a recommended item or an item to be recommended is the first recommendation entity, and the first entity indicating an item involved in the user's historical record is the first historical entity. The path includes the first recommendation entity, the first associated entity, the first relationship between the first recommendation entity and the first associated entity, the second associated entity, the first historical entity, and the second relationship between the first historical entity and the second associated entity. Among them, the first associated entity and / or the second associated entity can be an entity used to indicate an item or an entity indicating an attribute of an item, which is not specifically limited here.
[0269] For example, take a first recommended entity and three first historical entities as an example. Fig.10 As shown, the first recommended entity is "Movie 1", and the historical viewing records of user A (i.e., the first historical entity) include: "Movie 4", "Movie 5", and "Movie 6". "Movie 1" and "Movie 4" are connected to an entity (hereinafter referred to as the intermediate entity): Hong Kong movies and actor 1. "Movie 1" and "Movie 5" have a common intermediate entity: history. "Movie 1" and "Movie 6" have a common intermediate entity: director 1 and Peking opera. That is, the first associated entity overlaps with the second associated entity, and the first relationships are type, starring, type, director, and category, respectively, and the second relationships are type, starring, type, director, and category, respectively. Combined with the aforementioned Figure 6 Understandably, Fig.10 It includes three pairing blocks, the first pairing block and the third pairing block each include two paths, and the second pairing block includes one path, namely Fig.10 There are 5 paths:
[0270] The first path: "Movie 1"-Genre-Hong Kong Film-Genre-"Movie 4"
[0271] The second path: "Movie 1" - starring role - Actor 1 - starring role - "Movie 4".
[0272] The third path: "Movie 1"-Genre-History-Genre-"Movie 5".
[0273] The fourth path: "Movie 1"-Director-Director 1-Director-"Movie 6".
[0274] The fifth path: "Movie 1"-Genre-Peking Opera-Genre-"Movie 6".
[0275] After obtaining the path, the first vector and the second vector in the path can be determined. The first vector is a vector from one end of the path (e.g., the first recommended entity) to the intermediate entity, and the second vector is a vector from the other end of the path (e.g., the first historical entity) to the intermediate entity. The intermediate entity can be understood as an entity adjacent to the first recommended entity or an entity adjacent to the first historical entity, and the intermediate entity is the first associated entity and / or the second associated entity. The first vector and the second vector can be multi-dimensional vectors.
[0276] Continuing with the above example, for the second path, the first vector can be the vector from Movie 1 to Actor 1, and the second vector can be the vector from Movie 4 to Actor 1. In this case, the intermediate entity is Actor 1. It is understandable that the first vector can also be the vector from Movie 4 to Actor 1, and the second vector can also be the vector from Movie 1 to Actor 1. Fig.10 For example, the left flow direction is the first direction and the right flow direction is the second direction, or the left flow direction is the second direction and the right flow direction is the first direction. The following is a schematic description using the example that the left flow direction is the first direction and the right flow direction is the second direction.
[0277] Optionally, the first vector and the second vector may be calculated using the following formula.
[0278]
[0279] in, represents the first vector, represents the second vector, or represents the second vector, Represents the first vector; M rrepresents the relationship matrix between the recommended items and the items or item attributes corresponding to the intermediate entities, τ represents the word vector of the recommended items, The word vector representing the relationship between the recommended item and the item or item attribute corresponding to the intermediate entity, i u word vectors representing historical objects, The word vector representing the relationship between the historical item and the item or item attribute corresponding to the intermediate entity, m is an integer greater than 0, and the value of m is the same as the number of paths. represents the first vector, The second vector is taken as an example for explanation.
[0280] It is understandable that the first vector and the second vector may also be calculated using other formulas, which are not specifically limited here.
[0281] Continuing from the above Fig.10 For example, the first vector of the first path is: word vector of "Movie 1" * matrix of type + word vector of type, and the second vector of the first path is: word vector of "Movie 4" * matrix of type + word vector of type. The first vector of the second path is: word vector of "Movie 1" * matrix of starring actors + word vector of starring actors, and the second vector of the second path is: word vector of "Movie 4" * matrix of starring actors + word vector of starring actors. The first vector of the third path is: word vector of "Movie 1" * matrix of type + word vector of type, and the second vector of the third path is: word vector of "Movie 5" * matrix of type + word vector of type. The first vector of the fourth path is: word vector of "Movie 1" * matrix of director + word vector of director, and the second vector of the fourth path is: word vector of "Movie 6" * matrix of director + word vector of director. The first vector of the fifth path is: word vector of "Movie 1" * matrix of type + word vector of type, and the second vector of the fifth path is: word vector of "Movie 6" * matrix of type + word vector of type. The mathematical expression is as follows:
[0282]
[0283]
[0284] Step 8022: Calculate the probability that the first vector and the second vector of each path converge to an entity (also referred to as an intermediate entity) included in each path.
[0285] After determining the first vector and the second vector of the path, the probability of the mapping relationship between the first vector and the second vector coinciding with each other (i.e., the probability of the first vector and the second vector being brought together) is calculated. This probability can be abstracted into a word vector of the user dimension, which can reflect the user's preference for the intermediate entity. The probability value can be used to represent the importance of each path.
[0286] It can be understood that, assuming that the number of nodes in the path is an odd number, the intermediate entity is the middle node of the path. If the number of nodes in the path is an even number, the intermediate entity can be any one of the two middle nodes of the path (generally, the node closer to the recommended item among the two middle nodes is determined as the intermediate entity).
[0287] For example, the user has watched 10 movies, 8 of which were starred by actor Actor 1. In this case, the probability of including the node "Actor 1" in the path is relatively high.
[0288] Optionally, the probability that the first vector and the second vector of each path converge to the intermediate entity may be calculated by the following formula.
[0289]
[0290] Among them, p m represents the probability, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the recommended item and the items or item attributes involved in a user's historical record (for example: Fig.10 The three M's are 2, 1, and 2 respectively. The explanations of other parameters can refer to the corresponding explanations of the above formulas and will not be repeated here.
[0291] It is understandable that the probability that the first vector and the second vector converge to the same intermediate entity may also be calculated by other formulas, which are not specifically limited here.
[0292] For example, in combination with the above Figure 6 And continuing the above Fig.10 For example, calculate the flow from "Movie 1" through the movie's leading actor to the "Actor 1" node in pairing block 1; calculate the flow from the movie "Movie 4" watched by the user through the movie's leading actor to the actor 1 node, and calculate the probability that the information of the two flows converges on "Actor 1".
[0293] The mathematical expression of the probability p1 that the first vector and the second vector converge to the Hong Kong film is as follows:
[0294]
[0295] or,
[0296]
[0297] Optionally, the denominator is as mentioned above Figure 6The corresponding description is similar, the denominator can be the sum of the probabilities of m paths in n paired blocks (that is, the number of probabilities in the denominator can be n*m), or the sum of the probabilities of m paths in one paired block (that is, the number of probabilities in the denominator can be m), which is not limited here. Fig.10 The example is only part of the path. If a pairing block has only one path, the probability will be inaccurate. Therefore, the denominator of the probability calculation in this step uses the sum of the probabilities of all paths as an example for schematic explanation.
[0298] The mathematical expression of the probability p2 that the first vector and the second vector converge to actor 1 is as follows:
[0299]
[0300] Then the mathematical expression of the probability p3 that the first vector and the second vector converge into history is as follows:
[0301]
[0302] The mathematical expression of the probability p4 that the first vector and the second vector converge to director 1 is as follows:
[0303]
[0304] The mathematical expression of the probability p5 that the first vector and the second vector converge to Peking Opera is as follows:
[0305]
[0306] The probability that the first vector and the second vector converge to the same intermediate entity is calculated, that is, the explanation of the item to be recommended is obtained. Exemplarily, continuing the above example, the explanation may include: explanation 1: the path attribute node corresponding to p1 (Hong Kong film), explanation 2: the path attribute node corresponding to p2 (actor 1).
[0307] Step 8023: Determine the user's feedback word vector based on the probability and the word vector corresponding to the intermediate entity.
[0308] Optionally, after calculating the probability that the first vector and the second vector converge to the same intermediate entity, the user's feedback word vector can be determined based on the probability and the word vector of the corresponding intermediate entity. In other words, each group of feature values containing user preferences can be first summarized as the user's feedback word vector.
[0309] Optionally, the user's feedback word vector can be calculated by the following formula.
[0310]
[0311] Among them, c nrepresents the feedback word vector of the recommended item and the nth historical item in a pairing block, e m The word vector representing the intermediate entity, p m represents the probability that the left vector and the right vector converge to the same intermediate entity, u represents the user's feedback word vector, N is an integer greater than 1, and N represents the number of historical items.
[0312] It is understandable that the user's feedback word vector may also be calculated using other formulas, which are not specifically limited here.
[0313] For example, continuing the above Fig.10 For example,
[0314] c1=e1p1+e2p2;
[0315] c2=e3p3;
[0316] c3=e4p4+e5p5;
[0317]
[0318] Among them, e1 is the word vector corresponding to Hong Kong movies, e2 is the word vector corresponding to actor 1, e3 is the word vector corresponding to history, e4 is the word vector corresponding to director 1, and e5 is the word vector corresponding to Peking opera. The explanation of other parameters can refer to the explanation corresponding to the above formula, which will not be repeated here.
[0319] In other words, the entity nodes with semantics in the path can be used to describe the user's potential preferences (such as the name of the leading actor, the type of movie, the name of the director, etc.). The word vectors of these attribute nodes are calculated (such as multiplication) with the probability of the corresponding path to obtain the feedback information of a single path.
[0320] For example, continuing the above Fig.10 For example, after obtaining the probability, feedback information can be generated according to the probability. The feedback information may include: feedback information 1 = p1 * word vector of Hong Kong film in the embedding space, feedback information 2 = p2 * word vector of actor 1 in the embedding space, etc.
[0321] Step 8024: Calculate the distance between the word vector corresponding to the item to be recommended and the feedback word vector to obtain the score of the item to be recommended.
[0322] Optionally, the distance between the word vector corresponding to the item to be recommended and the feedback word vector may be calculated to obtain the score of the item to be recommended.
[0323] In the embodiment of the present application, the distance between the word vector corresponding to the recommended item and the feedback word vector can be calculated by methods such as vector dot product, cosine value or similarity. The vector dot product is taken as an example below.
[0324] Optionally, the distance between the word vector corresponding to the recommended item and the feedback word vector can be calculated by the following formula:
[0325]
[0326] in, represents the score, τ represents the word vector of the recommended item, σ is the activation function, and u T represents the transposed matrix corresponding to the user’s feedback word vector u, and represents the inner product operation.
[0327] It is understandable that the distance between the word vector corresponding to the recommended item and the feedback word vector may also be calculated by other formulas, which are not specifically limited here.
[0328] Optionally, the activation function may be a SIGMOID function, which is used to limit the score to [0, 1].
[0329] Among them, the smaller the score, the closer the recommended item is to the user's feedback word vector, which means the user likes the recommended item more.
[0330] For ease of understanding, the following example describes the process of calculating the score using a word vector dimension of 10 and the calculation method of the vector inner product: Assume that the recommended movie set is {《Movie 1》, 《Movie 7》, 《Movie 8》}, and the recommendation network has completed the training of the word vector weights. The following word vectors are calculated:
[0331] The feedback word vector of user A is [0.6626494, 0.5364959, -0.05639589, 0.621532, 0.59782714, 0.44225037, -0.5474265, 0.589441, 0.39717668, 0.16018206].
[0332] The word vector of “Movie 1” is [1.2724952, 0.44506034, 0.12865402, 1.6125565, 1.03306697, -0.01394547, -0.6698308, 0.6348874, 0.4119322, 0.071924224].
[0333] The word vector of “Movie 7” is [-0.00414435, 0.0892299, -0.004835337, 0.8153024, 0.37877557, -0.096624255, -0.34244198, 0.44271728, 0.42087126, 0.5350623].
[0334] The word vector of “Movie 8” is [0.008653568, 0.2210477, -0.04570025, 0.640234, 0.38816172, -0.13182494, -0.48932806, 0.56698304, 0.6465809, 0.8148861].
[0335] Score calculation results:
[0336] Inner product (user A, movie 1): 3.604461848204668.
[0337] Inner product (user A, movie 7): 1.437129814068635.
[0338] Inner product (user A, movie 8): 1.6879938602873226.
[0339] The value after activation function (i.e. recommended score):
[0340] A Movie 1: 0.9735182781851668.
[0341] A movie 7: 0.8080097931691103.
[0342] A movie 8: 0.8439601507627418.
[0343] Step 8025: Determine the recommended item based on the score of the item to be recommended.
[0344] After obtaining the scores of the items to be recommended, the scores can be selected from high to low according to the needs of TOPK to obtain the recommended items.
[0345] Optionally, after obtaining the scores of the recommended items, the recommended items may be sorted according to the scores. If Top 5 is selected, the recommended items with the top 5 scores in the recommended movie set are selected as the recommended items and displayed to the user.
[0346] For example, continuing the above example, for user A, the recommended items are ranked as follows: "Movie 1", "Movie 8", "Movie 7". If it is TOP1, then "Movie 1" is the recommended item.
[0347] Step 8026: Obtain an explanation of the recommended item or the item to be recommended based on the probability. This step is optional.
[0348] After obtaining the probability of the path, the probability can be abstracted into a word vector of the user dimension, and the probability (i.e., the explanation of the recommended item or the recommended item) is output. It can reflect the user's preference for the intermediate entity. The numerical value of the probability can be used to represent the importance of each path.
[0349] Optionally, the explanation of the recommended items or items to be recommended can also be displayed in the form of a graph. Fig.11 For the background introduction of the game's recommended scenarios, please refer to Table 1:
[0350] Table 1
[0351] Recommend the game name to user A Game 1 Game 1 Name of the game played by user A Game 2, Game 3, etc. Relational attributes in knowledge graphs Game type, game publisher, game attributes, etc. Attribute entity nodes in the knowledge graph Action, 1998, Free, etc.
[0352] like Fig.11 As shown in the figure, user A likes Valve 21.1% and action games 38.6%. Therefore, the two key factors for recommending game "Game 1" to the user are that Game 1 and Game 2, which the user has played, are both developed by Valve and are both action games. When a game has these two attributes (Valve, action), user A's preference will increase.
[0353] Optionally, the explanation may be a probability, or a description of the association between entities at both ends indicated by one or more paths leading to the recommendation result.
[0354] For example, continuing the above example, if the distance between "Movie 1" and "Movie 4" in the embedding space is very close, the following explanation sentence can be generated: "The movie "Movie 1" is recommended to user A because it is very similar to the movie "Movie 4" that the user has watched, and they are both starred by star actor 1.
[0355] Step 8027: Evaluate the accuracy of the recommended items based on the scores. This step is optional.
[0356] Optionally, after obtaining the score of the recommended item, the accuracy of the recommended item may be evaluated based on the score, which may also be understood as evaluating the accuracy of the recommendation network based on the score.
[0357] In the embodiment of the present application, there are multiple ways to evaluate the accuracy of the recommended items based on the scores, which are described below:
[0358] 1. Precision (i.e. the recommended precision mentioned above).
[0359] The calculation method of the precision rate is as described above, recommendation rate = number of correct information recommended / number of recommended information.
[0360] Specific process: The historical items viewed by the user are divided into training set and test set without duplication. The training set is used for the above Figure 5 In the training method of the embodiment shown, the test set is used for Figure 6 The recommendation method in the illustrated embodiment calculates the accuracy of the recommended items based on the number of correct recommended information items (i.e., the correct recommended items in TopK, K is an integer greater than 0, K=1 represents outputting a recommended item with the highest score, and K=5 represents outputting five recommended items with the top scores as recommended items) and the number of recommended information items (i.e., the number of K).
[0361] For example, the number of historical items viewed by the user is 40, of which the training set includes 30 and the test set includes 10. 100 items to be recommended are input into the recommendation network. If 4 of the top 5 recommended items are historical items viewed by the user, then the precision rate = 4 / 5 = 0.8.
[0362] 2. Recall (i.e. the recommendation recall mentioned above).
[0363] The calculation method of the recall rate is as described above, recall rate = number of correct information recommended / number of information in the sample.
[0364] Exemplarily, continuing the above example of calculating precision, the recall rate is 4 / 10=0.4.
[0365] 3. AUC.
[0366] The specific description of the AUC is as described above, and the area under the ROC curve is calculated. It mainly evaluates the correctness of a single recommended item and whether overfitting occurs. Through the binary classifier and threshold, it is known whether the single recommended item is a "true positive" or a "false positive".
[0367] For example, the threshold is 0.5. If the output result of the recommended item in the binary classifier is 0.7, which is greater than the threshold, the recommended item is correct. If the output result of the recommended item in the binary classifier is 0.3, which is less than the threshold, the recommended item is incorrect.
[0368] It is understandable that the above three methods of evaluating the recommendation network are just examples. In actual applications, there may be other methods (such as accuracy) to evaluate the accuracy of the recommended items, which are not limited here.
[0369] The evaluation method in the embodiment of the present application can be applied to the training stage of the recommendation network (for example Figure 5 The training method shown in ), can also be applied to the inference phase of the recommendation network (e.g. Figure 6The recommended method shown in FIG. 1 is not limited to the specific method here.
[0370] In order to more intuitively see the recommendation accuracy of the recommendation network provided in the embodiment of the present application, the existing recommendation model is compared with the TB-Net in the embodiment of the present application.
[0371] Among them, the existing recommendation models include: ripple net recommendation model, recommendation network based on collaborative filtering and knowledge base embedding (CKE), Bayesian personalized ranking matrix factorization (BPRMF) recommendation algorithm, neural factorization machine (NFM) recommendation algorithm, deep knowledge-aware network (DKN), and recommendation model that integrates shallow model and deep model (Wide&Deep).
[0372] 1. Comparison results of the two indicators of precision and recall.
[0373] The comparison results of precision can be found in Fig.12 , the comparison results of recall rate can be referred to Fig.13 .
[0374] The comparison results are that TB-Net provided by this application and four mainstream models (ripple net, CKE, BPRMF, NFM) are used to train the news recommendation dataset: MIND (Microsoft News dataset) to complete the task of recommending news, and the accuracy of the recommended items is measured by the two indicators of precision and recall. Fig.12 and Fig.13 The comparison results show that the TB-Net provided by this application performs better in terms of precision and recall, which is higher than other mainstream models (ripplenet, CKE, BPRMF). The comparison results prove that the TB-Net provided by the embodiment of this application has significantly improved the recommendation accuracy compared with the existing recommendation systems (ripple net, CKE, BPRMF).
[0375] 2. Comparison results of AUC and accuracy.
[0376] The comparison results of AUC and accuracy are shown in Table 2:
[0377] Table 2
[0378]
[0379]
[0380] From the comparison results in Table 2 above, it can be seen that the recommendation network (TB-Net) in the embodiment of the present application is superior to the prior art in terms of AUC and recommendation accuracy, and is basically on par with the industry-leading deep learning recommendation models (Ripplenet proposed by Microsoft and Wide&Deep proposed by Google), and has been improved to a certain extent. The recommendation network provided in the embodiment of the present application has the characteristics of high recommendation accuracy.
[0381] Step 8028: Evaluate the accuracy of the explanation based on the probability and the knowledge graph. This step is optional.
[0382] Optionally, after obtaining the probabilities corresponding to the paths, the paths can be sorted according to the probabilities, and the accuracy of the explanation of the recommended items or recommended items can be evaluated based on the sorting and the degree sorting of the subgraph nodes in the knowledge graph. The degree of a node refers to the number of edges associated with the node (i.e., the number of connected relationships).
[0383] For example, if the explanation uses Top2, the two p2s with higher probabilities in the path (i.e., the probability corresponding to the second path where actor 1 is located) and p4 (i.e., the probability corresponding to the fourth path where director 1 is located). And the first two nodes in the degree ranking in the knowledge graph are actor 1 node and Peking Opera node. This is equivalent to the probability p2 corresponding to actor 1 and the degree ranking of actor 1 node in the knowledge graph being in the first two positions, while the probability p4 corresponding to director 1 and the degree ranking of director 1 node in the knowledge graph are not in the first two positions. This means that the explanation of actor 1's second path is more accurate. In contrast, the explanation of director 1's fourth path is not accurate enough compared to the explanation corresponding to actor 1.
[0384] In order to more intuitively see the accuracy of the output interpretation of the recommendation network provided in the embodiment of the present application, the existing recommendation interpretation model is compared with the recommendation network in the embodiment of the present application in the movie recommendation scenario (MovieLens dataset). The recommendation network provided in the embodiment of the present application can also be called a tower-bridge network (TB-Net), or a bidirectional significant interpretable recommendation network.
[0385] Among them, the existing recommendation explanation models include: ripple net recommendation model, multi-task collaborative filtering model (AMCF), and interpretable linear regression model (LR).
[0386] The comparison results of the explanations are shown in Table 2:
[0387] Table 2
[0388] Recommended Explanation Model Top1@3 Top3@5 AMCF 0.461 0.403 LR 0.572 0.598 Ripple net 0.26 0.21 TB-Net 0.75 0.635
[0389] The recall rate of the explanation is equivalent to TopG@K, where K represents the number of explanations output by the recommendation model and G represents the top explanations recognized by users in the dataset. For example, Top1@3 represents the probability that the first explanation in the dataset exists among the three explanations output by the recommendation model, which is equivalent to determining whether the explanation of the recommended item output by the recommendation model meets the user's real expectations through user feedback.
[0390] The comparison results prove that the accuracy of the output explanation information of TB-Net provided by the embodiment of the present application is significantly improved compared with the existing recommendation explanation models (ripple net, AMCF, LR). The recommendation network provided by the embodiment of the present application has the characteristics of high interpretability and high recommendation accuracy, that is, it provides semantic-level explanations while maintaining high recommendation accuracy.
[0391] In the embodiment of the present application, Fig. 9 The steps shown do not limit the time sequence relationship. For example, step 8026 can be before step 8025 or before step 8024, as long as step 8026 is after step 8022. Step 8027 can be before step 8026 or before step 8025, as long as step 8027 is after step 8024. Step 8028 can be before step 8027.
[0392] It is understandable that if the recommendation network only outputs the explanation of the recommended items, then Fig. 9 The steps shown may include step 8021, step 8022, and step 8026. If the recommendation network only outputs recommended items, then Fig. 9 The steps shown may include step 8021 to step 8025.
[0393] In one possible implementation, the step of obtaining recommendation results based on multiple paths may include steps 8021 to 8025. In another possible implementation, the step of obtaining recommendation results based on multiple paths may include steps 8021 to 8026. In another possible implementation, the step of obtaining recommendation results based on multiple paths may include steps 8021 to 8027. In another possible implementation, the step of obtaining recommendation results based on multiple paths may include steps 8021 to 8028.
[0394] In the embodiment of the present application, on the one hand, through bidirectional conduction calculation, high-semantic explanatory information can be provided for the items to be recommended or the recommended items, and it can be grafted with the recommendation system in the prior art, that is, it can provide high-semantic explanatory information for the recommended items output by the existing recommendation system. On the other hand, by calculating the probability of overlap of the two left and right flows of the path converging at the intermediate entity at the confluence point (i.e., the intermediate entity), it is used to indicate the importance of the path. On the other hand, through the calculation of the overlap probability and the intermediate entity, the user's preference feedback information (i.e., the user's feedback word vector) can be obtained, and the feedback word vector is used to output a credible and reliable semantic explanation. On the other hand, the preference feedback information at both ends of the path can be aggregated to form a feedback word vector, and the recommended items can be calculated and output with the items to be recommended, so that more accurate recommendation results can be obtained, that is, the recall rate of the recommendation is improved.
[0395] The recommendation method in the embodiment of the present application is described above. The recommendation device in the embodiment of the present application is described below. The neural network is equivalent to the aforementioned recommendation network. Fig.14 In the present application, an embodiment of the recommendation device 1400 includes:
[0396] An acquisition unit 1401 is used to acquire a knowledge graph, wherein the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating attributes of the items;
[0397] The running unit 1402 is used to run a neural network based on the knowledge graph and the user's information to obtain a recommendation result, wherein the user's information indicates items or item attributes involved in the user's historical record, and the recommendation result includes a recommended item. The neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain a recommendation result, wherein the first direction starts from a first entity indicating a recommended item or an item to be recommended, and the second direction starts from a first entity indicating an item involved in the user's historical record, or the second direction starts from a second entity indicating an item attribute involved in the user's historical record.
[0398] In this embodiment, the operations performed by each unit in the recommendation device are the same as those described above. Figure 5 , Figure 8 and / or Fig. 9 The description in the illustrated embodiment is similar and will not be repeated here.
[0399] In this embodiment, the running unit 1402 can run a neural network based on the knowledge graph and the user's information to obtain a recommendation result, wherein the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain a recommendation result, providing a new recommendation method.
[0400] See also Fig.15 Another embodiment of the recommendation device 1500 in the embodiment of the present application includes:
[0401] An acquisition unit 1501 is used to acquire a knowledge graph, a first identifier, and a second identifier, wherein the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating item attributes, the first identifier indicates an item to be recommended, the second identifier indicates an item or an item attribute involved in a user history record, and the knowledge graph includes a first entity corresponding to the first identifier, and a first entity or a second entity corresponding to the second identifier;
[0402] The running unit 1502 is used to run a neural network based on the knowledge graph, the first identifier and the second identifier to obtain an evaluation result, wherein the evaluation result includes the probability of the recommended item being recommended. The neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain the evaluation result, wherein the first direction starts from a first entity corresponding to the first identifier, and the second direction starts from a first entity or a second entity corresponding to the second identifier.
[0403] In this embodiment, the operations performed by each unit in the recommendation device are the same as those described above. Figure 5 , Figure 8 and / or Fig. 9 The description in the illustrated embodiment is similar and will not be repeated here.
[0404] In this embodiment, the running unit 1502 can run a neural network based on the knowledge graph, the first identifier and the second identifier to obtain an evaluation result, wherein the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain the probability of the item to be recommended being recommended, and the probability can be used to output an explanation of the item to be recommended, thereby providing an explanatory recommendation method.
[0405] See also Fig.16 Another embodiment of the recommendation device 1600 in the embodiment of the present application includes but is not limited to a processor 1601, a communication port 1602, a memory 1603, and a bus 1604. In the embodiment of the present application, the processor 1601 is used to control the actions of the recommendation device 1600.
[0406] In addition, the processor 1601 can be a central processing unit, a general processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0407] It should be noted that Fig.16 The recommended device shown can be used to implement Figure 5 , Figure 8 and / or Fig. 9 The functions of the steps performed by the recommended device in the corresponding method embodiment and the technical effects corresponding to the recommended device are achieved, Fig.16 The specific implementation methods of the recommended device shown can refer to Figure 5 , Figure 8 and / or Fig. 9 The descriptions in the corresponding method embodiments will not be repeated here one by one.
[0408] The present application also provides a computer-readable storage medium storing one or more computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes the method as described in the possible implementation of the above embodiment, wherein the recommendation device can specifically execute the above Figure 5 , Figure 8 and / or Fig. 9 The steps in the corresponding method embodiment.
[0409] The present application also provides a computer program product storing one or more computers. When the computer program product is executed by the processor, the processor executes the method of the above possible implementation, wherein the recommendation device can specifically execute the above Figure 5 , Figure 8 and / or Fig. 9 The steps in the corresponding method embodiment.
[0410] The present application also provides a chip system, which includes a processor for supporting the recommendation device to implement the functions involved in the possible implementation of the recommendation device. In a possible design, the chip system may also include a memory, which is used to store the necessary program instructions and data of the recommendation device. The chip system may be composed of a chip, or may include a chip and other discrete devices, wherein the recommendation device may specifically perform the above-mentioned Figure 5 , Figure 8 and / or Fig. 9 The steps in the corresponding method embodiment.
[0411] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0412] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0413] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0414] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
Claims
1. A recommendation method, characterized in that: The method comprises: Acquire a knowledge graph, wherein the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating attributes of the items; Running a neural network based on the knowledge graph and user information to obtain a recommendation result, wherein the user information indicates items or item attributes involved in the user's historical record, and the recommendation result includes a recommended item, and the neural network is used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain the recommendation result, wherein the first direction starts from a first entity indicating the recommended item or the item to be recommended, and the second direction starts from a first entity indicating the item involved in the user's historical record, or starts from a second entity indicating the item attribute involved in the user's historical record; The knowledge graph includes multiple paths. For a path, the first direction is that one end of the path points to the other end of the path, and the second direction is that the other end of the path points to one end of the path.
2. The method according to claim 1, characterized in that: The recommendation result also includes an explanation of the recommended item, where the explanation is related to a first direction and a second direction.
3. The method according to claim 1, characterized in that The running of a neural network based on the knowledge graph and the user's information to obtain a recommendation result includes: Based on the knowledge graph and the user's information, extract multiple paths in the knowledge graph, each of the paths indicating the association between entities at both ends of the path, one end of each path corresponding to an item to be recommended, and the other end corresponding to an item or item attribute involved in the user's historical record; The multiple paths are input into the neural network to score the multiple items to be recommended so that the neural network obtains the recommendation result. The neural network is used to calculate based on the first direction and the second direction of each of the multiple paths to obtain the recommendation result.
4. The method according to claim 1, characterized in that: The running of a neural network based on the knowledge graph and the user's information to obtain a recommendation result includes: Inputting the knowledge graph and the user's information into the neural network; The neural network extracts multiple paths in the knowledge graph based on the knowledge graph and the user's information, each of the paths indicating the association between entities at both ends of the path, one end of each of the paths corresponding to the item to be recommended, and the other end corresponding to the item or item attribute involved in the user's historical record; Scoring the plurality of items to be recommended based on the first direction and the second direction of each of the plurality of paths so that the neural network obtains the recommendation result.
5. The method according to claim 4, characterized in that The first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of an item attribute involved in the user's historical record in the path; Scoring the plurality of to-be-recommended items corresponding to the plurality of paths based on the first direction and the second direction of each of the plurality of paths so that the neural network obtains the recommendation result includes: For each of the multiple paths, the recommended item corresponding to each path is scored based on the probability that the first vector and the second vector of each path converge into an entity in each path to obtain the recommended item.
6. The method according to any one of claims 3 to 5, characterized in that The method further comprises: The multiple paths are scored based on their respective first directions and second directions to obtain an explanation of the recommendation result, wherein the explanation is a description of the association between entities at both ends indicated by one or more paths that obtain the recommendation result.
7. The method according to claim 6, characterized in that The first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of an item attribute involved in the user's historical record in the path; Scoring the multiple paths based on the first direction and the second direction of each of the multiple paths to obtain an explanation of the recommendation result includes: The probability that the first vector and the second vector of each path converge to an entity included in each path is calculated respectively to obtain an explanation for the recommendation result.
8. The method according to claim 7, characterized in that The respectively calculating the probability that the first vector and the second vector of each path converge to an entity included in each path comprises: Among them, p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the item to be recommended and the items or item attributes involved in a user's historical record.
9. The method according to any one of claims 3 to 5, characterized in that The neural network is obtained by taking a training sample as an input of the neural network and training the neural network with a loss function value less than a threshold as a goal, the training sample includes a plurality of training paths, or the training sample includes a knowledge graph used for training, items and / or item attributes involved in a historical record of a user used for training, each of the training paths indicates an association between entities at both ends of the training path, and both ends of each of the training paths correspond to items or item attributes involved in the historical record of the user; The loss function includes a first loss function, which is used to indicate the difference between the recommendation result output by the neural network and the target result, and the target result is related to the item or item attribute involved in the historical record of the user.
10. The method according to claim 9, characterized in that The loss function also includes a second loss function, which is used to indicate the difference between the word vectors of the first training vector and the second training vector in the training path of the knowledge graph used for training, and the two ends of the training path correspond to the items or item attributes involved in the user's historical record.
11. The method according to claim 10, characterized in that The loss function also includes a third loss function, which is used to indicate the difference between the calculated word vector of the first entity and the true word vector of the first entity, and / or to indicate the difference between the calculated word vector of the second entity and the true word vector of the second entity.
12. A recommendation method, characterized in that: The method comprises: Acquire a knowledge graph, a first identifier, and a second identifier, wherein the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating item attributes, the first identifier indicates an item to be recommended, the second identifier indicates an item or an item attribute involved in a user's historical record, and the knowledge graph includes a first entity corresponding to the first identifier, and a first entity or a second entity corresponding to the second identifier; Running a neural network based on the knowledge graph, the first identifier, and the second identifier to obtain an evaluation result, the evaluation result including a probability of the item to be recommended being recommended, the neural network being used to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain the evaluation result, the first direction starting from a first entity corresponding to the first identifier, and the second direction starting from a first entity or a second entity corresponding to the second identifier; The knowledge graph includes multiple paths. For a path, the first direction is that one end of the path points to the other end of the path, and the second direction is that the other end of the path points to one end of the path.
13. The method according to claim 12, characterized in that The evaluation result also includes the probability corresponding to the path in the knowledge graph when the item to be recommended is recommended, one end of the path is the first entity corresponding to the first identifier, and the other end of the path is the first entity corresponding to the second identifier.
14. The method according to claim 12, characterized in that The running the neural network based on the knowledge graph, the first identifier, and the second identifier to obtain an evaluation result includes: Extracting multiple paths from the knowledge graph based on the knowledge graph, the first identifier, and the second identifier, each of the paths indicating the association between entities at both ends of the path, one end of each path corresponding to an item to be recommended, and the other end corresponding to an item or item attribute involved in the historical record of the user; The multiple paths are input into the neural network to score the multiple items to be recommended, so that the neural network obtains the evaluation result, and the neural network is used to calculate based on the first direction and the second direction of each of the multiple paths to obtain the probability.
15. The method according to claim 13, characterized in that The step of running the neural network based on the knowledge graph, the first identifier, and the second identifier to obtain an evaluation result includes: Inputting the knowledge graph, the first identifier, and the second identifier into the neural network; The neural network extracts multiple paths in the knowledge graph based on the knowledge graph, the first identifier, and the second identifier, each of the paths indicating the association between entities at both ends of the path, one end of each path corresponding to an item to be recommended, and the other end corresponding to an item or item attribute involved in the historical record of the user; Scoring the multiple items to be recommended corresponding to the multiple paths based on the first direction and the second direction of each of the multiple paths, so that the neural network obtains the evaluation result.
16. The method according to claim 15, characterized in that The first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of an item attribute involved in the user's historical record in the path; Scoring the plurality of to-be-recommended items corresponding to the plurality of paths based on the first direction and the second direction of each of the plurality of paths includes: The probability that the first vector and the second vector of each path converge to an entity included in each path is calculated respectively.
17. The method according to claim 16, characterized in that The respectively calculating the probability that the first vector and the second vector of each path converge to an entity included in each path comprises: Among them, p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the item to be recommended and the items or item attributes involved in a user's historical record.
18. The method according to any one of claims 12 to 17, characterized in that The neural network is obtained by taking a training sample as an input of the neural network and training the neural network with a loss function value less than a threshold as a goal, the training sample includes a plurality of training paths, or the training sample includes a knowledge graph for training, a first training identifier, and a second training identifier, and the item indicated by the first training identifier and the item or item attribute indicated by the second training identifier are items or item attributes involved in historical items of the user; The loss function includes a first loss function, which is used to indicate the difference between an evaluation result output by a neural network and a target result, wherein the target result is related to an item or an item attribute involved in the historical record of the user.
19. The method according to claim 18, characterized in that The loss function also includes a second loss function, which is used to indicate the difference between the word vectors of the first training vector and the second training vector in the training path of the knowledge graph used for training, and the two ends of the training path correspond to the items or item attributes involved in the user's historical record.
20. The method according to claim 19, characterized in that The loss function also includes a third loss function, which is used to indicate the difference between the calculated word vector of the first entity and the true word vector of the first entity, and / or to indicate the difference between the calculated word vector of the second entity and the true word vector of the second entity.
21. A recommendation device, characterized in that: The recommended devices include: An acquisition unit, configured to acquire a knowledge graph, wherein the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating attributes of the items; an operating unit, configured to operate a neural network based on the knowledge graph and user information to obtain a recommendation result, wherein the user information indicates items or item attributes involved in the user's historical record, and the recommendation result includes a recommended item, and the neural network is configured to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain the recommendation result, wherein the first direction starts from a first entity indicating the recommended item or the item to be recommended, and the second direction starts from a first entity indicating the item involved in the user's historical record, or starts from a second entity indicating the item attribute involved in the user's historical record; The knowledge graph includes multiple paths. For a path, the first direction is that one end of the path points to the other end of the path, and the second direction is that the other end of the path points to one end of the path.
22. The recommendation device according to claim 21, characterized in that The recommendation result also includes an explanation of the recommended item, where the explanation is related to a first direction and a second direction.
23. The recommendation device according to claim 21, characterized in that: The operation unit is specifically configured to extract multiple paths in the knowledge graph based on the knowledge graph and the user's information, each of the paths indicating the association between entities at both ends of the path, one end of each of the paths corresponding to an item to be recommended, and the other end corresponding to an item or item attribute involved in the user's historical record; The operating unit is specifically used to input the multiple paths into the neural network to score the multiple items to be recommended so that the neural network obtains the recommendation result. The neural network is used to calculate based on the first direction and the second direction of each of the multiple paths to obtain the recommendation result.
24. The recommendation device according to claim 21, characterized in that The operating unit is specifically used to input the knowledge graph and the user's information into the neural network; The operation unit is specifically used for the neural network to extract multiple paths in the knowledge graph based on the knowledge graph and the user's information, each of the paths indicating the association between entities at both ends of the path, one end of each of the paths corresponding to the item to be recommended, and the other end corresponding to the item or item attribute involved in the user's historical record; The operation unit is specifically used to score the multiple items to be recommended based on the first direction and the second direction of each of the multiple paths, so that the neural network obtains the recommendation result.
25. The recommendation device according to claim 24, characterized in that The first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of an item attribute involved in the user's historical record in the path; The operation unit is specifically used to score the recommended items corresponding to each path in the multiple paths based on the probability that the first vector and the second vector of each path converge into an entity in each path, so as to obtain the recommended items.
26. The recommendation device according to any one of claims 23 to 25, characterized in that The operation unit is further used to score the multiple paths based on the first direction and the second direction of each of the multiple paths to obtain an explanation of the recommendation result, wherein the explanation is a description of the association between the entities at both ends indicated by one or more paths that obtain the recommendation result.
27. The recommendation device according to claim 26, characterized in that The first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of an item attribute involved in the user's historical record in the path; The operation unit is specifically used to respectively calculate the probability that the first vector and the second vector of each path converge to an entity included in each path, so as to obtain an explanation for the recommendation result.
28. The recommendation device according to claim 27, characterized in that The operation unit is specifically used to calculate the probability that the first vector and the second vector of each path are converged to an entity included in each path by the following formula: Among them, p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the item to be recommended and the items or item attributes involved in a user's historical record.
29. A recommendation device, characterized in that: The recommended devices include: an acquisition unit, configured to acquire a knowledge graph, a first identifier, and a second identifier, wherein the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating item attributes, the first identifier indicates an item to be recommended, the second identifier indicates an item or an item attribute involved in a user's historical record, and the knowledge graph includes a first entity corresponding to the first identifier, and a first entity or a second entity corresponding to the second identifier; an operating unit, configured to operate a neural network based on the knowledge graph, the first identifier, and the second identifier to obtain an evaluation result, wherein the evaluation result includes a probability of the recommended item being recommended, and the neural network is configured to calculate based on at least one first direction and at least one second direction in the knowledge graph to obtain the evaluation result, wherein the first direction starts from a first entity corresponding to the first identifier, and the second direction starts from a first entity or a second entity corresponding to the second identifier; The knowledge graph includes multiple paths. For a path, the first direction is that one end of the path points to the other end of the path, and the second direction is that the other end of the path points to one end of the path.
30. The recommendation device according to claim 29, characterized in that The evaluation result also includes the probability corresponding to the path in the knowledge graph when the item to be recommended is recommended, one end of the path is the first entity corresponding to the first identifier, and the other end of the path is the first entity corresponding to the second identifier.
31. The recommendation device according to claim 29, characterized in that The operation unit is specifically used to extract multiple paths in the knowledge graph based on the knowledge graph, the first identifier and the second identifier, each of the paths indicates the association between entities at both ends of the path, one end of each path corresponds to the item to be recommended, and the other end corresponds to the item or item attribute involved in the historical record of the user; The operation unit is specifically used to input the multiple paths into the neural network to score the multiple items to be recommended, so that the neural network obtains the evaluation result, and the neural network is used to calculate based on the first direction and the second direction of each of the multiple paths to obtain the probability.
32. The recommendation device according to claim 30, characterized in that The operating unit is specifically configured to input the knowledge graph, the first identifier, and the second identifier into the neural network; The operation unit is specifically used for the neural network to extract multiple paths in the knowledge graph based on the knowledge graph, the first identifier and the second identifier, each of the paths indicates the association between entities at both ends of the path, one end of each path corresponds to the item to be recommended, and the other end corresponds to the item or item attribute involved in the historical record of the user; The operation unit is specifically used to score the multiple recommended items corresponding to the multiple paths based on the first direction and the second direction of each of the multiple paths, so that the neural network obtains the evaluation result.
33. The recommendation device according to claim 32, characterized in that: The first direction is consistent with the direction of the first vector, and the second direction is consistent with the direction of the second vector. For a path, the first vector is a vector from a first entity indicating an item to be recommended in the path to an entity adjacent to the first entity indicating the item to be recommended in the path, and the second vector is a vector from a first entity of an item involved in the user's historical record in the path to an entity adjacent to the first entity indicating the item involved in the user's historical record in the path, or the second vector is a vector from a second entity of an item attribute involved in the user's historical record in the path to an entity adjacent to the second entity of an item attribute involved in the user's historical record in the path; The operation unit is specifically used to respectively calculate the probability that the first vector and the second vector of each path converge to an entity included in each path.
34. The recommendation device according to claim 33, characterized in that The operation unit is specifically used to calculate the probability that the first vector and the second vector of each path are converged to an entity included in each path by the following formula: Among them, p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, represents the second vector; exp represents an exponential function with e as the base, M is a positive integer, and M represents the number of paths between the item to be recommended and the items or item attributes involved in a user's historical record.
35. A recommendation device, characterized in that: The invention comprises a processor, wherein the processor is coupled to a memory, wherein the memory is used to store a computer program or an instruction, and the processor is used to execute the computer program or the instruction in the memory, so that the method described in any one of claims 1 to 11 is executed, or the method described in any one of claims 12 to 20 is executed.
36. A chip, characterized in that: The chip includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a computer program or instruction so that the method described in any one of claims 1 to 11 is executed, or the method described in any one of claims 12 to 20 is executed.
37. A computer storage medium, characterized in that The computer storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the method according to any one of claims 1 to 11, or the computer executes the method according to any one of claims 12 to 20.
38. A computer program product, characterized in that When the computer program product is executed on a computer, the computer is caused to perform the method according to any one of claims 1 to 11, or the computer is caused to perform the method according to any one of claims 12 to 20.
Citation Information
Patent Citations
Product recommendation method and device and storage medium
CN110020913A
News recommendation method based on knowledge perception
CN111061856A
Cited By
Recommendation method, recommendation network, and related device
WO2022143482A1