WO2022143482A1 - 一种推荐方法、推荐网络及相关设备 - Google Patents

一种推荐方法、推荐网络及相关设备 Download PDF

Info

Publication number
WO2022143482A1
WO2022143482A1 PCT/CN2021/141472 CN2021141472W WO2022143482A1 WO 2022143482 A1 WO2022143482 A1 WO 2022143482A1 CN 2021141472 W CN2021141472 W CN 2021141472W WO 2022143482 A1 WO2022143482 A1 WO 2022143482A1
Authority
WO
WIPO (PCT)
Prior art keywords
path
item
vector
entity
recommended
Prior art date
Application number
PCT/CN2021/141472
Other languages
English (en)
French (fr)
Inventor
王神迪
李昊阳
王云鹏
曹琛
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP21914219.7A priority Critical patent/EP4258132A4/en
Publication of WO2022143482A1 publication Critical patent/WO2022143482A1/zh
Priority to US18/215,959 priority patent/US20230342833A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/047Probabilistic or stochastic networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/09Supervised learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • G06N5/022Knowledge engineering; Knowledge acquisition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0201Market modelling; Market analysis; Collecting market data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0282Rating or review of business operators or products
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]
    • G06Q30/0631Item recommendations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/01Social networking

Definitions

  • the present application relates to the field of artificial intelligence, and in particular, to a recommendation method, a recommendation network and related equipment.
  • Artificial intelligence is a 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.
  • artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that responds in a similar way to human intelligence.
  • Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
  • the embodiments of the present application provide a recommendation method, a recommendation network, and related equipment, 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 for at least one One direction and at least one second direction are calculated to obtain recommendation results, which provides a new recommendation method, which can obtain more accurate recommendation results, that is, improve the accuracy and/or recall rate of recommendation results, which can be applied to movie recommendation. , game recommendation and other scenarios where items are recommended to users.
  • a first aspect of the embodiments of the present application provides a recommendation method, and the method may be performed by a recommendation apparatus, or may be performed by a component (for example, a processor, a chip, or a chip system, etc.) of the recommendation apparatus.
  • the method includes: acquiring a knowledge graph, where the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating attributes of the items; and running a neural network based on the knowledge graph and user information to obtain a recommendation result , the user's information indicates the item or item attribute involved in the user's history record.
  • the recommendation result includes the 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, and the first direction starts from the first direction indicating the recommended item or the item to be recommended.
  • Entities the second direction starts with a first entity indicating items to which the user's history refers, or the second direction begins with a second entity indicating attributes of items to which the user's history refers.
  • the user's information may include the user's identity, items or item attributes that the user has clicked on, and attributes related to the user, such as the user's age, occupation, gender, and the like. Items to be recommended can be understood as items that the user has not clicked.
  • What this recommendation method needs to do is to find the recommended items suitable for recommending to the user from the items to be recommended, so as to improve the accuracy and recall rate.
  • the first entities that do not indicate the items that the user has involved in the history can be the items to be recommended.
  • preliminary screening may be performed to narrow the range of items to be recommended in the knowledge graph, so that some items indicated by the first entity are selected as items to be recommended.
  • the above-mentioned user information may indicate the item or item attribute involved in the positive event of the user's history record, and it should be understood that the user's information may be filtered.
  • the information of the user used to make the recommendation indicates the item or item attribute involved in the positive event of the user's history.
  • the item or item attribute involved in the positive event in the user's history can be understood as the item or item attribute indicated by the first entity or the second entity that the user once involved in the positive event.
  • the positive event refers to the fact that the user does not clearly express negative or negative willingness (that is, dislike, uninterested, unwilling to pay attention) in the event, or express positive will such as concern, liking, and interest.
  • the user clicks, forwards, follows, comments, incentives (such as coins, likes), favorites, browsing, and items or item attributes whose browsing time exceeds the threshold time are all positive events. I don't want to see it", click "Not interested", and select "Do not appear on my homepage" is a negative event.
  • the first direction starts from the first entity indicating the item to be recommended or the item to be recommended, it can be understood that the starting point of the first direction is the first entity indicating the item to be recommended or the item to be recommended, which entity the first direction points to Not limited.
  • the second direction starts from the first entity indicating the item to be recommended or the item to be recommended, or the first direction starts from the second entity indicating the attribute of the item involved in the user's history record. It can be understood that the starting point of the second direction is the first entity indicating the item to be recommended or the item to be recommended, or the starting point of the second direction is the second entity, and it is not limited to which entity the second direction points.
  • the starting point of the first direction is a movie that the user has not watched
  • the starting point of the second direction is a movie that the user has watched, or the corresponding corresponding movie type.
  • a neural network may be run 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.
  • the recommendation result provides a new recommendation method that can obtain more accurate recommendation results, that is, improve the precision and/or recall rate of the recommendation results.
  • the recommendation result in the above steps further includes an explanation of the recommended item, and the explanation is related to a first direction and a second direction.
  • 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.
  • the recommendation method can also obtain an explanation of the recommended item, and the explanation can explain the reason why the recommended item is recommended.
  • the above steps run a neural network based on the knowledge graph and the user's information to obtain a recommendation result, including: extracting from 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 history record; Score multiple items to be recommended, so that the neural network can obtain the recommendation result.
  • the neural network is used to calculate the recommendation result based on the respective first and second directions of multiple paths. For a path, the first direction is the direction 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.
  • the multiple recommended items to be recommended may be scored through multiple paths, and the neural network may be used to obtain the recommendation result based on the respective first and second directions of the multiple paths, so that the scoring can be achieved.
  • the neural network may be used to obtain the recommendation result based on the respective first and second directions of the multiple paths, so that the scoring can be achieved.
  • 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 is based on the knowledge graph and user information.
  • Knowledge graph and user information multiple paths are extracted from the knowledge graph, 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 involved in the user's history record.
  • Item attributes score multiple items to be recommended based on the respective first and second directions of multiple paths, so that the neural network can obtain recommendation results.
  • the first direction is that one end of the path points to the other end of the path.
  • the second direction is where the other end of the path points to one end of the path.
  • the recommendation results obtained in one direction are more accurate.
  • multiple items to be recommended will be scored based on the respective first and second directions of multiple paths to obtain multiple recommended items, and then based on the ranking of the recommended items, the final result is obtained. recommended results. In this way, several recommended items can be given by default, so more accurate recommended items can be given.
  • the first direction of the above steps is consistent with the direction of the first vector
  • the second direction is consistent with the direction of the second vector.
  • the first vector is From the path, indicating the first entity of the item to be recommended, pointing to the vector of the entity adjacent to the first entity indicating the item to be recommended in the path
  • the second vector is the second vector of the item involved in the user's history record in the slave path.
  • the neural network In order for the neural network to obtain the recommendation result, it includes: for each path in the multiple paths, the probability that the first vector and the second vector of each path are aggregated to an entity in each path corresponds to each path. Score the items to be recommended to get the recommended items.
  • the coincidence probability of the information of the left and right flow directions in the path in the embedding space is calculated, and the coincidence probability feature of the collection node is calculated.
  • the coincidence probability feature is used to output a semantic-level explanation, that is, the user's preference for a certain entity node.
  • multiple items to be recommended will score 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, so as to obtain multiple items to be recommended.
  • Recommend items and then get the final recommendation result based on the ranking of the recommended items. In this way, the ranking suitable for the user comes to the front, and the user's interest point can be accurately found.
  • the above steps further include: scoring the multiple paths based on the respective first directions and second directions of the multiple paths, so as to obtain an explanation of the recommendation result,
  • An explanation is a description of the association between the two end entities indicated by one or more paths leading to a recommendation result.
  • the multiple paths can be scored by their respective first directions and second directions, so that two directions of the paths are considered when scoring, compared with the prior art that only uses a single direction
  • the interpretation of the obtained recommendation results is more comprehensive and accurate.
  • multiple paths are scored based on the respective first and second directions of the multiple paths to obtain multiple explanations, and then the final recommendation result is obtained based on the ranking of the explanations. In this way, several recommended items can be given by default, so more accurate recommended items can be given.
  • the first direction of the above steps is consistent with the direction of the first vector
  • the second direction is consistent with the direction of the second vector.
  • the first vector is from In the path, the first entity indicating the item to be recommended, points to the vector of the entity adjacent to the first entity indicating the item to be recommended in the path
  • the second vector is the first entity of the item involved in the user's history record from the path.
  • Entity pointing to a vector of entities in the path adjacent to the first entity indicating the item involved in the user's history, or, a second vector to the second entity from the path, the attribute of the item involved in the user's history, pointing to In the path, the vector of the entity adjacent to the second entity of the item attribute involved in the user's history record; the multiple paths are scored based on the respective first and second directions of the multiple paths to obtain the interpretation of the recommendation result, It includes: separately calculating 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.
  • the coincidence probability of the information of the left and right flow directions in the path in the embedding space is calculated, and the coincidence probability feature of the collection node is calculated.
  • the coincidence probability feature is used to output a semantic-level explanation, that is, the user's preference for a certain entity node. That is to calculate the probability that the vectors of the two flow directions are brought together. It helps to more accurately find the user's point of interest and give appropriate recommendations.
  • the above steps respectively calculate the probability that the first vector and the second vector of each path are aggregated to an entity included in each path, including:
  • p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, Represents the second vector;
  • exp represents the exponential function with base e, M is a positive integer, M represents the number of paths between the item to be recommended and the item or item attribute involved in a user's history record.
  • the neural network in the above steps is obtained by training the neural network with the training sample as the input of the neural network and taking the value of the loss function less than the threshold as the target, and the training sample is obtained by training the neural network.
  • multiple training paths, or training samples include knowledge graphs for training, items and/or item attributes involved in the user's history records for training, each training path indicates the association between entities at both ends of the training path, and each Both ends of the training path correspond to the items or item attributes involved in the user's historical records;
  • the loss function includes a first loss function, the first loss function is used to indicate the difference between the recommended result output by the neural network and the target result, and the target result is the same as the target result.
  • the user's history records relate to items or item attributes.
  • the neural network is trained by the first loss function, so that the recommendation result is more accurate and conforms to the user's preference.
  • the above-mentioned step loss function further includes a second loss function, and the second loss function is used to indicate that the first training vector in the training path of the knowledge graph used for training is the same as the one.
  • the difference between the word vectors between the second training vectors, the two ends of the training path correspond to the items or item attributes involved in the user's history records.
  • the purpose of the second loss function is to minimize the calculation error of the left and right paths flowing to the same node, so that in the higher-dimensional relationship matrix in the embedding space, the word vector calculated on the left is as close as possible to the one calculated on the right.
  • the word vectors are equal. That is, the error of the two ends of the path flowing to the same node can be minimized through the second loss function, and the problem of the two ends of the path flowing to the same node in the complex relationship can be solved.
  • the loss function in the above steps further includes a third loss function, where the third loss function is used to indicate the calculated word vector of the first entity and the real word vector of the first entity.
  • the third loss function can minimize the vector mapping of the first and last two nodes of the triplet to the error of a relationship space, which can solve the complex relationship, where a single triplet has one-to-many, Many-to-one question.
  • a second aspect of the embodiments of the present application provides a recommendation method, and the method may be performed by a recommendation apparatus, or may be performed by a component (for example, a processor, a chip, or a chip system, etc.) of the recommendation apparatus.
  • the method includes: acquiring a knowledge graph, a first identifier and a second identifier, the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating item attributes, and the first identifier indicates an item to be recommended , the second identifier indicates the item or item attribute involved in the user's 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; based on the knowledge graph, the first entity
  • the identification and the second identification run the neural network to obtain the evaluation result, the evaluation result includes the probability that the item to be recommended is recommended, and the neural network is used to calculate based on at least one first direction and at least one second direction
  • a neural network may be run based on the knowledge graph, the first identifier, and the second identifier to obtain the probability that the item to be recommended is recommended, wherein the neural network is used for at least one first direction based on the knowledge graph and at least one second direction calculation to obtain the probability that the item to be recommended is recommended, a new recommendation method is provided.
  • multiple items to be recommended will be calculated based on at least one direction and at least the first and second directions of the knowledge graph 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 given by default, so more accurate recommended items can be given.
  • the evaluation result in the above steps further includes, when the item to be recommended is recommended, the probability corresponding to the path in the knowledge graph based on the probability that one end of the path is the same as the first A first entity corresponding to an identifier, and the other end of the path is a first entity corresponding to a second identifier.
  • 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: based on the knowledge graph, the first identifier, and the first identifier.
  • the second identification extracts multiple paths in the knowledge graph, each path indicates the association between the 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 history record;
  • the paths are input into the neural network to score multiple items to be recommended, so that the neural network can obtain evaluation results.
  • the neural network is used to calculate the probability based on the respective first and second directions of multiple paths. For a path, the first The 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.
  • the neural network can be input through multiple paths to score multiple items to be recommended, so that the neural network can obtain the evaluation result, so that two directions of the path are considered when scoring. Compared with the prior art The evaluation results obtained from only one direction are more accurate.
  • 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: combining the knowledge graph, the first identifier, and the The second identifier is input to 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 indicates the association between the entities at both ends of the path, and one end of each path corresponds to the to-be-recommended item, the other end corresponds to the item or item attribute involved in the user's history record; based on the respective first and second directions of the multiple paths, the multiple items to be recommended corresponding to the multiple paths are scored, so that the neural network can obtain the evaluation results,
  • the first direction is that one end of the path points to the other end of the path
  • the second direction is that the other end of the path points to one end of the path.
  • a method of scoring multiple items to be recommended corresponding to multiple paths can be based on the respective first directions and second directions of multiple paths, so that two directions of the paths are considered when scoring, which is better than the current one.
  • the evaluation results obtained from only one direction in the prior art are more accurate.
  • the first direction in the above steps is consistent with the direction of the first vector
  • the second direction is consistent with the direction of the second vector.
  • the first vector is from In the path, the first entity indicating the item to be recommended, points to the vector of the entity adjacent to the first entity indicating the item to be recommended in the path
  • the second vector is the first entity of the item involved in the user's history record from the path.
  • Entity pointing to a vector of entities in the path adjacent to the first entity indicating the item involved in the user's history, or, a second vector to the second entity from the path, the attribute of the item involved in the user's history, pointing to In the path, the vector of the entity adjacent to the second entity of the item attribute involved in the user's history record; based on the respective first and second directions of the multiple paths, the multiple items to be recommended corresponding to the multiple paths are scored, including : Calculate the probability that the first vector and the second vector of each path converge to an entity included in each path.
  • the coincidence probability of the information of the left and right flow directions in the path in the embedding space is calculated, and the coincidence probability feature of the collection node is calculated.
  • the coincidence probability feature is used to output a semantic-level explanation, that is, the user's preference for a certain entity node. The user's point of interest can be accurately found.
  • the above steps respectively calculate the probability that the first vector and the second vector of each path are aggregated to an entity included in each path, including:
  • p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, Represents the second vector;
  • exp represents the exponential function with base e, M is a positive integer, M represents the number of paths between the item to be recommended and the item or item attribute involved in a user's history record.
  • the neural network in the above steps is obtained by training the neural network with the training sample as the input of the neural network and taking the value of the loss function less than the threshold as the target, and the training sample is obtained by training the neural network.
  • the training sample includes multiple training paths, or the training sample includes a knowledge graph for training, a first training identification, and a second training identification, and the items indicated by the first training identification and the second training identification or the attributes of the items are historical items of the user
  • the loss function includes a first loss function, the first loss function is used to indicate the difference between the evaluation 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 user's history record .
  • the neural network is trained by the first loss function, so that the recommendation result is more accurate and conforms to the user's preference.
  • the above-mentioned step loss function further includes a second loss function, and the second loss function is used to indicate that the first training vector in the training path of the knowledge graph used for training is the same as that of the first training vector.
  • the difference between the word vectors between the second training vectors, the two ends of the training path correspond to the items or item attributes involved in the user's history records.
  • the purpose of the second loss function is to minimize the calculation error of the left and right paths flowing to the same node, so that in the higher-dimensional relationship matrix in the embedding space, the word vector calculated on the left is as close as possible to the one calculated on the right.
  • the word vectors are equal. That is, the error of the two ends of the path flowing to the same node can be minimized through the second loss function, and the problem of the two ends of the path flowing to the same node in the complex relationship can be solved.
  • the loss function in the above steps further includes a third loss function, and the third loss function is used to indicate the calculated word vector of the first entity and the real word vector of the first entity.
  • the third loss function can minimize the vector mapping of the first and last two nodes of the triplet to the error of a relationship space, which can solve the complex relationship, where a single triplet has one-to-many, Many-to-one question.
  • a third aspect of the embodiments of the present application provides a recommendation device, the recommendation device includes: an acquisition unit, configured to acquire a knowledge graph, where the knowledge graph includes a plurality of first entities for indicating an item and a plurality of first entities for indicating an attribute of the item The second entity; the running unit, used to run the neural network based on the knowledge graph and the user's information to obtain the recommendation result, the user's information indicates the item or item attribute involved in the user's historical record, the recommendation result includes the recommended item, and the neural network uses is calculated based on at least one first direction and at least one second direction in the knowledge graph to obtain the recommendation result, the first direction starts from the first entity indicating the recommended item or the item to be recommended, and the second direction starts from indicating the user The first entity of the item to which the user's history relates, or the second direction starts from a second entity that indicates attributes of the item to which the user's history relates.
  • the above-mentioned recommendation result further includes an explanation of the recommended item, and the explanation is related to a first direction and a second direction.
  • the operating unit of the communication device is specifically configured to extract multiple paths in the knowledge graph based on the knowledge graph and user information, and each path indicates two paths.
  • the association between the entities at the ends, 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 history record;
  • the running unit is specifically used to input multiple paths into the neural network to recommend multiple items to be recommended. Items are scored so that the neural network can obtain the recommendation result.
  • the neural network is used to calculate the recommendation result based on the respective first and second directions of multiple paths. For a path, the first direction is one end of the path pointing to the other end of the path. , the second direction is that the other end of the path points to one end of the path.
  • the operation unit of the above communication device is specifically used to input the knowledge graph and user information into the neural network; the operation unit is specifically used for the neural network to be based on the knowledge graph and User information, extract multiple paths in the knowledge graph, 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 history record;
  • the running unit is specifically used to score multiple items to be recommended based on the respective first directions and second directions of the multiple paths, so that the neural network can obtain a recommendation result.
  • the first direction is that one end of the path points to the other side of the path.
  • One end, the second direction is that the other end of the path points to one end of the path.
  • the above-mentioned first direction is consistent with the direction of the first vector
  • the second direction is consistent with the direction of the second vector.
  • the first vector is from In the path, the first entity indicating the item to be recommended, points to the vector of the entity adjacent to the first entity indicating the item to be recommended in the path
  • the second vector is the first entity of the item involved in the user's history record from the path.
  • Entity pointing to a vector of entities in the path adjacent to the first entity indicating the item involved in the user's history, or, a second vector to the second entity from the path, the attribute of the item involved in the user's history, pointing to In the path, the vector of the entity adjacent to the second entity of the item attribute involved in the user's history record; the running unit is specifically used for each path in the multiple paths, based on the first vector and the first vector of each path.
  • the probability that the two vectors are aggregated to an entity in each path scores the items to be recommended corresponding to each path to obtain the recommended items.
  • the operating unit of the above communication device is further configured to score the multiple paths based on the respective first directions and second directions of the multiple paths, so as to obtain the corresponding scores.
  • the explanation of the recommendation result is a description of the association between the two end entities indicated by one or more paths to obtain the recommendation result.
  • the above-mentioned first direction is consistent with the direction of the first vector
  • the second direction is consistent with the direction of the second vector.
  • the first vector is from In the path, the first entity indicating the item to be recommended, points to the vector of the entity adjacent to the first entity indicating the item to be recommended in the path
  • the second vector is the first entity of the item involved in the user's history record from the path.
  • Entity pointing to a vector of entities in the path adjacent to the first entity indicating the item involved in the user's history, or, a second vector to the second entity from the path, the attribute of the item involved in the user's history, pointing to In the path, the vector of the entity adjacent to the second entity of the item attribute involved in the user's history record; the running unit is specifically used to separately calculate the first vector and the second vector of each path and collect them into one included in each path. probabilities of entities to get an explanation for the recommendation results.
  • the operating unit of the above-mentioned communication device is specifically configured to calculate the first vector and the second vector of each path separately by the following formula and collect them into the data included in each path. Probability of an entity:
  • p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, Represents the second vector;
  • exp represents the exponential function with base e, M is a positive integer, M represents the number of paths between the item to be recommended and the item or item attribute involved in a user's history record.
  • the above-mentioned neural network is obtained by training the neural network with the training sample as the input of the neural network and taking the value of the loss function less than the threshold as the target, and the training sample is obtained by training the neural network.
  • multiple training paths, or training samples include knowledge graphs for training, items and/or item attributes involved in the user's history records for training, each training path indicates the association between entities at both ends of the training path, and each Both ends of the training path correspond to the items or item attributes involved in the user's historical records;
  • the loss function includes a first loss function, the first loss function is used to indicate the difference between the recommended result output by the neural network and the target result, and the target result is the same as the target result.
  • the user's history records relate to items or item attributes.
  • the above-mentioned loss function further includes a second loss function, and the second loss function is used to indicate that the first training vector in the training path of the knowledge graph used for training and The difference between the word vectors between the second training vectors, the two ends of the training path correspond to the items or item attributes involved in the user's history records.
  • the above-mentioned loss function further includes a third loss function, and the third loss function is used to indicate the calculated word vector of the first entity and the real word vector of the first entity.
  • a fourth aspect of an embodiment of the present application provides a recommendation device, the recommendation device includes: an acquisition unit configured to acquire a knowledge graph, a first identifier, and a second identifier, where the knowledge graph includes a plurality of first entities used to indicate items and A plurality of second entities for indicating item attributes, the first identification indicates the item to be recommended, the second identification indicates the item or item attribute involved in the user's history record, the knowledge graph includes the first entity corresponding to the first identification, and the The first entity or the second entity corresponding to the second identifier; an operating unit for running the neural network based on the knowledge graph, the first identifier and the second identifier to obtain an evaluation result, where the evaluation result includes the probability that the item to be recommended is recommended, and the neural network The 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 second Identify the corresponding first entity or second entity.
  • the above evaluation result further includes, when the item to be recommended is recommended, based on the probability corresponding to the path in the knowledge graph, one end of the path is the same as the first identifier.
  • the corresponding first entity, and the other end of the path is the first entity corresponding to the second identifier.
  • the operating unit of the above communication device is specifically configured to extract multiple paths in the knowledge graph based on the knowledge graph, the first identifier and the second identifier, and each path Indicates the association between the 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 history record;
  • the running unit is specifically used to input multiple paths into the neural network to compare to many
  • Each item to be recommended is scored, so that the neural network can obtain the evaluation result.
  • the neural network is used to calculate the probability based on the respective first and second directions of multiple paths. For a path, the first direction is one end of the path pointing to the path. At the other end, the second direction is that the other end of the path points to one end of the path.
  • the operation unit of the above communication device is specifically used to input the knowledge graph, the first identification and the second identification into the neural network; the operation unit is specifically used for the neural network.
  • multiple paths are extracted from the knowledge graph.
  • 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 user's history record.
  • the item or item attribute involved; the running unit which is specifically used to score multiple items to be recommended corresponding to multiple paths based on the respective first directions and second directions of multiple paths, so that the neural network can obtain evaluation results.
  • the first direction is that one end of the path points to the other end of the path
  • the second direction is that the other end of the path points to one end of the path.
  • the above-mentioned first direction is consistent with the direction of the first vector
  • the second direction is consistent with the direction of the second vector.
  • the first vector is from In the path, the first entity indicating the item to be recommended, points to the vector of the entity adjacent to the first entity indicating the item to be recommended in the path
  • the second vector is the first entity of the item involved in the user's history record from the path.
  • Entity pointing to a vector of entities in the path adjacent to the first entity indicating the item involved in the user's history, or, a second vector to the second entity from the path, the attribute of the item involved in the user's history, pointing to In the path, the vector of the entity adjacent to the second entity of the item attribute involved in the user's history record; the running unit is specifically used to separately calculate the first vector and the second vector of each path and collect them into one included in each path. the probability of the entity.
  • the operating unit of the above-mentioned communication device is specifically configured to calculate the first vector and the second vector of each path respectively by the following formula and collect them into each path including: The probability of an entity of :
  • p m represents the probability, represents the first vector, represents the second vector, or, represents the first vector, Represents the second vector;
  • exp represents the exponential function with base e, M is a positive integer, M represents the number of paths between the item to be recommended and the item or item attribute involved in a user's history record.
  • the above-mentioned neural network is obtained by training the neural network with the training sample as the input of the neural network and taking the value of the loss function less than the threshold as the target, and the training sample is obtained by training the neural network. It includes multiple training paths, or the training sample includes a knowledge graph for training, a first training identification, and a second training identification, and the items indicated by the first training identification and the second training identification or the attributes of the items are historical items of the user The item or item attribute involved; the loss function includes a first loss function, the first loss function is used to indicate the difference between the evaluation 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 user's history record .
  • the above-mentioned loss function further includes a second loss function, and the second loss function is used to indicate that the first training vector in the training path of the knowledge graph used for training is the same as that of the first training vector.
  • the difference between the word vectors between the second training vectors, the two ends of the training path correspond to the items or item attributes involved in the user's history records.
  • the above-mentioned loss function further includes a third loss function, and the third loss function is used to indicate the calculated word vector of the first entity and the real word vector of the first entity.
  • a fifth aspect of the embodiments of the present application provides a recommendation apparatus, where the recommendation apparatus or a component of the recommendation apparatus (for example, a processor, a chip, or a chip system) executes the method in the foregoing first aspect or any possible implementation manner of the first aspect .
  • the recommendation apparatus or a component of the recommendation apparatus for example, a processor, a chip, or a chip system
  • a sixth aspect of the embodiments of the present application provides a recommendation apparatus, where the recommendation apparatus or a component of the recommendation apparatus (for example, a processor, a chip, or a chip system) executes the method in the foregoing second aspect or any possible implementation manner of the second aspect .
  • the recommendation apparatus or a component of the recommendation apparatus for example, a processor, a chip, or a chip system
  • a seventh aspect of the embodiments of the present application provides a computer-readable storage medium, where an instruction is stored in the computer-readable storage medium, and when the instruction is executed on a computer, causes the computer to execute the foregoing first aspect or any possibility of the first aspect
  • An implementation of the second aspect, or a method in any possible implementation of the second aspect is provided.
  • An eighth aspect of the embodiments of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the first aspect or any possible implementation manner of the first aspect, the second aspect or the second aspect method in any possible implementation of .
  • a ninth aspect of an embodiment of the present application provides a recommending device, including: a processor, where the processor is coupled to a memory, and the memory is used to store programs or instructions, and when the programs or instructions are executed by the processor, the device implements the above-mentioned first Aspect or a method in any possible implementation of the first aspect.
  • a tenth aspect of an embodiment of the present application provides a recommendation apparatus, including: a processor, where the processor is coupled to a memory, and the memory is used to store programs or instructions, and when the programs or instructions are executed by the processor, the apparatus implements the above-mentioned second A method in any possible implementation of the aspect or the second aspect.
  • the embodiments of the present application have the following advantages: acquiring a knowledge graph, and running a neural network based on the knowledge graph and user information to obtain a recommendation result. Compared with the recommendation result obtained by only calculating from the user's historical record as a starting point in the prior art (that is, calculating the recommendation result from a single direction in the prior art).
  • the present invention calculates 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 by calculating from two directions, that is, Improve the precision and/or recall of the recommendation results.
  • FIG. 1 is a schematic diagram of a recommended network architecture provided by an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of a product implementation provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of another system architecture provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a recommendation network provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a neural network processor according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a recommendation network provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a path in a movie recommendation scenario provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a recommendation method provided by an embodiment of the present application.
  • FIG. 9 is another schematic flowchart of the recommendation method provided by the embodiment of the present application.
  • FIG. 10 is another schematic structural diagram of a path in a movie recommendation scenario provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of a map display in a game recommendation scenario provided by an embodiment of the present application.
  • FIG. 12 is a schematic diagram of the comparison result of the accuracy rate between the recommendation network provided by the embodiment of the present application and the existing recommendation model;
  • 13 is a schematic diagram of the comparison result of the recall rate between the recommendation network provided by the embodiment of the present application and the existing recommendation model;
  • FIG. 14 to FIG. 16 are schematic diagrams of several structures of the recommended device in the embodiment of the present application.
  • the embodiments of the present application provide a recommendation method, a recommendation network, and related equipment, 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 for at least one first direction based on the knowledge graph and at least one second direction calculation to obtain a recommendation result, a new recommendation method is provided, which can obtain a more accurate recommendation result, that is, improve the precision rate and/or the recall rate of the recommendation result. It can be used in scenarios such as movie recommendation, game recommendation, etc. to recommend items to users.
  • the recommendation methods provided in the embodiments 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, and webpage recommendation.
  • items need to be recommended such as movie recommendation, product recommendation, music recommendation, restaurant recommendation, book recommendation, and webpage recommendation.
  • movie recommendation scene and the game recommendation scene.
  • the neural network performs two-way conduction calculation (described in detail below) to obtain that when a user is a fan of Chen Kaige and Leslie Cheung at the same time, then recommending the movie "Farewell My Concubine" for him will Significantly improve user satisfaction with the recommended results.
  • Team Fortress 2 Team Fortress 2
  • user's historically played records there are many complex relationships between the recommended game Team Fortress 2 ("Team Fortress 2") and the user's historically played records.
  • a neural network can be composed of neural units, and a neural unit can refer to an operation unit that takes X s and an intercept 1 as input, and the output of the operation unit can be:
  • W s is the weight of X s
  • b is the bias of the neural unit.
  • f is an 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 an output signal. The output signal of this 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 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 with the local receptive field of the previous layer to extract the features of the local receptive field, and the local receptive field can be an area composed of several neural units.
  • a deep neural network 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. From the division of DNN according to the position of different layers, 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 middle layers 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, the deep neural network may also not include hidden layers, which is not limited here.
  • the work of each layer in a deep neural network can be expressed mathematically To describe: From the physical level, the work of each layer in the deep neural network can be understood as completing the transformation from the input space to the output space (that is, the row space of the matrix to the column) through five operations on the input space (set of input vectors). Space), these five operations include: 1. Dimension raising/lowering; 2. Enlarging/reducing; 3. Rotation; 4. Translation; 5. "Bending”. Among them, the operations of 1, 2, and 3 are determined by done, the operation of 4 consists of Completed, the operation of 5 is implemented by ⁇ ().
  • W is the weight vector, and each value in the vector represents the weight value of a neuron in the neural network of this layer.
  • This vector W determines the space transformation from the input space to the output space described above, that is, the weight W of each layer controls how the space is transformed.
  • the purpose of training the deep neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vectors W of many layers). Therefore, the training process of the neural network is essentially learning the way to control the spatial transformation, and more specifically, learning the weight matrix.
  • Word vectors can also be called “word embeddings”, “vectorization”, “vector mapping”, “embeddings”, etc.
  • a word vector is a dense vector to represent an object, for example, a vector is used to represent the user's identity document (ID), item ID, etc.
  • a knowledge graph is a semantic network, and a knowledge graph contains multiple entities and relationships between entities.
  • An entity is the most basic element in the knowledge graph, wherein the entity can be divided into a first entity and a second entity, the first entity is an entity used to indicate an item, and the second entity is an entity used to indicate the attribute of the item.
  • the second entity is directly connected to the first entity, that is, the first entity and the second entity are arranged alternately.
  • Item Something that is distinguishable and exists independently. Such as a certain city, a certain commodity, a certain movie, a certain game and so on.
  • Item attributes It can be seen as the description, explanation, content, attributes, etc. of the item. Under normal circumstances, the entity of the item attribute is directly connected to the one-hop node of the entity of the item.
  • the movie type of "Farewell My Concubine" is history, where "Farewell My Concubine” is equivalent to the first entity, which is used to indicate the movie, and history is equivalent to the second entity, which is used to indicate the attributes of the movie.
  • the movie genre is the relationship between the first entity and the second entity.
  • a compression method mainly used to store sparse matrices also called triple table.
  • a triple includes: entity 1 (may be called a node), the relationship between entity 1 and entity 2 (may also be called an edge), and entity 2 (may be called a node) to form a triple that is stored in the computer.
  • the main purpose is to embed the entities and relations in the knowledge graph into a continuous vector space.
  • 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 neural networks.
  • Euclidean norm also known as the Euclidean norm, it represents the Euclidean distance from the origin to the point determined by the vector X.
  • AUC Area under curve
  • ROC receiver operating characteristic curve
  • AUC is a performance indicator to measure the pros and cons of a learner, which 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 sorting result.
  • Recommendation accuracy rate the number of correct information recommended / the number of recommended information.
  • the recommended recall rate the number of correct pieces of information recommended / the number of pieces of information in the sample.
  • the neural network with the recommendation function in the embodiment of the present application can also be understood as a recommendation network.
  • the neural network with the recommendation function is replaced with a recommendation network for description below.
  • an embodiment of the present invention provides a recommended network architecture 100 .
  • the recommendation method provided in this application can be applied to the conduction calculation and loss function modules of the recommendation network architecture 100 .
  • Recommendation network architecture is a general framework for neural network training for recommender systems, which has become more and more widely used in recent years.
  • the conduction calculation module adopts the knowledge graph and user information to run the recommendation network to obtain the recommendation results.
  • the recommendation results include The recommended item (or the logo of the recommended item).
  • the recommendation network provided in this application may be a neural network, specifically a deep neural network.
  • the conduction calculation module can also solve the problem of how to obtain high-semantic interpretation information during the calculation of data in the embedded space.
  • the path is used as input and the calculation is conducted bidirectionally from both ends of the path.
  • a highly semantic interpretation is computed at the pool.
  • the loss function module solves the problem that the recommendation accuracy cannot be guaranteed during the recommendation network training process.
  • This application adds a path loss function and a node loss function, which enables the model to converge quickly and greatly improves the performance indicators such as the recommendation precision rate and recall rate, and improves the reliability of the recommendation results and interpretation.
  • the knowledge graph module is used to construct a knowledge graph or obtain an existing knowledge graph.
  • the knowledge graph module is used to construct a knowledge graph or obtain an existing knowledge graph.
  • the new user processing module is used to recommend some items to the user through some strategies (for example: random method) when there is no information such as the history record of the new user, and then quickly get feedback information (for example: the ID of the item clicked by the user , item attributes and other node information). Then, these data are input into the network for more accurate recommendations.
  • some strategies for example: random method
  • feedback information for example: the ID of the item clicked by the user , item attributes and other node information.
  • the data acquisition module is used to acquire the user's information, and the user's information indicates the items (also referred to as historical items) or item attributes (also referred to as historical item attributes) involved in the user's historical records.
  • the data acquisition module can also be used to acquire user information, item information and related external knowledge, the external knowledge including but not limited to item attribute information (for example: the director, actor, genre of the movie; the developer of the game , operator, classification; components of news, when, where, who, etc.), and user-dimensioned features (eg, user's age, occupation, etc.). used to build a knowledge graph.
  • item attribute information for example: the director, actor, genre of the movie; the developer of the game , operator, classification; components of news, when, where, who, etc.
  • user-dimensioned features eg, user's age, occupation, etc.
  • the data storage module is used to store the above-mentioned related data, which is not specifically limited here.
  • FIG. 2 is a schematic diagram of the architecture of the implementation of the product in the embodiment of the application.
  • the product may be included in the recommended network architecture and may be deployed on the server hardware.
  • the program code of the present application can exist in the recommended network, and when the program runs, the program code of the present application can run with the host storage and acceleration hardware of the server ⁇ graphic processing unit (graphic processing unit). unit, GPU), field programmable gate array (field programmable gate array, FGPA), or dedicated chip ⁇ memory.
  • the recommendation device is a device provided by this application for inputting data, outputting recommended items and/or outputting explanations.
  • an embodiment of the present invention provides another system architecture 300 .
  • the data collection device 360 is used to collect training samples.
  • 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 sample.
  • Training ID, the item indicated by the first training ID and the item or item attribute indicated by the second training ID are the item or item attribute indicated by the user's historical item; or the training sample includes the knowledge graph used for training, the user's Items and/or item attributes involved in the history records, each training path indicates the association between entities at both ends of the training path, and both ends of each training path correspond to the items or item attributes involved in the user's history records.
  • the training samples are stored in the database 330 , and the training device 320 obtains the target model/rule 301 by training based on the training samples maintained in the database 330 .
  • the target model/rule 301 can be used to implement the recommendation method provided by the embodiments of the present application, that is, run a recommendation network based on the knowledge graph and user information to obtain a recommendation result, where the recommendation result includes the recommended item, and the user information indicates the user The history of the item or item attribute involved. Further, 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 by the present application, the recommendation network is obtained by training training samples.
  • the training samples maintained in the database 330 are not necessarily all collected by the data collection device 360, and may also be received from other devices.
  • the training device 320 may not necessarily train the target model/rule 301 entirely based on the training data maintained by the database 330, and may also obtain training data from the cloud or other places for model training. The above description should not be used as a reference to this application Limitations of Examples.
  • the target model/rule 301 trained according to the training device 320 can be applied to different systems or devices, such as the execution device 310 shown in FIG. 3 , the execution device 310 can be a terminal, such as a mobile phone terminal, a tablet computer, notebook computers, vehicle terminals, etc., can also be servers or the cloud.
  • the execution device 310 is configured with an I/O interface 312, which is used for data interaction with external devices.
  • the user can input data to the I/O interface 312 through the client device 340.
  • the data input in this embodiment of the present application It can include: multiple paths; the input data can also include knowledge graph and user information; the input data can also include knowledge graph.
  • 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 history record, and the input data may also come from a database, which is not limited here.
  • the preprocessing module 313 is used for preprocessing according to the input data received by the I/O interface 312.
  • the preprocessing module 313 can be used to randomly recommend some items to the user, and then determine the history according to the user's feedback. Items (it can also be understood that historical items are items related to the user's historical records).
  • the preprocessing module 313 may be configured to extract multiple paths in the knowledge graph based on the knowledge graph and user information, and send the extracted paths to the computing module 311 .
  • the execution device 310 When the execution device 310 preprocesses the input data, or the calculation module 311 of the execution device 310 performs calculations and other related processing, the execution device 310 can call the data, codes, etc. in the data storage system 350 for corresponding processing , the data and instructions obtained by corresponding processing may also be stored in the data storage system 350 .
  • the I/O interface 312 returns the processing result, such as the recommendation result obtained above, to the client device 340, so as to be provided to the user.
  • the training device 320 can generate corresponding target models/rules 301 based on different training data for different goals or tasks, and the corresponding target models/rules 301 can be used to achieve the above goals or complete The above task, thus providing the user with the desired result.
  • the user can manually specify the input data, which can be operated through the interface provided by the I/O interface 312 .
  • the client device 340 can automatically send the input data to the I/O interface 312. If the user's authorization is required to request the client device 340 to automatically send the input data, the user can set the corresponding permission in the client device 340.
  • the user can view the result output by the execution device 310 on the client device 340, and the specific presentation form can be a specific manner such as display, sound, and action.
  • the client device 340 can also be used as a data collection terminal to collect the input data of the input I/O interface 312 and the output result of the output I/O interface 312 as new sample data as shown in the figure, and store them in the database 330 .
  • the data is stored in database 330 .
  • FIG. 3 is only a schematic diagram of a system architecture provided by an embodiment of the present invention, and the positional relationship between the devices, devices, modules, etc. shown in the figure does not constitute any limitation.
  • 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 .
  • a target model/rule 301 is obtained by training according to the training device 320, and the target model/rule 301 may be a recommendation network in this embodiment of the present application.
  • the recommendation network provided in this embodiment of the present application may be a deep Neural Networks.
  • FIG. 4 is a hardware structure of a chip according to an embodiment of the present invention, where the chip includes a neural network processor 40 .
  • the chip can be set in the execution device 310 as shown in FIG. 3 to complete the calculation work of the calculation module 311 .
  • the chip can also be set in the training device 320 as shown in FIG. 3 to complete the training work of the training device 320 and output the target model/rule 301 .
  • the neural network processor 40 may be a neural-network processing unit (NPU), a tensor processing unit (TPU), or a graphics processor (graphics processing unit, GPU), etc., all suitable for large-scale applications.
  • NPU neural-network processing unit
  • TPU tensor processing unit
  • GPU graphics processor
  • NPU is mounted on the main central processing unit (CPU) (host CPU) as a co-processor, and tasks are allocated by the main CPU.
  • the core part of the NPU is the operation circuit 403, and the controller 404 controls the operation circuit 403 to extract the data in the memory (weight memory or input memory) and perform operations.
  • the arithmetic circuit 403 includes multiple processing units (process engines, PEs). In some implementations, arithmetic circuit 403 is a two-dimensional systolic array. The arithmetic circuit 403 may also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, arithmetic circuit 403 is a general-purpose matrix processor.
  • the operation circuit fetches the data corresponding to the matrix B from the weight memory 402 and buffers it on each PE in the operation circuit.
  • the arithmetic circuit fetches the data of matrix A and matrix B from the input memory 401 to perform matrix operation, and stores the partial result or final result of the matrix in the accumulator 408 accumulator.
  • the vector calculation unit 407 can further process the output of the arithmetic circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, and the like.
  • the vector calculation unit 407 can be used for network calculation of non-convolutional/non-FC layers in the neural network, such as pooling (Pooling), batch normalization (Batch Normalization), local response normalization (Local Response Normalization), etc. .
  • the vector computation unit 407 can store the processed output vectors to the unified buffer 406 .
  • vector calculation unit 407 may apply a nonlinear function to the output of arithmetic circuit 403, such as a vector of accumulated values, to generate activation values.
  • vector computation unit 407 generates normalized values, merged values, or both.
  • the vector of processed outputs can be used as an activation input to the arithmetic circuit 403, such as for use in subsequent layers in a neural network.
  • Unified memory 406 is used to store input data and output data.
  • the weight data directly transfers the input data in the external memory to the input memory 401 and/or the unified memory 406 through the storage unit access controller (direct memory access controller, DMAC) 405, and stores the weight data in the external memory into the weight memory 402, And the data in the unified memory 506 is stored in the external memory.
  • DMAC direct memory access controller
  • the bus interface unit (bus interface unit, BIU) 410 is used to realize the interaction between the main CPU, the DMAC and the instruction fetch memory 409 through the bus.
  • An instruction fetch buffer 409 connected to the controller 404 is used to store the instructions used by the controller 404.
  • the controller 404 is used for invoking the instructions cached in the memory 409 to control the working process of the operation accelerator.
  • the unified memory 406, the input memory 401, the weight memory 402 and the instruction fetch memory 409 are all on-chip (On-Chip) memories, and the external memory is the memory outside the NPU, and the external memory can be double data rate synchronous dynamic random access Memory (double data rate synchronous dynamic random access memory, DDR SDRAM), high bandwidth memory (high bandwidth memory, HBM) or other readable and writable memory.
  • DDR SDRAM double data rate synchronous dynamic random access Memory
  • HBM high bandwidth memory
  • the training method of the recommendation network is introduced in detail with reference to FIG. 5 .
  • the method shown in FIG. 5 may be performed by a training device of the recommendation network, which may be a cloud service device or a terminal device, for example, a computer, a server, etc., whose computing power is sufficient to perform the training of the recommendation network
  • the apparatus of the method may also be a system composed of a cloud service device and a terminal device.
  • the training method may be performed by the training device 320 in FIG. 3 and the neural network processor 40 in FIG. 4 .
  • the training method may be processed by the CPU, or may be jointly processed by the CPU and the GPU, or other processors suitable for neural network computing may be used without using the GPU, which is not limited in this application.
  • the training method includes steps 501 and 502 . Steps 501 and 502 are described in detail below.
  • Step 501 Obtain training samples.
  • the training samples include multiple training paths.
  • 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 history records.
  • the item or item attribute involved in the positive event of the user's history may be understood as the item or item attribute indicated by the first entity or the second entity that the user once involved in the positive event.
  • the positive event refers to the fact that the user does not clearly express negative or negative willingness (that is, dislike, uninterested, unwilling to pay attention) in the event, or express positive will such as concern, liking, and interest.
  • the user clicks, forwards, follows, comments, incentives (such as coins, likes), favorites, browsing, and items or item attributes whose browsing time exceeds the threshold time are all positive events. I don't want to see it", click "Not interested", and select "Do not appear on my homepage" is a negative event.
  • the items or item attributes involved in this kind of history record should be eliminated to avoid being entered.
  • the training samples include the knowledge graph used for training, the items or item attributes involved in the user's history records used for training.
  • the trained knowledge graph and the knowledge graph in the specific recommendation process may be the same or different, which is not specifically limited here.
  • the training knowledge graph includes multiple triples connected by the same entity.
  • the training sample includes a knowledge graph for training, a first training identifier, and a second training identifier.
  • the item indicated by the first training identifier and the item or item attribute indicated by the second training identifier are items related to the user's historical items (may become historical items) or item attributes (may also be referred to as historical item attributes).
  • the identifiers (the first identifier, the second identifier, the first training identifier, and the second training identifier) in the embodiments of the present application may be IDs, names, or the like, which are not specifically limited here.
  • training samples there are various situations of the training samples in the embodiments of the present application.
  • the above several indications are examples. It can be understood that, in practical applications, the training samples can be adaptively adjusted as required, which is not specifically limited here.
  • the items in the embodiments of the present application may be movies, games, music, news, etc., which are not specifically limited here.
  • the relationship between the two entities in the embodiment of the present application may be the type of movie, starring role, director, screenwriter, etc., or may be the developer, publisher, operating platform, game type, hairstyle year, etc. of the game, or may be music
  • the singer, arranger, lyrics, etc. are not limited here.
  • Step 502 take the training sample as the input of the recommendation network, and train the recommendation network with the value of the loss function less than the first threshold as the target, to obtain a trained recommendation network.
  • the recommendation network provided by the embodiment of the present application may be an independent recommendation system with its own interpretation information, or may output interpretation information for an existing recommendation system. That is, the recommendation network provided by the embodiment of the present application can output the explanation of the recommended item, where the recommended item can be the recommended item output by the existing recommendation system. Of course, the recommendation network provided by the embodiment of the present application can also output the score of the recommended item and the explanation of the recommended item or the item to be recommended.
  • the structure of a recommendation network in the embodiment of the present application, reference may be made to FIG. 6 .
  • the structure of a recommendation network provided by the present application may include bidirectional conduction (or referred to as bidirectional conduction calculation).
  • 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 of the calculation process, please refer to the embodiments shown in FIG. 8 and FIG. 9 ).
  • the first direction begins with a first entity indicating the item being recommended or the item to be recommended.
  • the second direction starts with a first entity indicating items to which the user's history relates; or the second direction starts with a second entity indicating attributes of items to which the user's history relates.
  • a plurality of items to be recommended are scored based on the respective first and second directions of the multiple paths, and TOPK is selected as the recommended item as required, and K is an integer greater than 1.
  • bidirectional conduction can also be understood as starting from the left and right endpoints of the path and gradually calculating the intermediate nodes.
  • the path is extracted from the knowledge graph based on the knowledge graph and user information.
  • one end of the path corresponds to the item to be recommended, and the other end of the path corresponds to an item (which may also be understood as a historical item) or an item attribute involved in the user's history record.
  • the intermediate node can be an item or an item attribute, which is not specifically limited here.
  • the user's information may include user ID, items clicked by the user (which can also be understood as historical items) or item attributes, user's age, occupation, and other user-related information.
  • the bidirectional conduction may also score the multiple paths based on their respective first directions and second directions, so as to obtain an explanation for the recommendation result.
  • the multiple paths are scored based on their respective first directions and second directions, and TOPK is selected as the recommended item as required, and K is an integer greater than 1.
  • the first direction is that one end of the path points to the other end of the path
  • 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 item to be recommended
  • the other end of the path corresponds to the historical item or the attribute of the historical item.
  • K is 2
  • the coincidence probability of the information in the left and right flow directions in the path in the embedding space is calculated, and the coincidence probability feature of the collection node is calculated.
  • the coincidence probability feature is used to output a semantic-level explanation, that is, the user's preference for a certain entity node. That is to calculate the probability that the vectors of the two flow directions are brought together. It is expressed as the probability of an activated connection between the item to be recommended and the user's history record (items or item attributes that the user has clicked on) (the greater the probability, the more significant). The purpose of this is to find the user's point of interest.
  • the probability that the path contains the node "Chow Xingchi" will be significant.
  • the coincidence probability can be used as the explanation of the recommended item, that is, the entity node with semantics in the path (which 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, type of book, etc.).
  • v in Fig. 6 represents a recommended item
  • one pairing block corresponds to one historical item i
  • Block 1, pairing block 2, . , e can be the first entity used to indicate the item, or the second entity used to indicate the attribute of the item, m is an integer greater than 1.
  • the following describes the bidirectional conduction calculation by taking the pairing block 1 in FIG. 6 as an example.
  • the pairing block 1 includes m paths between the historical item i 1 and the item v to be recommended, wherein the first path includes: vR 1st -e 1 -R 2nd -...-eR end -i 1 , the second path The paths include: vR 1st -e 2 -R 2nd -...-eR end -i 1 , and the mth path includes: vR 1st -e m -R 2nd -...-eR end -i 1 .
  • R 1st represents the relationship matrix between the recommended item v and entity e 1
  • R 2nd represents the relationship matrix between entity e 1 and other entities e
  • R end represents the relationship matrix between other entities e and historical item i 1 .
  • calculating the bidirectional conduction calculation of the first path is equivalent to calculating the probability that the vectors of the left and right flow directions in the first path are brought together, that is, from the first path The probability of the item v to be recommended and the historical item i 1 flowing to the intermediate entity.
  • the probability can be used as the score of the path, and the scores are selected from high to low according to the needs of TOPK, so as to obtain the explanation of the recommended item.
  • the denominator used to calculate the probability can be the sum of m probabilities corresponding to m paths in a paired block.
  • the denominator of the calculated probability can also be n.
  • the sum of n*m probabilities corresponding to n*m paths in the paired blocks is not specifically limited here.
  • the explanation in the embodiment of the present application may be a probability, or may be a description of the association between the two ends indicated by one or more paths for obtaining the recommended item.
  • R 2nd may also be R end
  • e 2 is em , that is, a path includes at least three entities ( v , e, i) and two relation matrices (R 1st , R end ).
  • One paired block corresponds to one u. After the u of each paired block is obtained, the user's feedback word vector u can be obtained by direct addition or cumulative weighted summation.
  • the score of the item to be recommended is only based on the distance between the item to be recommended and the feedback word vector (ie ) as an example for illustrative illustration, it can be understood that the score of the item to be recommended can also be u corresponding to a paired block, and the score of the item to be recommended can also be a feedback word vector obtained by adding multiple paired blocks etc., which are not specifically limited here.
  • one pairing block corresponds to one u. Therefore, the u can be used as the score of the item to be recommended, and the score is selected from high to low according to the needs of TOPK to obtain the recommended item.
  • the feedback word vector obtained by adding the u corresponding to multiple paired blocks can also be used as the score to select the recommended item, which is not specifically limited here.
  • the path between the recommended item v and the pairing block 1 is shown in Figure 7, the item v to be recommended is "Variety Star", the relationship matrix R 1st includes: the relationship matrix of the starring role and the relationship matrix of the type, and the entity e 1 is Zhou Xingchi, entity e 2 is Wu Mengda, entity e 3 is comedy, the relationship matrix R end includes: the relationship matrix of the starring role and the relationship matrix of the genre.
  • the first path in Figure 7 includes: "The Variety Star” - starring - Stephen Chow - starring - "The Tricky Expert”
  • the second path includes: “The Variety Star” - starring - Wu Mengda - starring - "Tricky”Expert”
  • the third path includes: "Variety Star King"-genre-comedy-genre-"Tricky Expert”.
  • One end of the first path flows to Zhou Xingchi through the relationship (starring), and the other end of the first path is the flow of "Tricky Expert” to Zhou Xingchi through the relationship (starring).
  • the recommendation network further includes abstract user weights and score calculation of items 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 (that is, the score of the item to be recommended). ).
  • the recommendation network can output the items to be recommended (that is, the recommended items) corresponding to the user output score from high to low according to the score of the item to be recommended, or it can also adjust the score from high to low according to the needs of TOPK. Make a selection to get recommended items.
  • 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 of multiple paths in the paired block.
  • p can also be set to 1, that is, the word vector of the item v to be recommended is not updated, which is not limited here.
  • the recommendation result in this embodiment of the present application may include items to be recommended, and the recommendation result may also include the item to be recommended and an explanation of the item to be recommended.
  • the recommendation result may also include the item to be recommended, the explanation of the item to be recommended, and the corresponding items to be recommended.
  • the score, etc., are not specifically limited here.
  • the loss function is used to indicate the difference between the recommendation result of the recommendation network and the target recommendation result.
  • 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.
  • This training process can be understood as a recommendation task.
  • the loss function can be understood as the loss function corresponding to the recommendation task.
  • the score of the item to be recommended in the recommendation result 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. Select from high to low to get recommended items.
  • the loss function includes a first loss function
  • the first loss function is used to indicate the difference between the calculated score and the actual score of the recommended item output by the recommendation network. difference, the actual score is the score corresponding to the historical item selected by the user, and the calculated score is the score output by the recommendation network.
  • the first loss function adopts the following formula:
  • y is a positive and negative sample, that is, the value is 1 or 0.
  • the loss function may further include a second loss function, where the second loss function is used to indicate the difference of word vectors between the first training vector and the second training vector in the path in the knowledge graph.
  • the first training vector is from the training path, indicating the first entity of the item to be recommended, pointing to the vector of the entity adjacent to the first entity indicating the item to be recommended in the training path
  • the second training vector is From the training path, the first entity of the item involved in the user's history, points to a vector in the training path that is adjacent to the first entity indicating the item involved in the user's history, or the second training vector is from
  • the second entity of the item attribute related to the user's historical record points to the vector of the entity adjacent to the second entity of the item attribute related to the user's historical record in the training path.
  • Recommended items are also items that the user has clicked on.
  • the first training vector is a vector in which the first entity corresponding to the item to be recommended points to an adjacent entity in the path
  • the second training vector is a vector in which the first entity corresponding to the historical item points to an adjacent entity
  • the The second training vector is the vector that the first entity corresponding to the attribute of the historical item points to the adjacent entity.
  • the purpose of the second loss function is to minimize the computational error of the left and right paths flowing to the same node, so that in the higher-dimensional relation matrix in the embedding space, the word vector computed on the left is as equal as possible to the word vector computed on the right.
  • the two triples in the training knowledge graph are "Farewell My Concubine - starring - Leslie Cheung" and
  • the second loss function adopts the following formula:
  • is the activation function
  • ⁇ im represents the first eigenvector of one end of the path flowing to the intermediate entity (or adjacent entity)
  • ⁇ ′ im represents the second eigenvector of the other end of the path flowing to the intermediate entity (or adjacent entity)
  • max represents the number with the largest difference in the multi-dimensional
  • the above formula can also have other deformations, for example, max can be replaced by avg (representing the average of the differences in multiple dimensions), ⁇ im can be replaced by g( ⁇ im ), etc., where g() represents the map
  • the specific formula of the second loss function may also have other deformations, which are not specifically limited here.
  • the loss function may further include a third loss function, and the third loss function 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 the item and a second entity indicating the attribute of the item.
  • the purpose of the third loss function is to make the vector obtained by adding the head of the triplet "Farewell My Concubine" and the relationship "Main Actor” as equal as possible to the vector of the dimension "Leslie Cheung”.
  • the third loss function adopts the following formula:
  • is the activation function
  • sim represents the head node in the triplet flows to the tail node to obtain the calculated word vector of the tail node
  • sim can be understood as the above-mentioned first training vector or second training vector
  • M r e is the tail
  • X 2 is the regularization function to avoid overfitting
  • X 2 is the least squares error function.
  • sim can be replaced by g( sim )
  • M r e can be replaced by g(M r e)
  • g() represents the calculation of the map
  • the specific formula of the function may also have other modifications, which are not specifically limited here.
  • the value of the loss function is the value of the first loss function.
  • the value of the loss function may be the sum, average, weighted average, etc. of the value of the first loss function and the value of the second loss function, which is not specifically described here. limited.
  • the loss function includes the first loss function, the second loss function and the third loss function, the value of the loss function may be the value of the first loss function, the sum of the value of the second loss function and the third loss function, Average value, weighted average value, etc., and the method used to specifically determine the value of the loss function is not limited here.
  • the value of the loss function can be calculated as follows:
  • ⁇ 1 , ⁇ 2 , and ⁇ 3 are adjustable coefficients, which can be set according to actual needs, which are not specifically limited here.
  • the recommendation network provided by the present application can score the recommended items by means of bidirectional conduction calculation, so as to obtain the recommended items.
  • the path can also be scored to get an explanation of the item to be recommended, that is, an explanation to obtain the semantic information between any two connected entities.
  • the loss function provided by the embodiment of the present application can improve the accuracy of the recommendation network in the training process (for details, please refer to the following evaluation of the recommendation network and the corresponding description in Table 1).
  • the second loss function provided by the embodiment of the present application can solve the problem of two ends of a 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 minimize the error of mapping the vectors of the two nodes at the head and tail of the triplet to a relationship space, and can solve the complex relationship, a single triplet has one-to-many, many-to-many one question.
  • training process may not adopt the aforementioned method but adopt other training methods, which is not limited here.
  • the execution subject of the method may be a cloud service device or a terminal device, for example, a recommendation device with sufficient computing power such as a computer and a server to execute the recommendation method. , or a system composed of cloud service equipment and terminal equipment.
  • the execution body of the method may be the execution device 310 in FIG. 3 and the neural network processor 40 in FIG. 4 .
  • the execution body of the method may be a CPU, a CPU and a GPU, or not a GPU, and other processors suitable for neural network computing are used, which is not specifically limited here.
  • the recommendation method in this embodiment of the present application can be applied to scenarios such as movie recommendation, game recommendation, music recommendation, and news recommendation, which is not specifically limited here.
  • the method includes:
  • Step 801 acquiring a knowledge graph.
  • the knowledge graph in this embodiment of the present application includes a plurality of first entities for indicating items and a plurality of second entities for indicating attributes of items.
  • the knowledge graph may be an existing knowledge graph or a newly constructed knowledge graph, which is not specifically limited here.
  • the knowledge graph in the embodiment of the present application may have a function associated with the user's 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 is directly selected according to the knowledge graph), or it may not have the function associated with the user's history record (it can also be understood that the user's identification, the identification of the item, and the knowledge graph are required to determine the path), which is not limited here.
  • the knowledge graph in this embodiment of the present application may be a knowledge graph constructed for one user, or may be a knowledge graph constructed for multiple users, which is not specifically limited here.
  • item information recommended items and historical items
  • related external knowledge including but not limited to item attribute information (for example, the director, actor, and genre of the movie; Game developer, operator, classification; news composition, when, where, who, etc.), user dimension characteristics (for example: user's age distribution, occupation, etc.).
  • item attribute information for example, the director, actor, and genre of the movie; Game developer, operator, classification; news composition, when, where, who, etc.
  • user dimension characteristics for example: user's age distribution, occupation, etc.
  • filter the obtained information that is, to recommend different users in groups, for example, to group users with similar age distributions as a group, so as to improve the recommendation efficiency.
  • the recommended items are items that have not been clicked by the user (eg, movies that have not been watched by the user), and the historical items are items that have been clicked by the user (eg, movies that have been watched by the user before).
  • some strategies for example: random method
  • some strategies can be used to recommend some items to the user first, and after getting feedback information, get item information and/or item attribute information, etc. .
  • triples can be constructed first, and then triples of the same node are connected to construct a knowledge graph for recommendation.
  • one triplet includes: movie name: "Farewell My Concubine”-relationship: starring-entity: Leslie Cheung, and another triplet includes: movie name: "The True Story”-relationship: starring-entity: Leslie Cheung .
  • These two triples have a common entity node (Leslie Cheung), then these two triples are connected through Leslie Cheung.
  • Step 802 Run a recommendation network based on the knowledge graph and the user's information to obtain a recommendation result.
  • the recommendation network used in this step may be constructed by the method shown in FIG. 5 above, or constructed by other methods, which are not specifically limited here.
  • the first is to run a recommendation network with a path as input.
  • each path indicates the association between entities at both ends of the path.
  • multiple paths are input into the recommendation network to score multiple items to be recommended, so that the recommendation network can obtain recommendation results.
  • the second is to run the recommendation network with knowledge graph and user information as input.
  • the knowledge graph and the user's information are input into the recommendation network. Based on the knowledge graph and the user's information, the recommendation network extracts multiple paths in the knowledge graph, and each path indicates the association between the entities at both ends of the path.
  • the user's information may include the first identifier and the second identifier.
  • the first identifier indicates an item to be recommended
  • the second identifier indicates a historical item or an attribute of the historical item
  • 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.
  • multiple items to be recommended are scored based on the respective first directions and second directions of the multiple paths, so that the recommendation network obtains a recommendation result.
  • the recommendation result may include the recommended item, and the recommendation result may also include an explanation for the recommended item. (It can also be understood as an evaluation result), the recommendation result may also include the recommended item and an explanation of the recommended item, which is not specifically limited here.
  • the items to be recommended corresponding to each path are 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 a score. Get recommended items.
  • the multiple paths are respectively scored based on their respective first directions and second directions, so as to obtain an explanation for the recommendation result, where the explanation is the entities at both ends indicated by the one or more paths that obtain the recommendation result.
  • Obtaining a recommendation result based on multiple paths may include the following steps:
  • Step 8021 Calculate the first vector and the second vector of the path in the knowledge graph.
  • the first vector is consistent with the direction of the first direction
  • the second vector is consistent with the direction of the second direction, for a path
  • the first vector is from the path, indicating the first entity of the item to be recommended, pointing to the path
  • the second vector is a vector from the path, the first entity of the historical item, pointing to the vector of the entity adjacent to the first entity of the historical item in the path, or
  • the second vector is a vector pointing from the second entity of the historical item attribute in the path to the entity adjacent to the second entity of the historical item attribute in the path.
  • the first entity used to indicate an item in the embodiment of the present application is divided into a first recommendation entity and a first historical entity, that is, the first entity indicating the item to be recommended or the item to be recommended is the first recommendation entity, indicating The first entity of the item involved in the user's history record is the first history 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 first relationship between the first historical entity and the second associated entity.
  • the first associated entity and/or the second associated entity may be an entity for indicating an item or an entity for indicating an attribute of the item, which is not specifically limited here.
  • the first recommended entity is "Farewell My Concubine", and user A's historical viewing record (ie, the first historical entity) Including: “A Fei Zhengzhuan”, “Hongmen Kirt", “Mei Lagging".
  • "Farewell My Concubine” and “Farewell My Concubine” are connected to one entity (hereinafter referred to as an intermediate entity): Hong Kong films and Leslie Cheung, "Farewell My Concubine” and “Hongmen Kirt” have a common intermediate entity: history, "Farewell My Concubine”
  • FIG. 10 includes 3 matching blocks, the first matching block and the third matching block respectively include two paths, and the second matching block includes one path, that is, FIG. 10 includes 5 paths:
  • 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 (for example, the first recommended entity) to the intermediate entity, and the second vector is the other end of the path (for example, the first recommended entity).
  • first historical entity vector pointing to intermediate entities.
  • the intermediate entity may be understood as an entity adjacent to the first recommendation 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 may be multidimensional vectors.
  • the first vector can be the vector that "Farewell My Concubine" points to Leslie Cheung
  • the second vector can be the vector that "Farewell My Concubine” points to Leslie Cheung.
  • the intermediate entity is Leslie Cheung.
  • the first vector can also be the vector pointing to Leslie Cheung in The True Story of Ah Fei
  • the second vector can also be the vector pointing to Leslie Cheung in Farewell My Concubine, that is, for Figure 10, the left flow direction is the first direction.
  • 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.
  • a schematic description is given by taking the left flow direction as the first direction and the right flow direction as the second direction as an example.
  • the first vector and the second vector can be calculated by the following formula.
  • M r represents the relationship matrix between the recommended item and the item or item attribute corresponding to the intermediate entity
  • represents the word vector of the recommended item
  • i u represents the word vector of the historical item
  • m is an integer greater than 0, and the value of m is the same as the number of paths.
  • first vector and the second vector can also be calculated by other formulas, which are not specifically limited here.
  • the first vector of the first path is: word vector of "Farewell My Concubine” * type matrix + type word vector
  • the second vector of the first path is: "Farewell My Concubine” "word vector * type matrix + type word vector.
  • the first vector of the second path is: the word vector of "Farewell My Concubine” * the matrix of the leading actor + the word vector of the leading actor
  • the second vector of the second path is: the word vector of "Farewell My Concubine” * starring Matrix + starring word vectors.
  • the first vector of the third path is: word vector of "Farewell My Concubine” * type matrix + type word vector
  • the second vector of the third path is: "Hongmen Banquet” word vector * type matrix + Type of word vector.
  • the first vector of the fourth path is: the word vector of "Farewell My Concubine” * the director's matrix + the director's word vector
  • the second vector of the fourth path is: the word vector of "Mei Lsweeping" * the director's word vector Matrix + director's word vector.
  • the first vector of the fifth path is: word vector of "Farewell My Concubine” * matrix of type + word vector of type
  • the second vector of the fifth path is: word vector of "Mei Lsweeping” * type of word vector Matrix + kind of word vectors.
  • 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.
  • the probability that the mapping relationship between the first vector and the second vector coincides together that is, the probability that the first vector and the second vector are brought together
  • the word vector of the user dimension can reflect the user's preference for intermediate entities. You can use this probability value to indicate how important each path is.
  • the intermediate entity is the intermediate node of the path. If the number of nodes in the path is an even number, the intermediate entity can be any of the two middlemost nodes of the path (generally determine the middle node of the path). The node closest to the recommended item among the two nodes is the intermediate entity).
  • the probability that the first vector and the second vector of each path converge to the intermediate entity can be calculated by the following formula.
  • the above-mentioned denominator is similar to the description corresponding to the aforementioned FIG. 6 , and the denominator can be the sum of the probabilities of m paths in n paired blocks (that is, the number of probabilities of the denominator can be n*m), or it can be a pairing.
  • the sum of the probabilities of m paths in the block that is, the number of probabilities of the denominator may be m, which is not specifically limited here. Since the example in FIG. 10 is only part of a path, if a paired block has only one path, the probability will be inaccurate. Therefore, the denominator of the calculated probability in this step uses the sum of the probabilities of all paths as an example for schematic illustration.
  • the explanation may include: explanation 1: the path attribute node corresponding to p 1 (Hong Kong film), and explanation 2: the path attribute node corresponding to p 2 (Leslie Cheung).
  • Step 8023 Determine the feedback word vector of the user based on the probability and the word vector corresponding to the intermediate entity.
  • the user's feedback word vector may be determined based on the probability and the word vector of the corresponding intermediate entity.
  • each group of feedback word vectors containing the user's preference as the user's feature value can be aggregated first.
  • the user's feedback word vector can be calculated by the following formula.
  • c n represents the feedback word vector of the recommended item and the nth historical item in a pairing block
  • em represents the word vector of the intermediate entity
  • p m represents the probability that the left vector and the right vector converge to the same intermediate entity
  • u represents User feedback word vector
  • N is an integer greater than 1
  • N represents the number of historical items.
  • feedback word vector of the user may also be calculated by other formulas, which is not specifically limited here.
  • e 1 is the word vector corresponding to Hong Kong films
  • e 2 is the word vector corresponding to Leslie Cheung
  • e 3 is the word vector corresponding to history
  • e 4 is the word vector corresponding to Chen Kaige
  • e 5 is the word vector corresponding to Peking Opera
  • entity nodes with semantics in the path can be used to describe the user's potential preferences (eg, the name of the star of the movie, the genre of the movie, the name of the director, etc.).
  • the word vector of these attribute nodes is calculated (eg, multiplied) with the probability of the corresponding path, and the feedback information of a single path can be obtained.
  • 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.
  • the distance between the word vector corresponding to the item to be recommended and the feedback word vector may also be calculated to obtain the score of the item to be recommended.
  • the distance between the word vector corresponding to the item to be recommended and the feedback word vector may be calculated by methods such as vector dot product, cosine value or similarity, and the following takes vector dot product as an example.
  • the distance between the word vector corresponding to the item to be recommended and the feedback word vector can be calculated by the following formula:
  • represents the score
  • represents the word vector of the item to be recommended
  • is the activation function
  • u T represents the transpose matrix corresponding to the user's feedback word vector u
  • represents the inner product operation.
  • the distance between the word vector corresponding to the item to be recommended and the feedback word vector can also be calculated by other formulas, which is not specifically limited here.
  • the above activation function can be a SIGMOID function, which is used to limit the score within [0, 1].
  • User A's feedback word vector is [0.6626494, 0.5364959, -0.05639589, 0.621532, 0.59782714, 0.44225037, -0.5474265, 0.589441, 0.39717668, 0.16018206].
  • the word vector of "Little Times” is [-0.00414435, 0.0892299, -0.004835337, 0.8153024, 0.37877557, -0.096624255, -0.34244198, 0.44271728, 0.42087126, 0.5350623].
  • the word vector of "Interstellar” is [0.008653568, 0.2210477, -0.04570025, 0.640234, 0.38816172, -0.13182494, -0.48932806, 0.56698304, 0.6465809, 0.8148861].
  • Inner product (user A, small times): 1.437129814068635.
  • Inner product (User A, Interstellar): 1.6879938602873226.
  • the value after the activation function (that is, the recommendation score):
  • Step 8025 Determine the recommended item based on the score of the item to be recommended.
  • the items to be recommended can be sorted according to the scores. If Top 5 is selected, the items to be recommended with the top 5 scores are selected as the recommended items in the recommended movie set, and displayed to user.
  • the ranking of recommended items is: “Farewell My Concubine”, “Interstellar”, “Little Times”. If it is TOP1, “Farewell My Concubine” is the recommended item.
  • Step 8026 Obtain an explanation for the recommended item or the item to be recommended based on the probability. This step is optional.
  • the probability can be abstracted into a word vector of the user dimension, and the probability (that is, the explanation of the item to be recommended or the recommended item) is output. It can reflect the user's preference for intermediate entities. The value of this probability can be used to express the importance of each path.
  • the explanation of the item to be recommended or the item to be recommended can also be displayed in the form of a graph, and the graph shown in FIG. Please refer to Table 1 for background introduction:
  • the explanation may be a probability, or may be a description of the association between the two end entities indicated by one or more paths to obtain the recommendation result.
  • Step 8027 Evaluate the accuracy of the recommended item based on the score. This step is optional.
  • 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.
  • the recommendation rate the number of correct information pieces recommended/the number of pieces of information recommended.
  • the training set is used for the training method in the embodiment shown in FIG. 5, and the test set is used for the training method in the embodiment shown in FIG.
  • the item to be recommended with the highest value is the recommended item) and the number of pieces of information recommended (that is, the number of K) to calculate the accuracy rate of the recommended item.
  • 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 there is over-fitting, and learns whether the single recommended item is a "true positive” or a "false positive” through a binary classifier and a threshold.
  • the threshold is 0.5. If the output result of the recommended item in the binary classifier is 0.7, that 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, that is, less than the threshold, the recommended item is incorrect.
  • the evaluation method in the embodiment of the present application can be applied to the training phase of the recommendation network (for example, the training method shown in FIG. 5 ), and can also be applied to the inference phase of the recommendation network (for example, the recommendation method shown in FIG. 6 ), specifically here Not limited.
  • the existing recommendation model is compared with the TB-Net in the embodiment of the present application.
  • 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), recommendation model that combines shallow model and deep model (Wide&Deep).
  • CKE collaborative filtering and knowledge base embedding
  • BPRMF Bayesian personalized ranking matrix factorization
  • NVM neural factorization machine
  • DKN deep knowledge-aware network
  • Wide&Deep recommendation model that combines shallow model and deep model
  • the comparison results of the TB-Net and four mainstream models (ripple net, CKE, BPRMF, NFM) provided in this application are used to train the news recommendation dataset: MIND (microsoft news dataset) to complete the task of recommending news, and use the accuracy rate and recall rate to measure the accuracy of the recommended items. It can be seen from the comparison results of Fig. 12 and Fig. 13 that in terms of precision and recall, the TB-Net provided by this application performs better than other mainstream models (ripple net, CKE, BPRMF). The comparison result proves that the TB-Net provided by the embodiment of the present application has a significant improvement in the recommendation accuracy compared with the existing recommendation systems (ripple net, CKE, BPRMF).
  • the recommendation network (ie TB-Net) in the embodiment of the present application is superior to the prior art in terms of the accuracy index of AUC and recommendation, and is comparable to the industry-leading deep learning recommendation model ( The ripple net proposed by Microsoft and the Wide&Deep proposed by Google are basically the same, and have improved to a certain extent.
  • the recommendation network provided by the embodiments of the present application has the characteristics of high recommendation accuracy.
  • Step 8028 Evaluate the accuracy of interpretation based on probability and knowledge graph. This step is optional.
  • the probability corresponding to the path after obtaining the probability corresponding to the path, it can be sorted according to the size of the probability, and the accuracy of the interpretation of the item to be recommended or the item to be recommended can be evaluated according to 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 (ie, the number of connected relationships) associated with the node.
  • the existing recommendation explanation model and the recommendation network in the embodiment of the present application are interpreted and compared in a movie recommendation scenario (MovieLens dataset).
  • the recommendation network provided by the embodiments of the present application may also be referred to as a tower-bridge network (tower-bridge net, TB-Net), or a bidirectional salient interpretable recommendation network.
  • the existing recommendation interpretation models include: ripple net recommendation model, multitask collaborative filtering model (attentive multitask collaborative filtering, AMCF), interpretable linear regression model (interpretable linear regression model, LR).
  • the recall rate of explanation is equivalent to TopG@K
  • K represents the number of explanations output by the recommendation model
  • G represents the first few explanations approved by users in the dataset.
  • Top1@3 indicates the probability that there is the first explanation in the data set 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 the user's feedback.
  • the recommendation network provided by the embodiment of the present application significantly improves the accuracy of the output explanation information 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 at the same time, that is, while maintaining a high recommendation accuracy rate, a semantic-level explanation is provided.
  • step 8026 can be before step 8025 or before step 8024, and it is sufficient to ensure that step 8026 is after step 8022.
  • step 8027 can be before step 8026 or before step 8025, and it is sufficient to ensure that step 8027 is after step 8024.
  • Step 8028 may precede step 8027.
  • the steps shown in FIG. 9 may include step 8021 , step 8022 , and step 8026 . If the recommendation network only outputs recommended items, the steps shown in FIG. 9 may include steps 8021 to 8025 .
  • the step of obtaining a recommendation result based on multiple paths may include steps 8021 to 8025 .
  • the step of obtaining a recommendation result based on multiple paths may include steps 8021 to 8026 .
  • the step of obtaining a recommendation result based on multiple paths may include steps 8021 to 8027.
  • the step of obtaining a recommendation result based on multiple paths may include steps 8021 to 8028 .
  • high-semantic interpretation information can be provided for the item to be recommended or the item to be recommended through bidirectional conduction calculation, which can be grafted with the recommendation system in the prior art, that is, output for the existing recommendation system
  • the recommended items provide high-semantic explanation information.
  • the coincidence probability of the left and right flow directions of the path in the intermediate entity at the convergence point ie the intermediate entity
  • the user's preference feedback information ie, the user's feedback word vector
  • the feedback word vector can be formed by aggregating the preference feedback information at both ends of the path, and calculating with the item to be recommended to output the recommended item, which can obtain more accurate recommendation results, that is, improve the recall rate of recommendation.
  • the recommendation method in the embodiment of the present application has been described above, and the recommendation device in the embodiment of the present application is described below.
  • the neural network is equivalent to the aforementioned recommendation network. Please refer to FIG. 14 .
  • One embodiment includes:
  • the acquiring unit 1401 is configured to acquire a knowledge graph, where the knowledge graph includes a plurality of first entities for indicating items and a plurality of second entities for indicating attributes of items;
  • the running unit 1402 is used to run the neural network based on the knowledge graph and the user's information to obtain a recommendation result, the user's information indicates the item or item attribute involved in the user's history record, the recommendation result includes the recommended item, and the neural network is used for knowledge-based At least one first direction and at least one second direction in the graph are calculated to obtain the recommendation result, the first direction starts from the first entity indicating the recommended item or the item to be recommended, and the second direction starts from indicating the user's history record The first entity of the item involved, or the second direction starts with a second entity that indicates the attribute of the item to which the user's history refers.
  • each unit in the recommendation apparatus is similar to those described in the foregoing embodiments shown in FIG. 5 , FIG. 8 , and/or FIG. 9 , and details are not repeated here.
  • the running unit 1402 may 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.
  • the recommendation results provide a new recommendation method.
  • another embodiment of the recommending apparatus 1500 in this embodiment of the present application includes:
  • the acquiring unit 1501 is used to acquire a knowledge graph, a first identifier and a second identifier, the knowledge graph includes a plurality of first entities used to indicate the item and a plurality of second entities used to indicate the attribute of the item, and the first identifier indicates the recommending an item, the second identifier indicates the item or item attribute involved in the user's 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;
  • the operation unit 1502 is used to run the neural network based on the knowledge graph, the first identification and the second identification to obtain an evaluation result, where the evaluation result includes the probability that the item to be recommended is recommended, and the neural network is used for at least one first in the knowledge graph.
  • a direction and at least one second direction are calculated to obtain an evaluation result, the first direction starting from the first entity corresponding to the first identification, and the second direction starting from the first entity or the second entity corresponding to the second identification.
  • each unit in the recommendation apparatus is similar to those described in the foregoing embodiments shown in FIG. 5 , FIG. 8 , and/or FIG. 9 , and details are not repeated here.
  • the running unit 1502 may run a neural network based on the knowledge graph, the first identifier, and the second identifier based on the knowledge graph to obtain an evaluation result, wherein the neural network is used for at least one first direction and at least one direction in the knowledge graph.
  • a second direction calculation is performed to obtain the probability that the item to be recommended is recommended, and the probability can be used to output the explanation of the item to be recommended, thereby providing an explanatory recommendation method.
  • another embodiment of the recommending apparatus 1600 in this 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.
  • the processor 1601 is used for The operation of the recommendation device 1600 is controlled by the operation.
  • the processor 1601 may be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure.
  • the processor may also be a combination that implements computing functions, such as a combination comprising one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
  • the recommendation device shown in FIG. 16 can be specifically used to implement the functions of the steps performed by the recommendation device in the method embodiments corresponding to FIG. 5 , FIG. 8 , and/or FIG. 9 , and realize the technical effect corresponding to the recommendation device.
  • the recommendation apparatus shown in 16 reference may be made to the descriptions in the respective method embodiments corresponding to FIG. 5, FIG. 8 and/or FIG. 9, and details are not repeated here.
  • Embodiments of the present application further provide a computer-readable storage medium that stores one or more computer-executable instructions.
  • the processor executes the method described in the possible implementations in the foregoing embodiments.
  • the recommending device may specifically perform the steps in the method embodiments corresponding to the foregoing FIG. 5 , FIG. 8 , and/or FIG. 9 .
  • the embodiments of the present application also provide a computer program product that stores one or more computers.
  • the processor executes the method of the above possible implementation manner, wherein the recommending device may specifically execute the foregoing method.
  • FIG. 5 , FIG. 8 and/or FIG. 9 correspond to steps in the method embodiment.
  • An embodiment of the present application further provides a chip system, where the chip system includes a processor, and is configured to support the recommendation apparatus to implement the functions involved in the possible implementation manners of the foregoing recommendation apparatus.
  • the chip system may further include a memory for storing necessary program instructions and data of the recommending device.
  • the chip system may be composed of chips, or may include chips and other discrete devices, wherein the recommended apparatus may specifically execute the steps in the method embodiments corresponding to FIG. 5 , FIG. 8 , and/or FIG. 9 .
  • the disclosed system, apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, removable hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Strategic Management (AREA)
  • Development Economics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Physics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • General Business, Economics & Management (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Game Theory and Decision Science (AREA)
  • Probability & Statistics with Applications (AREA)
  • Animal Behavior & Ethology (AREA)
  • Human Resources & Organizations (AREA)
  • Primary Health Care (AREA)
  • Tourism & Hospitality (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例公开了一种推荐方法,本申请实施例方法可以应用于电影推荐、游戏推荐等向用户推荐物品的场景。本申请实施例方法包括:获取知识图谱,知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体。基于知识图谱以及用户的信息运行神经网络,以得到推荐结果。其中,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,提供了一种新的推荐方法,能够得到更为精准的推荐结果。

Description

一种推荐方法、推荐网络及相关设备
本申请要求于2020年12月31日提交中国专利局、申请号为CN202011640574.7、发明名称为“一种推荐方法、推荐网络及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能领域,尤其涉及一种推荐方法、推荐网络及相关设备。
背景技术
人工智能(artificial intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。
随着互联网信息技术的发展,尤其是电子商务的兴起,互联网内容呈现爆炸式的增长,逐渐进入海量数据时代。用户面对琳琅满目并且种类繁杂的商品、电影、音乐、视频等各种物品时,却无所适从,这就是经常提到的信息过载问题。
因此,如何精准的在大量的物品中为用户推荐合适的物品是亟需解决的技术问题。
发明内容
本申请实施例提供了一种推荐方法、推荐网络以及相关设备,可以基于所述知识图谱以及用户的信息运行神经网络,以得到推荐结果,其中,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,提供了一种新的推荐方法,能够得到更为精准的推荐结果,即提升推荐结果的精准率和/或召回率,可以应用在电影推荐、游戏推荐等向用户推荐物品的场景。
本申请实施例第一方面提供了一种推荐方法,该方法可以由推荐装置执行,也可以由推荐装置的部件(例如处理器、芯片、或芯片系统等)执行。该方法包括:获取知识图谱,知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体;基于知识图谱以及用户的信息运行神经网络,以得到推荐结果,用户的信息指示用户的历史记录涉及的物品或者物品属性。推荐结果包括被推荐物品,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,第一方向起始于指示被推荐物品或者待推荐物品的第一实体,第二方向起始于指示用户的历史记录涉及的物品的第一实体,或者第二方向起始于指示用户的历史记录涉及的物品属性的第二实体。其中,用户的信息可以包括用户标识、用户点击过的物品或物品属性以及与用户相关的属性,例如:用户的年龄、职业、性别等。待推荐物品可以理解为用户未点击过的物品,本推荐方法要做的就是从待推荐物品中,找到适合推荐给用户的被推荐物品,提升精准率以及召回率。可以理解为,知识图谱中,不指示用户历史涉及过的物品的第一实体,都可以是待推荐物品。当然,一些实现方式下, 可以初步筛选,缩小知识图谱中待推荐物品的范围,从而选定一些第一实体所指示的物品为待推荐物品。上述用户的信息可以指示用户的历史记录的正向事件中涉及的物品或者物品属性,应理解,用户的信息可以经过筛选。用来做推荐的用户的信息指示的是用户的历史记录的正向事件中涉及的物品或物品属性。其中,用户的历史记录的正向事件中涉及的物品或物品属性可以理解为用户曾经在正向事件中涉及过的第一实体或第二实体指示的物品或物品属性。其中正向事件是指,用户在该事件中没有明确表示出否定或负向意愿(也就是不喜欢,不感兴趣,不愿关注),或者表示出关注、喜欢、感兴趣等正向意愿。比如,用户点击、转发、关注、评论、激励(如投币、点赞)、收藏、浏览和浏览时间超过阈值时间的物品或物品属性,都是正向事件,而用户点击“踩”,点击“不想看到”,点击“不感兴趣”,选择“不出现在我的主页”就是负向事件,这种历史记录涉及的物品或者物品属性要剔除,要避免被输入。另外,第一方向起始于指示被推荐物品或者待推荐物品的第一实体,可以理解为第一方向的起点为指示被推荐物品或者待推荐物品的第一实体,对于第一方向指向哪个实体并不限定。同理,第二方向起始于指示被推荐物品或者待推荐物品的第一实体,或者第一方向起始于指示用户的历史记录涉及的物品属性的第二实体。可以理解为第二方向的起点为指示被推荐物品或者待推荐物品的第一实体,或者第二方向的起点为第二实体,对于第二方向指向哪个实体并不限定。例如:在推荐电影的场景下,第一方向的起点是用户未观看过的电影,第二方向的起点为用户观看过的电影,或该对应对应的电影类型等。
本申请实施例中,可以基于所述知识图谱以及用户的信息运行神经网络,以得到推荐结果,其中,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,提供了一种新的推荐方法,能够得到更为精准的推荐结果,即提升推荐结果的精准率和/或召回率。
可选地,在第一方面的一种可能的实现方式中,上述步骤中的推荐结果还包括对被推荐物品的解释,解释与一个第一方向和一个第二方向相关。
该种可能的实现方式中,一方面,可以基于第一方向与第二方向得到被推荐物品的解释,由于解释是与两个方向有关的,可以提高解释的合理性。另一方面,该推荐方法除了可以得到被推荐物品,还可以得到对被推荐物品的解释,该解释可以解释被推荐物品被推荐的原因。
可选地,在第一方面的一种可能的实现方式中,上述步骤基于知识图谱以及用户的信息运行神经网络,以得到推荐结果,包括:基于知识图谱以及用户的信息,在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应用户的历史记录涉及的物品或物品属性;将多条路径输入神经网络以对多个待推荐物品打分,以使神经网络得到推荐结果,神经网络用于基于多条路径各自的第一方向和第二方向计算以得到推荐结果,对于一条路径,第一方向是路径的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。
该种可能的实现方式中,可以通过多条路径对被推荐多个待推荐物品打分以及神经网络用于基于多条路径各自的第一方向和第二方向计算以得到推荐结果的方式,使得打分时考虑路径两个方向,相较于现有技术中只从单方向获得的推荐结果更加准确。在实际应用中,多个待推荐物品都会基于基于多条路径各自的第一方向和第二方向计算,得到多个被推荐物品,然后基于被推荐物品的排序,得到最终的推荐结果。这样,可预设给出几个被推荐物品,所 以能给出更准确的被推荐物品。
可选地,在第一方面的一种可能的实现方式中,上述步骤基于知识图谱以及用户信息运行神经网络,以得到推荐结果,包括:将知识图谱以及用户的信息输入神经网络;神经网络基于知识图谱以及用户的信息,在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应用户的历史记录涉及的物品或物品属性;基于多条路径各自的第一方向和第二方向对多个待推荐物品打分,以使神经网络得到推荐结果,对于一条路径,第一方向是路径的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。
该种可能的实现方式中,可以通过多条路径各自的第一方向和第二方向对多个待推荐物品打分的方式,使得打分时考虑路径两个方向,相较于现有技术中只从单方向获得的推荐结果更加准确。在实际应用中,多个待推荐物品都会基于多条路径各自的第一方向和第二方向对多个待推荐物品打分,以得到多个被推荐物品,然后基于被推荐物品的排序,得到最终的推荐结果。这样,可预设给出几个被推荐物品,所以能给出更准确的被推荐物品。
可选地,在第一方面的一种可能的实现方式中,上述步骤的第一方向与第一向量的方向一致,第二方向与第二向量的方向一致,对于一条路径,第一向量为从路径中,指示待推荐物品的第一实体,指向路径中,与指示待推荐物品的第一实体相邻的实体的向量,第二向量为从路径中,用户的历史记录涉及的物品的第一实体,指向路径中,与指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,第二向量为从路径中,用户的历史记录涉及的物品属性的第二实体,指向路径中,与用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;基于多条路径各自的第一方向和第二方向对多条路径对应的多个待推荐物品打分,以使神经网络得到推荐结果,包括:对多条路径中的每条路径,都基于每条路径的第一向量和第二向量汇集到每条路径中的一个实体的概率对每条路径对应的待推荐物品打分,以得到被推荐物品。
该种可能的实现方式中,计算路径中左右两个流向的信息在嵌入空间内的重合概率,并计算出汇集节点的重合概率特征。该重合概率特征用来输出语义级的解释,即用户对某个实体节点的喜好程度。在实际应用中,多个待推荐物品都会基于每条路径的第一向量和第二向量汇集到每条路径中的一个实体的概率对每条路径对应的待推荐物品打分,以得到多个被推荐物品,然后基于被推荐物品的排序,得到最终的推荐结果。这样,适于用户的排到前面,可以准确找到用户的兴趣点。
可选地,在第一方面的一种可能的实现方式中,上述步骤还包括:基于多条路径各自的第一方向和第二方向分别对多条路径打分,以得到对推荐结果的解释,解释是对得到推荐结果的一条或多条路径所指示的两端的实体之间的关联的描述。
该种可能的实现方式中,可以通过多条路径各自的第一方向和第二方向对多条路径打分的方式,使得打分时考虑路径两个方向,相较于现有技术中只从单方向获得的推荐结果的解释更加全面以及准确。在实际应用中,多个路径都会基于多条路径各自的第一方向和第二方向进行打分,以得到多个解释,然后基于解释的排序,得到最终的推荐结果。这样,可预设给出几个被推荐物品,所以能给出更准确的被推荐物品。
可选地,在第一方面的一种可能的实现方式中,上述步骤第一方向与第一向量的方向一 致,第二方向与第二向量的方向一致,对于一条路径,第一向量为从路径中,指示待推荐物品的第一实体,指向路径中,与指示待推荐物品的第一实体相邻的实体的向量,第二向量为从路径中,用户的历史记录涉及的物品的第一实体,指向路径中,与指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,第二向量为从路径中,用户的历史记录涉及的物品属性的第二实体,指向路径中,与用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;基于多条路径各自的第一方向和第二方向对多条路径打分,以得到对推荐结果的解释,包括:分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体的概率,以得到对推荐结果的解释。
该种可能的实现方式中,计算路径中左右两个流向的信息在嵌入空间内的重合概率,并计算出汇集节点的重合概率特征。该重合概率特征用来输出语义级的解释,即用户对某个实体节点的喜好程度。即计算两个流向的向量汇集到一起的概率。有助于更准确找到用户的兴趣点,给出合适的推荐。
可选地,在第一方面的一种可能的实现方式中,上述步骤分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体的概率,包括:
Figure PCTCN2021141472-appb-000001
其中,p m代表概率,
Figure PCTCN2021141472-appb-000002
代表第一向量,
Figure PCTCN2021141472-appb-000003
代表第二向量,或者,
Figure PCTCN2021141472-appb-000004
代表第一向量,
Figure PCTCN2021141472-appb-000005
代表第二向量;exp代表以e为底的指数函数,M为正整数,M代表待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量。
可选地,在第一方面的一种可能的实现方式中,上述步骤神经网络是通过以训练样本作为神经网络的输入,以损失函数的值小于阈值为目标对神经网络进行训练得到,训练样本包括多条训练路径,或者训练样本包括用于训练的知识图谱、用于训练的用户的历史记录涉及的物品和/或物品属性,每条训练路径指示训练路径两端的实体之间的关联,每条训练路径的两端对应用户的历史记录涉及的物品或物品属性;损失函数包括第一损失函数,第一损失函数用于指示神经网络输出的推荐结果与目标结果之间的差异,目标结果与用户的历史记录涉及的物品或物品属性相关。
该种可能的实现方式中,通过第一损失函数对神经网络进行训练,使得推荐结果更加准确,符合用户的喜好程度。
可选地,在第一方面的一种可能的实现方式中,上述步骤损失函数还包括第二损失函数,第二损失函数用于指示用于训练的知识图谱的训练路径中第一训练向量与第二训练向量之间词向量的差值,训练路径的两端对应用户的历史记录涉及的物品或物品属性。
该种可能的实现方式中,第二损失函数的目的最小化路径左右流向同一节点的计算误差,使得在嵌入空间中更高维度的关系矩阵内,左边计算后的词向量尽可能与右边计算的词向量相等。即通过第二损失函数可以最小化路径两端流向同一节点的误差,可以解决复杂关系中路径两端流向同一节点的问题。
可选地,在第一方面的一种可能的实现方式中,上述步骤损失函数还包括第三损失函数, 第三损失函数用于指示第一实体的计算词向量与第一实体的真实词向量的差值,和/或用于指示第二实体的计算词向量与第二实体的真实词向量的差值。
该种可能的实现方式中,第三损失函数可以通过最小化三元组头尾两个节点的向量映射到用一个关系空间的误差,可以解决复杂关系中,单个三元组存在一对多,多对一的问题。
本申请实施例第二方面提供了一种推荐方法,该方法可以由推荐装置执行,也可以由推荐装置的部件(例如处理器、芯片、或芯片系统等)执行。该方法包括:获取知识图谱、第一标识以及第二标识,知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体,第一标识指示待推荐物品,第二标识指示用户历史记录涉及的物品或者物品属性,知识图谱中包括与第一标识对应的第一实体,以及与第二标识对应的第一实体或第二实体;基于知识图谱、第一标识以及第二标识运行神经网络,以得到评估结果,评估结果包括待推荐物品被推荐的概率,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到评估结果,第一方向起始于与第一标识对应的第一实体,第二方向起始于与第二标识对应的第一实体或第二实体。
本申请实施例中,可以基于所述知识图谱、第一标识以及第二标识运行神经网络,以得到待推荐物品被推荐的概率,其中,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到待推荐物品被推荐的概率,提供了一种新的推荐方法。在实际应用中,多个待推荐物品都会基于知识图谱的至少一个方向和至少第一第二方向计算,得到多个概率,然后基于概率排序,得到最终的评估结果。这样,可预设给出几个被推荐物品,所以能给出更准确的被推荐物品。
可选地,在第二方面的一种可能的实现方式中,上述步骤中的评估结果还包括,待推荐物品被推荐时,基于的知识图谱中的路径对应的概率,路径的一端为与第一标识对应的第一实体,路径的另一端为与第二标识对应的第一实体。
可选地,在第二方面的一种可能的实现方式中,上述步骤基于知识图谱、第一标识以及第二标识运行神经网络,以得到评估结果,包括:基于知识图谱、第一标识以及第二标识在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应用户的历史记录涉及的物品或物品属性;将多条路径输入神经网络以对多个待推荐物品打分,以使神经网络得到评估结果,神经网络用于基于多条路径各自的第一方向和第二方向计算以得到概率,对于一条路径,第一方向是路径的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。
该种可能的实现方式中,可以通过多条路径输入神经网络以对多个待推荐物品打分,以使神经网络得到评估结果的方式,使得打分时考虑路径两个方向,相较于现有技术中只从单方向获得的评估结果更加准确。
可选地,在第二方面的一种可能的实现方式中,上述步骤基于知识图谱、第一标识以及与第二标识运行神经网络,以得到评估结果,包括:将知识图谱、第一标识以及第二标识输入神经网络;神经网络基于知识图谱、第一标识以及第二标识在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应用户的历史记录涉及的物品或物品属性;基于多条路径各自的第一方向和第二方向对多条路径对应的多个待推荐物品打分,以使神经网络得到评估结果,对于一条路径,第一方向是路径 的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。
该种可能的实现方式中,可以基于多条路径各自的第一方向和第二方向对多条路径对应的多个待推荐物品打分的方式,使得打分时考虑路径两个方向,相较于现有技术中只从单方向获得的评估结果更加准确。
可选地,在第二方面的一种可能的实现方式中,上述步骤第一方向与第一向量的方向一致,第二方向与第二向量的方向一致,对于一条路径,第一向量为从路径中,指示待推荐物品的第一实体,指向路径中,与指示待推荐物品的第一实体相邻的实体的向量,第二向量为从路径中,用户的历史记录涉及的物品的第一实体,指向路径中,与指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,第二向量为从路径中,用户的历史记录涉及的物品属性的第二实体,指向路径中,与用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;基于多条路径各自的第一方向和第二方向对多条路径对应的多个待推荐物品打分,包括:分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体的概率。
该种可能的实现方式中,计算路径中左右两个流向的信息在嵌入空间内的重合概率,并计算出汇集节点的重合概率特征。该重合概率特征用来输出语义级的解释,即用户对某个实体节点的喜好程度。可以准确找到用户的兴趣点。
可选地,在第二方面的一种可能的实现方式中,上述步骤分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体的概率,包括:
Figure PCTCN2021141472-appb-000006
其中,p m代表概率,
Figure PCTCN2021141472-appb-000007
代表第一向量,
Figure PCTCN2021141472-appb-000008
代表第二向量,或者,
Figure PCTCN2021141472-appb-000009
代表第一向量,
Figure PCTCN2021141472-appb-000010
代表第二向量;exp代表以e为底的指数函数,M为正整数,M代表待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量。
可选地,在第二方面的一种可能的实现方式中,上述步骤神经网络是通过以训练样本作为神经网络的输入,以损失函数的值小于阈值为目标对神经网络进行训练得到,训练样本包括多条训练路径,或者训练样本包括用于训练的知识图谱、第一训练标识以及第二训练标识,第一训练标识指示的物品与第二训练标识指示的物品或物品属性为用户的历史物品涉及的物品或物品属性;损失函数包括第一损失函数,第一损失函数用于指示神经网络输出的评估结果与目标结果之间的差异,目标结果与用户的历史记录涉及的物品或物品属性相关。
该种可能的实现方式中,通过第一损失函数对神经网络进行训练,使得推荐结果更加准确,符合用户的喜好程度。
可选地,在第二方面的一种可能的实现方式中,上述步骤损失函数还包括第二损失函数,第二损失函数用于指示用于训练的知识图谱的训练路径中第一训练向量与第二训练向量之间词向量的差值,训练路径的两端对应用户的历史记录涉及的物品或物品属性。
该种可能的实现方式中,第二损失函数的目的最小化路径左右流向同一节点的计算误差,使得在嵌入空间中更高维度的关系矩阵内,左边计算后的词向量尽可能与右边计算的词向量相等。即通过第二损失函数可以最小化路径两端流向同一节点的误差,可以解决复杂关系中 路径两端流向同一节点的问题。
可选地,在第二方面的一种可能的实现方式中,上述步骤损失函数还包括第三损失函数,第三损失函数用于指示第一实体的计算词向量与第一实体的真实词向量的差值,和/或用于指示第二实体的计算词向量与第二实体的真实词向量的差值。
该种可能的实现方式中,第三损失函数可以通过最小化三元组头尾两个节点的向量映射到用一个关系空间的误差,可以解决复杂关系中,单个三元组存在一对多,多对一的问题。
本申请实施例第三方面提供一种推荐装置,该推荐装置包括:获取单元,用于获取知识图谱,知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体;运行单元,用于基于知识图谱以及用户的信息运行神经网络,以得到推荐结果,用户的信息指示用户的历史记录涉及的物品或者物品属性,推荐结果包括被推荐物品,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,第一方向起始于指示被推荐物品或者待推荐物品的第一实体,第二方向起始于指示用户的历史记录涉及的物品的第一实体,或者第二方向起始于指示用户的历史记录涉及的物品属性的第二实体。
可选地,在第三方面的一种可能的实现方式中,上述的推荐结果还包括对被推荐物品的解释,解释与一个第一方向和一个第二方向相关。
可选地,在第三方面的一种可能的实现方式中,上述通信装置的运行单元,具体用于基于知识图谱以及用户的信息,在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应用户的历史记录涉及的物品或物品属性;运行单元,具体用于将多条路径输入神经网络以对多个待推荐物品打分,以使神经网络得到推荐结果,神经网络用于基于多条路径各自的第一方向和第二方向计算以得到推荐结果,对于一条路径,第一方向是路径的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。
可选地,在第三方面的一种可能的实现方式中,上述通信装置的运行单元,具体用于将知识图谱以及用户的信息输入神经网络;运行单元,具体用于神经网络基于知识图谱以及用户的信息,在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应用户的历史记录涉及的物品或物品属性;运行单元,具体用于基于多条路径各自的第一方向和第二方向对多个待推荐物品打分,以使神经网络得到推荐结果,对于一条路径,第一方向是路径的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。
可选地,在第三方面的一种可能的实现方式中,上述的第一方向与第一向量的方向一致,第二方向与第二向量的方向一致,对于一条路径,第一向量为从路径中,指示待推荐物品的第一实体,指向路径中,与指示待推荐物品的第一实体相邻的实体的向量,第二向量为从路径中,用户的历史记录涉及的物品的第一实体,指向路径中,与指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,第二向量为从路径中,用户的历史记录涉及的物品属性的第二实体,指向路径中,与用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;运行单元,具体用于对多条路径中的每条路径,都基于每条路径的第一向量和第二向量汇集到每条路径中的一个实体的概率对每条路径对应的待推荐物品打分,以得到被推荐物品。
可选地,在第三方面的一种可能的实现方式中,上述通信装置的运行单元,还用于基于多条路径各自的第一方向和第二方向分别对多条路径打分,以得到对推荐结果的解释,解释是对得到推荐结果的一条或多条路径所指示的两端的实体之间的关联的描述。
可选地,在第三方面的一种可能的实现方式中,上述的第一方向与第一向量的方向一致,第二方向与第二向量的方向一致,对于一条路径,第一向量为从路径中,指示待推荐物品的第一实体,指向路径中,与指示待推荐物品的第一实体相邻的实体的向量,第二向量为从路径中,用户的历史记录涉及的物品的第一实体,指向路径中,与指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,第二向量为从路径中,用户的历史记录涉及的物品属性的第二实体,指向路径中,与用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;运行单元,具体用于分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体的概率,以得到对推荐结果的解释。
可选地,在第三方面的一种可能的实现方式中,上述通信装置的运行单元,具体用于通过如下公式分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体的概率:
Figure PCTCN2021141472-appb-000011
其中,p m代表概率,
Figure PCTCN2021141472-appb-000012
代表第一向量,
Figure PCTCN2021141472-appb-000013
代表第二向量,或者,
Figure PCTCN2021141472-appb-000014
代表第一向量,
Figure PCTCN2021141472-appb-000015
代表第二向量;exp代表以e为底的指数函数,M为正整数,M代表待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量。
可选地,在第三方面的一种可能的实现方式中,上述的神经网络是通过以训练样本作为神经网络的输入,以损失函数的值小于阈值为目标对神经网络进行训练得到,训练样本包括多条训练路径,或者训练样本包括用于训练的知识图谱、用于训练的用户的历史记录涉及的物品和/或物品属性,每条训练路径指示训练路径两端的实体之间的关联,每条训练路径的两端对应用户的历史记录涉及的物品或物品属性;损失函数包括第一损失函数,第一损失函数用于指示神经网络输出的推荐结果与目标结果之间的差异,目标结果与用户的历史记录涉及的物品或物品属性相关。
可选地,在第三方面的一种可能的实现方式中,上述的损失函数还包括第二损失函数,第二损失函数用于指示用于训练的知识图谱的训练路径中第一训练向量与第二训练向量之间词向量的差值,训练路径的两端对应用户的历史记录涉及的物品或物品属性。
可选地,在第三方面的一种可能的实现方式中,上述的损失函数还包括第三损失函数,第三损失函数用于指示第一实体的计算词向量与第一实体的真实词向量的差值,和/或用于指示第二实体的计算词向量与第二实体的真实词向量的差值。
本申请实施例第四方面提供一种推荐装置,该推荐装置包括:获取单元,用于获取知识图谱、第一标识以及第二标识,知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体,第一标识指示待推荐物品,第二标识指示用户历史记录涉及的物品或者物品属性,知识图谱中包括与第一标识对应的第一实体,以及与第二标识对应的第一实体或第二实体;运行单元,用于基于知识图谱、第一标识以及第二标识运行神经网络,以得 到评估结果,评估结果包括待推荐物品被推荐的概率,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到评估结果,第一方向起始于与第一标识对应的第一实体,第二方向起始于与第二标识对应的第一实体或第二实体。
可选地,在第四方面的一种可能的实现方式中,上述的评估结果还包括,待推荐物品被推荐时,基于的知识图谱中的路径对应的概率,路径的一端为与第一标识对应的第一实体,路径的另一端为与第二标识对应的第一实体。
可选地,在第四方面的一种可能的实现方式中,上述通信装置的运行单元,具体用于基于知识图谱、第一标识以及第二标识在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应用户的历史记录涉及的物品或物品属性;运行单元,具体用于将多条路径输入神经网络以对多个待推荐物品打分,以使神经网络得到评估结果,神经网络用于基于多条路径各自的第一方向和第二方向计算以得到概率,对于一条路径,第一方向是路径的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。
可选地,在第四方面的一种可能的实现方式中,上述通信装置的运行单元,具体用于将知识图谱、第一标识以及第二标识输入神经网络;运行单元,具体用于神经网络基于知识图谱、第一标识以及第二标识在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应用户的历史记录涉及的物品或物品属性;运行单元,具体用于基于多条路径各自的第一方向和第二方向对多条路径对应的多个待推荐物品打分,以使神经网络得到评估结果,对于一条路径,第一方向是路径的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。
可选地,在第四方面的一种可能的实现方式中,上述的第一方向与第一向量的方向一致,第二方向与第二向量的方向一致,对于一条路径,第一向量为从路径中,指示待推荐物品的第一实体,指向路径中,与指示待推荐物品的第一实体相邻的实体的向量,第二向量为从路径中,用户的历史记录涉及的物品的第一实体,指向路径中,与指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,第二向量为从路径中,用户的历史记录涉及的物品属性的第二实体,指向路径中,与用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;运行单元,具体用于分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体的概率。
可选地,在第四方面的一种可能的实现方式中,上述通信装置的运行单元,具体用于通过下述公式分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体的概率:
Figure PCTCN2021141472-appb-000016
其中,p m代表概率,
Figure PCTCN2021141472-appb-000017
代表第一向量,
Figure PCTCN2021141472-appb-000018
代表第二向量,或者,
Figure PCTCN2021141472-appb-000019
代表第一向量,
Figure PCTCN2021141472-appb-000020
代表第二向量;exp代表以e为底的指数函数,M为正整数,M代表待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量。
可选地,在第四方面的一种可能的实现方式中,上述的神经网络是通过以训练样本作为 神经网络的输入,以损失函数的值小于阈值为目标对神经网络进行训练得到,训练样本包括多条训练路径,或者训练样本包括用于训练的知识图谱、第一训练标识以及第二训练标识,第一训练标识指示的物品与第二训练标识指示的物品或物品属性为用户的历史物品涉及的物品或物品属性;损失函数包括第一损失函数,第一损失函数用于指示神经网络输出的评估结果与目标结果之间的差异,目标结果与用户的历史记录涉及的物品或物品属性相关。
可选地,在第四方面的一种可能的实现方式中,上述的损失函数还包括第二损失函数,第二损失函数用于指示用于训练的知识图谱的训练路径中第一训练向量与第二训练向量之间词向量的差值,训练路径的两端对应用户的历史记录涉及的物品或物品属性。
可选地,在第四方面的一种可能的实现方式中,上述的损失函数还包括第三损失函数,第三损失函数用于指示第一实体的计算词向量与第一实体的真实词向量的差值,和/或用于指示第二实体的计算词向量与第二实体的真实词向量的差值。
本申请实施例第五方面提供了一种推荐装置,该推荐装置或推荐装置的部件(例如处理器、芯片或芯片系统)执行前述第一方面或第一方面的任意可能的实现方式中的方法。
本申请实施例第六方面提供了一种推荐装置,该推荐装置或推荐装置的部件(例如处理器、芯片或芯片系统)执行前述第二方面或第二方面的任意可能的实现方式中的方法。
本申请实施例第七方面提供了一种计算机可读存储介质,该计算机可读存储介质中存储有指令,该指令在计算机上执行时,使得计算机执行前述第一方面或第一方面的任意可能的实现方式、第二方面或第二方面的任意可能的实现方式中的方法。
本申请实施例第八方面提供了一种计算机程序产品,该计算机程序产品在计算机上执行时,使得计算机执行前述第一方面或第一方面的任意可能的实现方式、第二方面或第二方面的任意可能的实现方式中的方法。
本申请实施例第九方面提供了一种推荐装置,包括:处理器,处理器与存储器耦合,存储器用于存储程序或指令,当程序或指令被处理器执行时,使得该装置实现上述第一方面或第一方面的任意可能的实现方式中的方法。
本申请实施例第十方面提供了一种推荐装置,包括:处理器,处理器与存储器耦合,存储器用于存储程序或指令,当程序或指令被处理器执行时,使得该装置实现上述第二方面或第二方面的任意可能的实现方式中的方法。
其中,第三、第五、第七、第八、第九方面或者其中任一种可能实现方式所带来的技术效果可参见第一方面或第一方面不同可能实现方式所带来的技术效果,此处不再赘述。
其中,第四、第六、第七、第八、第十方面或者其中任一种可能实现方式所带来的技术效果可参见第二方面或第二方面不同可能实现方式所带来的技术效果,此处不再赘述。
从以上技术方案可以看出,本申请实施例具有以下优点:获取知识图谱,并基于知识图谱以及用户的信息运行神经网络,以得到推荐结果。相较于现有技术中只从用户的历史记录为起点计算(即现有技术中计算推荐结果是从单方向进行计算)得到的推荐结果。本发明基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,提供了一种新的推荐方法,从两个方向进行计算,能够得到更为精准的推荐结果,即提升推荐结果的精准率和/或召回率。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种推荐网络架构示意图;
图2为本申请实施例提供的产品实现的架构示意图;
图3为本申请实施例提供的另一种系统架构示意图;
图4为本申请实施例提供的推荐网络的一种结构示意图;
图5为本申请实施例提供的一种神经网络处理器的结构示意图;
图6为本申请实施例提供的推荐网络的一种结构示意图;
图7为本申请实施例提供的电影推荐场景下路径的一种结构示意图;
图8为本申请实施例提供的推荐方法一个流程示意图;
图9为本申请实施例提供的推荐方法另一个流程示意图;
图10为本申请实施例提供的电影推荐场景下路径的另一种结构示意图;
图11为本申请实施例提供的游戏推荐场景下的图谱展示示意图;
图12为本申请实施例提供的推荐网络与现有推荐模型对于精准率的对比结果示意图;
图13为本申请实施例提供的推荐网络与现有推荐模型对于召回率的对比结果示意图;
图14-图16为本申请实施例中推荐装置的几种结构示意图。
具体实施方式
本申请实施例提供了一种推荐方法、推荐网络以及相关设备,可以基于知识图谱以及用户的信息运行神经网络,以得到推荐结果,其中,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,提供了一种新的推荐方法,能够得到更为精准的推荐结果,即提升推荐结果的精准率和/或召回率。可以应用在电影推荐、游戏推荐等向用户推荐物品的场景。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。
本申请实施例提供的推荐方法能够应用在电影推荐、商品推荐、音乐推荐、饭店推荐、书籍推荐、网页推荐等需要推荐物品的场景。下面对电影推荐场景和游戏推荐场景进行简单的描述。
一、电影推荐场景。
通过本实施例提供的推荐方法,神经网络进行双向传导计算(下面详细介绍)得出,当一个用户是陈凯歌的影迷,同时又是张国荣的粉丝,那么,为他推荐电影《霸王别姬》会大幅度提升用户对推荐结果的满意度。
二、游戏推荐场景。
在为用户进行游戏推荐的场景,例如:推荐命中的游戏军团要塞2(《Team Fortress 2》)与用户历史玩过的记录之间存在众多复杂的关系。
下面对本申请实施例涉及到的一些术语或概念进行解释,以便于本领域技术人员理解。
1、神经网络。
神经网络可以是由神经单元组成的,神经单元可以是指以X s和截距1为输入的运算单元,该运算单元的输出可以为:
Figure PCTCN2021141472-appb-000021
其中,s=1、2、……n,n为大于1的自然数,W s为X s的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入。激活函数可以是sigmoid函数。神经网络是将许多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。
2、深度神经网络。
深度神经网络(deep neural network,DNN),也称多层神经网络,可以理解为具有很多层隐含层的神经网络,这里的“很多”并没有特别的度量标准。从DNN按不同层的位置划分,DNN内部的神经网络可以分为三类:输入层,隐含层,输出层。一般来说第一层是输入层,最后一层是输出层,中间的层数都是隐含层。层与层之间是全连接的,也就是说,第i层的任意一个神经元一定与第i+1层的任意一个神经元相连。当然,深度神经网络也可能不包括隐藏层,具体此处不做限定。
深度神经网络中的每一层的工作可以用数学表达式
Figure PCTCN2021141472-appb-000022
来描述:从物理层面深度神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由
Figure PCTCN2021141472-appb-000023
完成,4的操作由
Figure PCTCN2021141472-appb-000024
完成,5的操作则由α()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练深度神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。
3、损失函数。
在训练深度神经网络的过程中,因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要 预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。
4、词向量(Embedding)。
词向量也可以称为“词嵌入”、“向量化”、“向量映射”、“嵌入”等。从形式上讲,词向量是用一个稠密的向量表示一个对象,例如:用向量表示用户身份证标识号(identity document,ID)、物品ID等。
5、知识图谱(knowledge graph,KG)。
知识图谱是一种语义网络,知识图谱中包含多个实体以及实体之间的关系。实体是知识图谱中的最基本元素,其中,实体可以分为第一实体以及第二实体,第一实体是用于指示物品的实体,第二实体是用于指示物品属性的实体。一种实现方式下,与第一实体直接相连的是第二实体,即第一实体和第二实体是交错排布的。
物品:是具有可区别性且独立存在的某种事物。如某一个城市、某一种商品、某一部电影、某一部游戏等等。
物品属性:可以看做是对物品的描述、解释、内容、属性等。一般情况下,物品属性的实体与物品的实体直接相连的一跳节点。例如:在电影推荐场景,《霸王别姬》的电影类型是历史,其中,《霸王别姬》相当于第一实体,用于指示电影,历史相当于第二实体,用于指示电影的属性,电影类型是第一实体与第二实体之间的关系。
6、三元组。
计算机数据结构里的概念。主要用来存储稀疏矩阵的一种压缩方式,也叫三元组表。例如:三元组包括:实体1(可以称为节点)、实体1与实体2的关系(也可以称为边)、实体2(可以称为节点)组成一个三元组存储在计算机中。
7、知识表示(KG Embedding)。
主要是把知识图谱中的实体(entities)和关系(relations)嵌入(embed)到一个连续向量空间里面。
8、交叉熵。
交叉熵是深度学习中常用的概念,一般用来求目标值与预测值之间的差距,经常使用交叉熵作为神经网络的损失函数。
9、L2范数。
又称为欧几里得范数,表示从原点出发到向量X确定的点的欧几里得距离。
10、接收者操作特征曲线(receiver operating characteristic curve,ROC)曲线下的面积(area under curve,AUC)。
AUC是衡量学习器优劣的一种性能指标,可以量化ROC曲线表达的分类能力。这种分类能力是与概率、阈值紧密相关。AUC越大,那么输出概率越合理,排序的结果越合理。
11、推荐精准率。
推荐精准率=推荐出的正确信息条数/推荐出的信息条数。
12、推荐召回率。
推荐召回率=推荐出的正确信息条数/样本中的信息条数。
本申请实施例中具有推荐功能的神经网络,也可以理解为推荐网络,为了和原始的神经网络区分开,下面将具有推荐功能的神经网络更换为推荐网络进行描述。
为了更好地理解本申请实施例公开的一种推荐方法、推荐网络以及相关设备,下面先对本发明实施例所使用的系统架构进行描述。参见附图1,本发明实施例提供了一种推荐网络架构100。
本申请提供的推荐方法可以应用于推荐网络架构100的传导计算和损失函数模块中。推荐网络架构是面向推荐系统的神经网络训练的通用框架,最近几年应用越来越广泛。
传导计算模块为了解决数据在嵌入空间计算过程中,如何通过双向传导的方式得到精确性高的推荐结果,采取了基于知识图谱和用户的信息运行推荐网络,以得到推荐结果,该推荐结果包括被推荐物品(或者被推荐物品的标识)。
本申请提供的推荐网络可以是神经网络,具体可以是深度神经网络。
可选地,传导计算模块还可以解决在数据在嵌入空间计算过程中,如何获取高语义性的解释信息的问题,采取了路径作为输入并且从路径的两端双向传导计算的方式,在节点的汇集处计算出高语义性的解释。
损失函数模块解决了推荐网络训练过程中,推荐准确性无法保障的问题。本申请新增了路径损失函数和节点损失函数,使模型快速收敛的同时极大的提高推荐精准率、召回率等性能指标,提升推荐结果以及解释的可靠性。
知识图谱模块用于构建知识图谱或获取现有的知识图谱,关于知识图谱的描述可以参照前面的描述。
新增用户处理模块用于在没有新增用户的历史记录等信息时,可以通过一些策略(例如:随机法),先向用户推荐一些物品,快速得到反馈信息后(例如:用户点击的物品ID、物品属性等节点信息)。然后,将这些数据输入到网络以便更精准的推荐。
数据获取模块用于获取用户的信息,用户的信息指示用户的历史记录涉及的物品(也可以称为历史物品)或者物品属性(也可以称为历史物品属性)。
可选地,该数据获取模块还可以用于获取用户信息、物品信息以及相关的外部知识,该外部知识包括但不限于物品的属性信息(例如:电影的导演、演员、类型;游戏的开发商、运营商、分类;新闻的构成要素、何时、何地、何人等)、用户维度的特征(例如:用户的年龄、职业等)。用来构建知识图谱。
数据存储模块用于存储上述涉及到的相关数据,具体此处不做限定。
请参阅图2,图2为本申请实施例中产品实现的架构示意图,该产品可以包含在推荐网络架构中,并且可以部署在服务器硬件上的程序代码。以图1所示的推荐网络架构为例,本申请的程序代码可以存在于推荐网络中,程序运行时,本申请的程序代码可以运行与服务器的主机存储和加速硬件{图形处理器(graphic processing unit,GPU)、现场可编辑逻辑门阵列(field programmable gate array,FGPA)或专用芯片}内存。推荐装置为本申请提供的装置,用于输入数据,输出推荐物品和/或输出解释。
参见附图3,本发明实施例提供了另一种系统架构300。如所述系统架构300所示,数据采集设备360用于采集训练样本,本申请实施例中训练样本包括多条训练路径;或者训练样 本包括用于训练的知识图谱、第一训练标识以及第二训练标识,第一训练标识指示的物品与第二训练标识指示的物品或物品属性为用户的历史物品指示的物品或物品属性;或者训练样本包括用于训练的知识图谱、用于训练的用户的历史记录涉及的物品和/或物品属性,每条训练路径指示训练路径两端的实体之间的关联,每条训练路径的两端对应用户的历史记录涉及的物品或物品属性。并将训练样本存入数据库330,训练设备320基于数据库330中维护的训练样本训练得到目标模型/规则301。该目标模型/规则301能够用于实现本申请实施例提供的推荐方法,即,基于知识图谱以及用户的信息运行推荐网络,以得到推荐结果,该推荐结果包括被推荐物品,用户的信息指示用户的历史记录涉及的物品或者物品属性。进一步的,推荐结果还可以包括该被推荐物品的解释。本申请实施例中的目标模型/规则301具体可以为推荐网络,或称为神经网络,在本申请提供的实施例中,该推荐网络是通过训练训练样本得到的。需要说明的是,在实际的应用中,所述数据库330中维护的训练样本不一定都来自于数据采集设备360的采集,也有可能是从其他设备接收得到的。另外需要说明的是,训练设备320也不一定完全基于数据库330维护的训练数据进行目标模型/规则301的训练,也有可能从云端或其他地方获取训练数据进行模型训练,上述描述不应该作为对本申请实施例的限定。
根据训练设备320训练得到的目标模型/规则301可以应用于不同的系统或设备中,如应用于图3所示的执行设备310,所述执行设备310可以是终端,如手机终端,平板电脑,笔记本电脑,车载终端等,还可以是服务器或者云端等。在附图3中,执行设备310配置有I/O接口312,用于与外部设备进行数据交互,用户可以通过客户设备340向I/O接口312输入数据,在本申请实施例中输入的数据可以包括:多条路径;输入的数据也可以包括知识图谱以及用户的信息;输入的数据还可以包括知识图谱。第一标识以及第二标识,其中,第一标识指示待推荐物品,第二标识指示用户历史记录涉及的物品或者物品属性,输入的数据也可以来自数据库,具体此处不做限定。
预处理模块313用于根据I/O接口312接收到的输入数据进行预处理,在本申请实施例中,预处理模块313可以用于随机向用户推荐一些物品,再根据用户的反馈,确定历史物品(也可以理解为,历史物品是用户的历史记录涉及的物品)。预处理模块313可以用于基于知识图谱以及用户的信息,在知识图谱中提取多条路径,并将提取出的路径发送给计算模块311。
在执行设备310对输入数据进行预处理,或者在执行设备310的计算模块311执行计算等相关的处理过程中,执行设备310可以调用数据存储系统350中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统350中。
最后,I/O接口312将处理结果,如上述得到的推荐结果返回给客户设备340,从而提供给用户。
值得说明的是,训练设备320可以针对不同的目标或称不同的任务,基于不同的训练数据生成相应的目标模型/规则301,该相应的目标模型/规则301即可以用于实现上述目标或完成上述任务,从而为用户提供所需的结果。
在附图3中所示情况下,用户可以手动给定输入数据,该手动给定可以通过I/O接口312提供的界面进行操作。另一种情况下,客户设备340可以自动地向I/O接口312发送输 入数据,如果要求客户设备340自动发送输入数据需要获得用户的授权,则用户可以在客户设备340中设置相应权限。用户可以在客户设备340查看执行设备310输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备340也可以作为数据采集端,采集如图所示输入I/O接口312的输入数据及输出I/O接口312的输出结果作为新的样本数据,并存入数据库330。当然,也可以不经过客户设备340进行采集,而是由I/O接口312直接将如图所示输入I/O接口312的输入数据及输出I/O接口312的输出结果,作为新的样本数据存入数据库330。
值得注意的是,附图3仅是本发明实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在附图3中,数据存储系统350相对执行设备310是外部存储器,在其它情况下,也可以将数据存储系统350置于执行设备310中。
如图3所示,根据训练设备320训练得到目标模型/规则301,该目标模型/规则301在本申请实施例中可以是推荐网络,具体的,在本申请实施例提供的推荐网络可以是深度神经网络。
下面介绍本申请实施例提供的一种芯片硬件结构。
图4为本发明实施例提供的一种芯片硬件结构,该芯片包括神经网络处理器40。该芯片可以被设置在如图3所示的执行设备310中,用以完成计算模块311的计算工作。该芯片也可以被设置在如图3所示的训练设备320中,用以完成训练设备320的训练工作并输出目标模型/规则301。
神经网络处理器40可以是神经网络处理器(neural-network processing unit,NPU),张量处理器(tensor processing unit,TPU),或者图形处理器(graphics processing unit,GPU)等一切适合用于大规模异或运算处理的处理器。以NPU为例:神经网络处理器NPU40作为协处理器挂载到主中央处理器(central processing unit,CPU)(host CPU)上,由主CPU分配任务。NPU的核心部分为运算电路403,控制器404控制运算电路403提取存储器(权重存储器或输入存储器)中的数据并进行运算。
在一些实现中,运算电路403内部包括多个处理单元(process engine,PE)。在一些实现中,运算电路403是二维脉动阵列。运算电路403还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路403是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器402中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器401中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器408accumulator中。
向量计算单元407可以对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。例如,向量计算单元407可以用于神经网络中非卷积/非FC层的网络计算,如池化(Pooling),批归一化(Batch Normalization),局部响应归一化(Local Response Normalization)等。
在一些实现种,向量计算单元能407将经处理的输出的向量存储到统一缓存器406。例 如,向量计算单元407可以将非线性函数应用到运算电路403的输出,例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元407生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路403的激活输入,例如用于在神经网络中的后续层中的使用。
统一存储器406用于存放输入数据以及输出数据。
权重数据直接通过存储单元访问控制器(direct memory access controller,DMAC)405将外部存储器中的输入数据搬运到输入存储器401和/或统一存储器406、将外部存储器中的权重数据存入权重存储器402,以及将统一存储器506中的数据存入外部存储器。
总线接口单元(bus interface unit,BIU)410,用于通过总线实现主CPU、DMAC和取指存储器409之间进行交互。
与控制器404连接的取指存储器(instruction fetch buffer)409,用于存储控制器404使用的指令。
控制器404,用于调用指存储器409中缓存的指令,实现控制该运算加速器的工作过程。
一般地,统一存储器406,输入存储器401,权重存储器402以及取指存储器409均为片上(On-Chip)存储器,外部存储器为该NPU外部的存储器,该外部存储器可以为双倍数据率同步动态随机存储器(double data rate synchronous dynamic random access memory,DDR SDRAM)、高带宽存储器(high bandwidth memory,HBM)或其他可读可写的存储器。
下面结合附图对本申请实施例的推荐网络的训练方法和推荐方法进行详细的介绍。
首先,结合图5对本申请实施例的推荐网络的训练方法进行详细介绍。图5所示的方法可以由推荐网络的训练装置来执行,该推荐网络的训练装置可以是云服务设备,也可以是终端设备,例如,电脑、服务器等运算能力足以用来执行推荐网络的训练方法的装置,也可以是由云服务设备和终端设备构成的系统。示例性地,该训练方法可以由图3中的训练设备320、图4中的神经网络处理器40执行。
可选地,该训练方法可以由CPU处理,也可以由CPU和GPU共同处理,也可以不用GPU,而使用其他适合用于神经网络计算的处理器,本申请不做限制。
该训练方法包括步骤501与步骤502。下面对步骤501与步骤502进行详细说明。
步骤501、获取训练样本。
本申请实施例中的训练样本有多种情况,下面分别描述:
1、训练样本包括多条训练路径。
其中,每条训练路径指示训练路径两端的实体之间的关联,每条训练路径的两端对应用户的历史记录涉及的物品或物品属性。
本申请实施例中,用户的历史记录的正向事件中涉及的物品或物品属性可以理解为用户曾经在正向事件中涉及过的第一实体或第二实体指示的物品或物品属性。其中正向事件是指,用户在该事件中没有明确表示出否定或负向意愿(也就是不喜欢,不感兴趣,不愿关注),或者表示出关注、喜欢、感兴趣等正向意愿。比如,用户点击、转发、关注、评论、激励(如投币、点赞)、收藏、浏览和浏览时间超过阈值时间的物品或物品属性,都是正向事件,而用户点击“踩”,点击“不想看到”,点击“不感兴趣”,选择“不出现在我的主页”就是负向事件,这种历史记录涉及的物品或者物品属性要剔除,要避免被输入。
2、训练样本包括用于训练的知识图谱、用于训练的用户的历史记录涉及的物品或物品属性。
可选地,训练的知识图谱和具体推荐过程中的知识图谱可以相同或不同,具体此处不做限定。
可选地,训练知识图谱包括多个三元组,该多个三元组通过相同实体连接。
3、训练样本包括用于训练的知识图谱、第一训练标识、第二训练标识。
其中,第一训练标识指示的物品与第二训练标识指示的物品或物品属性为用户的历史物品涉及的物品(可以成为历史物品)或物品属性(也可以称为历史物品属性)。
本申请实施例中的标识(第一标识、第二标识、第一训练标识、第二训练标识)可以是ID,也可以是名称等,具体此处不做限定。
本申请实施例中训练样本的情况有多种,上面几种指示举例,可以理解的是,在实际应用中,可以根据需要对训练样本进行适应性调整,具体此处不做限定。
本申请实施例中的物品(待推荐物品、被推荐物品、用于训练的用户的历史记录涉及的物品)可以是电影、游戏、音乐、新闻等,具体此处不做限定。
本申请实施例中两个实体之间的关系可以是电影的类型、主演、导演、编剧等,还可以是游戏的开发商、发行商、运行平台、游戏类型、发型年份等,也可以是音乐的歌手、编曲、作词等,具体此处不做限定。
步骤502、以训练样本作为推荐网络的输入,以损失函数的值小于第一阈值为目标对推荐网络进行训练,得到训练好的推荐网络。
本申请实施例提供的推荐网络可以是独立的自带解释信息的推荐系统,也可以是为已有推荐系统输出解释信息。即本申请实施例提供的推荐网络可以输出被推荐物品的解释,其中,该被推荐物品可以是通过现有推荐系统输出的被推荐物品。当然,本申请实施例提供的推荐网络还可以输出被推荐物品的分值以及对被推荐物品或待推荐物品的解释。
本申请实施例中的推荐网络的结构可以参考图6,本申请提供的一种推荐网络的结构可以包括双向传导(或者称为双向传导计算)。
双向传导可以理解为从至少一个第一方向和至少一个第二方向计算以得到推荐结果(具体计算过程详见图8、图9所示实施例)。该第一方向起始于指示被推荐物品或待推荐物品的第一实体。该第二方向起始于指示用户的历史记录涉及的物品的第一实体;或者该第二方向起始于指示用户的历史记录涉及的物品属性的第二实体。
进一步的,基于多条路径各自的第一方向和第二方向对多个待推荐物品打分,根据需要选择TOPK作为被推荐物品,K为大于1的整数。
示例性的,K为2,则确定多个待推荐物品中前两个分值对应的待推荐物品为被推荐物品。
可选地,双向传导还可以理解为从路径的左右两个端点开始想中间节点逐步计算。该路径是基于知识图谱以及用户的信息,在知识图谱中提取的。
可选地,路径的一端对应待推荐物品,路径的另一端对应用户的历史记录涉及的物品(也可以理解为历史物品)或物品属性。中间节点可以是物品或物品属性,具体此处不做限定。
本申请实施例中,用户的信息可以包括用户ID、用户点击过的物品(也可以理解为历史物品)或物品属性、用户的年龄、职业等与用户相关的信息。
可选地,双向传导还可以基于多条路径各自的第一方向和第二方向分别对多条路径打分,以得到对推荐结果的解释。
进一步的,基于多条路径各自的第一方向和第二方向对多条路径打分,根据需要选择TOPK作为被推荐物品,K为大于1的整数。
本申请实施例中,对于一条路径,第一方向是路径的一端指向路径的另一端,第二方向是路径的另一端指向路径的一端。其中,路径的一端对应待推荐物品,路径的另一端对应历史物品或历史物品属性。
示例性的,K为2,则确定多个路径中前两个分值对应的路径作为对推荐结果的解释,或者确定多个路径中左右方向的汇集点对应的概率中前两个概率,作为对推荐结果的解释。
进一步的,计算路径中左右两个流向的信息在嵌入空间内的重合概率,并计算出汇集节点的重合概率特征。该重合概率特征用来输出语义级的解释,即用户对某个实体节点的喜好程度。即计算两个流向的向量汇集到一起的概率。表示为待推荐物品与用户历史的记录(用户点击过的物品或物品属性)之间被激活连接的概率(概率越大,越显著)。这样做的目的就是为了找到用户的兴趣点。例如:用户A历史观看过10部电影中的其中8部都是由演员周星驰出演的,那么在这种情况下,路径中包含节点“周星驰”的概率就会显著。该重合概率可以作为被推荐物品的解释,即路径中带有语义的实体节点(也可以理解为是物品属性对应的第二实体),可用来描述用户的潜在喜好(如:电影的导演名字,书的类型等)。这些属性节点的词向量,与对应的激活路径的概率做运算(如:相乘等),就可以得出单条路径的反馈信息(例如:反馈信息=概率值*周星驰在嵌入空间的词向量,即反馈信息可以是v*概率值p)。
图6中的v表示推荐物品,一个配对块对应一个历史物品i,待推荐物品v与多个历史物品(i 1、i 2、...、i n)之间有多个配对块(配对块1、配对块2、...、配对块n),一个历史物品i与待推荐物品v之间有m条路径,每条路径包括多个实体e以及实体e之间的关系R,其中,e可以是用于指示物品的第一实体,也可以是用于指示物品属性的第二实体,m为大于1的整数。
下面以图6中的配对块1为例介绍双向传导计算。
配对块1对应历史物品i 1、与待推荐物品v之间包括m条路径,其中第一条路径包括:v-R 1st-e 1-R 2nd-...-e-R end-i 1,第二条路径包括:v-R 1st-e 2-R 2nd-...-e-R end-i 1,第m条路径包括:v-R 1st-e m-R 2nd-...-e-R end-i 1。R 1st表示推荐物品v与实体e 1之间的关系矩阵,R 2nd表示实体e 1与其他实体e之间的关系矩阵,R end表示其他实体e与历史物品i 1之间的关系矩阵。对于配对块1中的第一条路径来说,计算第一条路径的双向传导计算,相当于计算第一条路径中左右两个流向的向量汇集到一起的概率,即从第一条路径中的待推荐物品v以及历史物品i 1流向中间实体的概率。
可选地,由于一条路径对应一个概率,因此,该概率可以作为路径的分值,根据TOPK的需要对分值从高到低选取,以得到被推荐物品的解释。计算概率所用的分母可以是一个配对块中m条路径对应的m个概率之和,当然,为了避免只有单一路径导致概率为100%,影响后续推荐的准确性,计算概率的分母也可以是n个配对块中n*m条路径对应的n*m个概率之和,具体此处不做限定。
本申请实施例中的解释可以是概率,也可以是对得到被推荐物品的一条或多条路径所指 示的两端的实体之间的关联的描述。
其中,R 2nd也可以为R end,e 2为e m,即一条路径至少包括三个实体(v、e、i)以及两个关系矩阵(R 1st、R end)。一个配对块对应一个u,求的各个配对块的u之后,可以直接相加或累积加权求和得到用户的反馈词向量u。
本申请实施例中待推荐物品的分值仅以待推荐物品与反馈词向量的距离(即
Figure PCTCN2021141472-appb-000025
)为例进行示例性说明,可以理解的是,待推荐物品的分值也可以是一个配对块对应的u,待推荐物品的分值还可以是多个配对块相加后得到的反馈词向量等,具体此处不做限定。
可选地,一个配对块对应一个u,因此,该u可以作为待推荐物品的分值,根据TOPK的需要对分值从高到低进行选取,以得到被推荐物品。当然,也可以将多个配对块对应的u相加得到的反馈词向量作为分值来选取被推荐物品,具体此处不做限定。
示例性的,推荐物品v与配对块1的路径如图7所示,待推荐物品v为《百变星君》,关系矩阵R 1st包括:主演的关系矩阵和类型的关系矩阵,实体e 1为周星驰,实体e 2为吴孟达,实体e 3为喜剧,关系矩阵R end包括:主演的关系矩阵和类型的关系矩阵。即图7中的第一条路径包括:《百变星君》-主演-周星驰-主演-《整蛊专家》,第二条路径包括:《百变星君》-主演-吴孟达-主演-《整蛊专家》,第三条路径包括:《百变星君》-类型-喜剧-类型-《整蛊专家》。对于第一条路径的一端流向是《百变星君》通过关系(主演)流向周星驰,第一条路径的另一端流向是《整蛊专家》通过关系(主演)流向周星驰。
可选地,推荐网络还包括抽象用户权重以及待推荐物品的分值计算。其中,抽象用户权重用于计算用户的反馈词向量u。分值计算用于计算待推荐物品与反馈词向量u之间的距离(即该待推荐物品的分值
Figure PCTCN2021141472-appb-000026
)。进一步的,推荐网络可以根据待推荐物品的分值,从分值高至低为用户输出分值对应的待推荐物品(即被推荐物品),也可以根据TOPK的需要对分值从高到低进行选取,以得到被推荐物品。进一步的,抽象用户权重还可以用于更新推荐物品v的词向量,即p是配对块中多个路径概率最大的路径对应的概率。当然,p也可以设置为1,即不更新待推荐物品v的词向量,具体此处不做限定。
本申请实施例中的推荐结果可以包括待推荐物品,推荐结果还可以包括待推荐物品以及对待推荐物品的解释,当然,推荐结果还可以包括待推荐物品、对待推荐物品的解释以及待推荐物品对应的分值等,具体此处不做限定。
本申请实施例中,损失函数用于指示推荐网络的推荐结果与目标推荐结果之间的差异。在该情况下,以减小损失函数的值为目标对推荐网络进行训练,也就是不断缩小推荐网络的推荐结果与目标推荐结果之间的差异。该训练过程可以理解为推荐任务。损失函数可以理解为推荐任务对应的损失函数。
可选地,若推荐结果待推荐物品的分值,该分值用于描述用户对待推荐物品的喜好程度,分值越高代表用户越喜欢该待推荐物品,再根据TOPK的需要对分值从高到低进行选取,以得到被推荐物品。
可选地,若推荐结果包括待推荐物品的分值,该损失函数包括第一损失函数,该第一损失函数用于指示推荐网络输出的被推荐物品的计算分值与实际分值之间的差异,该实际分值为用户选择过的历史物品对应的分值,该计算分值为推荐网络输出的分值。
可选地,第一损失函数采用下述公式:
Figure PCTCN2021141472-appb-000027
其中,若是在二分类场景下,y为正负样本,即取值为1或0。
Figure PCTCN2021141472-appb-000028
代表u与v之间的距离,具体可以是u T与v之间的距离,此处不做限定。
进一步的,损失函数还可以包括第二损失函数,该第二损失函数用于指示知识图谱中路径中第一训练向量与第二训练向量之间词向量的差值。对于一条训练路径,第一训练向量为从训练路径中,指示待推荐物品的第一实体,指向训练路径中,与指示待推荐物品的第一实体相邻的实体的向量,第二训练向量为从训练路径中,用户的历史记录涉及的物品的第一实体,指向训练路径中,与指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,第二训练向量为从训练路径中,用户的历史记录涉及的物品属性的第二实体,指向训练路径中,与用户的历史记录涉及的物品属性的第二实体相邻的实体的向量,在训练过程中,上述的待推荐物品也是用户点击过的物品。
可选地,该第一训练向量为路径中待推荐物品对应的第一实体指向相邻实体的向量,该第二训练向量为历史物品对应的第一实体指向相邻实体的向量,或者该第二训练向量为历史物品属性对应的第一实体指向相邻实体的向量。
换句话说,第二损失函数的目的最小化路径左右流向同一节点的计算误差,使得在嵌入空间中更高维度的关系矩阵内,左边计算后的词向量尽可能与右边计算的词向量相等。
示例性的,训练知识图谱中的两个三元组分别为“《霸王别姬》-主演-张国荣”以及
“《霸王别姬》-主演-张丰毅”,这种情况下,就会导致中间实体“张国荣”与“张丰毅”不是同一实体,即中间实体无法对齐,导致推荐网络的训练很难收敛,因此引入第二损失函数,尽可能的使得第一训练向量与第二训练向量之间词向量的差异最小(即《霸王别姬》+“第一训练关系:主演”得到的向量与《阿飞正传》+“第一训练关系:主演”的向量尽可能相等,使得路径的计算正确,加速推荐网络的收敛)。
可选地,第二损失函数采用下述公式:
min L 2=∑-lnσ(max|ε im-ε′ im|)。
其中,σ为激活函数,ε im代表路径的一端流向中间实体(或相邻实体)的第一特征向量,ε′ im代路径的另一端流向中间实体(或相邻实体)的第二特征向量,max代表取多维中差值最大的数,
可以理解的是,上述公式还可以有其他变形,例如:可以将max更换为avg(代表取多维中差值的平均数),ε im更换为g(ε im)等,其中g()代表图谱计算,第二损失函数的具体公式还可以有其他变形,具体此处不做限定。
进一步的,损失函数还可以包括第三损失函数,该第三损失函数用于指示实体的计算词 向量与实体的真实词向量的差值。其中,该实体包括指示物品的第一实体以及指示物品属性的第二实体。
延续上述举例,第三损失函数的目的是使三元组的头部《霸王别姬》与关系“主演”相加得到的向量与“张国荣”这个维度的向量尽可能相等。
可选地,第三损失函数采用下述公式:
min L 3=∑-lnσ(s im-M re)+X 2
Figure PCTCN2021141472-appb-000029
其中,σ为激活函数,s im代表三元组中头部节点流向尾部节点得到尾部节点的计算词向量,s im可以理解为上述的第一训练向量或第二训练向量,M re为尾部节点的实际词向量,X 2为正则化函数,用于避免过拟合,可选地,X 2为最小平方误差函数。
可以理解的是,上述公式还可以有其他变形,例如:可以将s im更换为g(s im),M re更换为g(M re),其中g()代表图谱计算,第三损失函数的具体公式还可以有其他变形,具体此处不做限定。
可选地,若损失函数包括第一损失函数,则损失函数的数值为第一损失函数的数值。若损失函数包括第一损失函数以及第二损失函数,则损失函数的值可以是第一损失函数的值与第二损失函数的值的和、平均值、加权平均值等,具体此处不做限定。同理,若损失函数包括第一损失函数、第二损失函数以及第三损失函数,则损失函数的值可以是第一损失函数的值、第二损失函数的值与第三损失函数的和、平均值、加权平均值等,具体确定损失函数的数值所采用的方式此处不做限定。
可选地,损失函数的数值可以如下述计算方式计算:
Figure PCTCN2021141472-appb-000030
其中,λ 1、λ 2、λ 3为可调系数,可以根据实际需要进行设置,具体此处不做限定。
一方面,本申请提供的推荐网络可以通过双向传导计算的方式,对待推荐物品打分,以得到被推荐物品。还可以对路径打分,以得到对待推荐物品的解释,即获取任意两个连接实体之间的语义信息的解释。另一方面,本申请实施例提供的损失函数可以使得推荐网络在训练过程中的精度有所提升(具体可参阅下述评估推荐网络以及表1对应的描述)。具体的,本申请实施例提供的第二损失函数可以通过最小化路径两端流向同一节点的误差,可以解决复杂关系中路径两端流向同一节点的问题。本申请实施例中的第三损失函数可以通过最小化三元组头尾两个节点的向量映射到用一个关系空间的误差,可以解决复杂关系中,单个三元组存在一对多,多对一的问题。
需要说明的是,训练过程也可以不采用前述方法而采用其他训练方法,此处不做限定。
下面结合附图对本申请实施例的推荐方法进行详细的介绍。
请参阅图8,本申请实施例中推荐方法一个实施例,该方法的执行主体可以是云服务设备,也可以是终端设备,例如,电脑、服务器等运算能力足以用来执行推荐方法的推荐装置,也可以是由云服务设备和终端设备构成的系统。示例性地,该方法的执行主体可以是图3中的执行设备310、图4中的神经网络处理器40。
可选的,该方法的执行主体可以是CPU,也可以是CPU和GPU,也可以不是GPU,而使用其他适合用于神经网络计算的处理器,具体此处不做限定。
本申请实施例中的推荐方法可以应用于电影推荐、游戏推荐、音乐推荐、新闻推荐等场景,具体此处不做限定,下面以电影推荐场景为例对本申请实施例提供的推荐方法进行描述。
该方法包括:
步骤801、获取知识图谱。
本申请实施例中的知识图谱包括多个用于指示物品的第一实体以及多个用于指示物品属性的第二实体。知识图谱可以是现有的知识图谱也可以是新构建的知识图谱,具体此处不做限定。
另外,对于知识图谱的描述可以参考前面的术语解释以及图1对应的描述,具体此处不再赘述。
本申请实施例中的知识图谱可以具有与用户历史记录关联的功能(也可以理解为,知识图谱可以区分知识图谱中的哪些物品是用户未点击过的,哪些物品是用户点击过的,即可以根据知识图谱直接选取路径),也可以不具有与用户历史记录关联的功能(也可以理解为,需要用户的标识、物品的标识以及知识图谱才能确定路径),具体此处不做限定。
本申请实施例中的知识图谱可以是针对一个用户构建的知识图谱,也可以是对多个用户构建的知识图谱,具体此处不做限定。
如果是新构建的知识图谱,先获取用户信息、物品信息(推荐物品以及历史物品)以及相关的外部知识,该外部知识包括但不限于物品的属性信息(例如:电影的导演、演员、类型;游戏的开发商、运营商、分类;新闻的构成要、何时、何地、何人等)、用户维度的特征(例如:用户的年龄分布、职业等)。当然,也可以对获取的以上信息进行筛选,即对不同用户进行分组推荐,例如:将用户的年龄分布相近的设为一组,从而提升推荐效率。其中,推荐物品为用户未点击过的物品(例如:用户未观看过的电影),历史物品为用户点击过的物品(例如:用户之前观看过的电影)。
可选地,如果是新增用户,可能物品信息较少,也可以采用一些策略(例如:随机法)先向用户推荐一些物品,得到反馈信息后,得到物品信息和/或物品的属性信息等。
可选地,获取上述信息之后,可以先构建三元组,然后将相同节点的三元组连接起来,构建一个用于推荐的知识图谱。
示例性的,一个三元组包括:电影名字:《霸王别姬》-关系:主演-实体:张国荣,另一个三元组包括:电影名字:《阿飞正传》-关系:主演-实体:张国荣。这两个三元组都有一个共同的实体节点(张国荣),则将这两个三元组通过张国荣连接起来。
步骤802、基于知识图谱以及用户的信息运行推荐网络,以得到推荐结果。
本步骤中使用的推荐网络可以是通过上述图5中的方法构建的,也可以是通过其他方式构建的,具体此处不做限定。
本申请实施例中,基于知识图谱以及用户的信息运行推荐网络有多种情况,下面分别描述:
第一种、以路径为输入运行推荐网络。
基于知识图谱以及用户的信息,在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联。
可选地,将多条路径输入推荐网络以对多个待推荐物品打分,以使推荐网络得到推荐结果。
第二种、以知识图谱以及用户的信息为输入运行推荐网络。
将知识图谱以及用户的信息输入推荐网络,该推荐网络基于知识图谱以及用户的信息,在知识图谱中提取多条路径,每条路径指示路径两端的实体之间的关联。
可选地,用户的信息可以包括第一标识以及第二标识。第一标识指示待推荐物品,第二标识指示历史物品或者历史物品属性,知识图谱中包括与第一标识对应的第一实体,以及与第二标识对应的第一实体或第二实体。
可选地,基于多条路径各自的第一方向和第二方向对多个待推荐物品打分,以使推荐网络得到推荐结果。
可以理解的是,上述几种方式只是举例,在实际应用中,还可以有其他方式的输入,具体此处不做限定。
不管上述输入的方式有哪几种,上述多种方式的目的都是确定出多条路径,进而得到推荐结果,该推荐结果可以包括被推荐物品,该推荐结果也可以包括对被推荐物品的解释(也可以理解为评估结果),该推荐结果还可以包括被推荐物品以及对被推荐物品的解释,具体此处不做限定。
可选地,对多条路径中的每条路径,都基于每条路径的第一向量和第二向量汇集到每条路径中的一个实体的概率对每条路径对应的待推荐物品打分,以得到被推荐物品。
可选地,基于多条路径各自的第一方向和第二方向分别对多条路径打分,以得到对推荐结果的解释,解释是对得到推荐结果的一条或多条路径所指示的两端的实体之间的关联的描述。
下面结合图9说明如何基于多条路径得到推荐结果,请参阅图9,基于多条路径得到推荐结果可以包括以下几个步骤:
步骤8021、计算知识图谱中路径的第一向量以及第二向量。
其中,第一向量与第一方向的方向一致,第二向量与第二方向的方向一致,对于一条路径,第一向量为从路径中,指示待推荐物品的第一实体,指向路径中,与指示待推荐物品的第一实体相邻的实体的向量,第二向量为从路径中,历史物品的第一实体,指向路径中,与历史物品的第一实体相邻的实体的向量,或者,第二向量为从路径中,历史物品属性的第二实体,指向路径中,与历史物品属性的第二实体相邻的实体的向量。
为了方便描述,定义本申请实施例中用于指示物品的第一实体分为第一推荐实体和第一历史实体,即指示被推荐物品或者待推荐物品的第一实体为第一推荐实体,指示用户的历史记录涉及的物品的第一实体为第一历史实体。则路径包括第一推荐实体、第一关联实体、第一推荐实体与第一关联实体的第一关系、第二关联实体、第一历史实体、第一历史实体与第二关联实体之间的第二关系。其中,第一关联实体和/或第二关联实体可以是用于指示物品的实体或指示物品属性的实体,具体此处不做限定。
示例性的,以一个第一推荐实体,三个第一历史实体为例,如图10所示,第一推荐实体为《霸王别姬》,用户A的历史观看记录(即第一历史实体)包括:《阿飞正传》、《鸿门宴》、《梅兰芳》。《霸王别姬》与《阿飞正传》相连于一个实体(后续称为中间实体):港片以及张国荣,《霸王别姬》与《鸿门宴》有共同的中间实体:历史,《霸王别姬》与《梅兰芳》有共同的中间实体:陈凯歌和京剧。即第一关联实体与第二关联实体重合,第一关系分别为类型、主演、类型、导演、种类,第二关系分别为类型、主演、类型、导演、种类。结合前述图6可以理解,图10包括3个配对块,第一配对块与第三配对块分别包括两条路径,第二配对块包括1条路径,即图10包括5条路径:
第一条路径:《霸王别姬》-类型-港片-类型-《阿飞正传》。
第二条路径:《霸王别姬》-主演-张国荣-主演-《阿飞正传》。
第三条路径:《霸王别姬》-类型-历史-类型-《鸿门宴》。
第四条路径:《霸王别姬》-导演-陈凯歌-导演-《梅兰芳》。
第五条路径:《霸王别姬》-种类-京剧-种类-《梅兰芳》。
获取路径之后,可以确定路径中的第一向量与第二向量,该第一向量为路径中一端(例如:第一推荐实体)指向中间实体的向量,该第二向量为路径中另一端(例如:第一历史实体)指向中间实体的向量。其中,该中间实体可以理解为与第一推荐实体相邻的实体或与第一历史实体相邻的实体,该中间实体为第一关联实体和/或第二关联实体。第一向量与第二向量可以是多维向量。
延续上述举例,对于第二条路径来说,第一向量可以为《霸王别姬》指向张国荣的向量,第二向量可以为《阿飞正传》指向张国荣的向量,此时,中间实体为张国荣。可以理解的是,第一向量还可以为《阿飞正传》指向张国荣的向量,第二向量还可以为《霸王别姬》指向张国荣的向量,即对于图10来说,左流向是第一方向,右流向是第二方向,或者左流向是第二方向,右流向是第一方向。下面以左流向是第一方向,右流向是第二方向为例进行示意性说明。
可选地,可以通过下述公式计算第一向量与第二向量。
Figure PCTCN2021141472-appb-000031
Figure PCTCN2021141472-appb-000032
其中,
Figure PCTCN2021141472-appb-000033
代表第一向量,
Figure PCTCN2021141472-appb-000034
代表第二向量,或者
Figure PCTCN2021141472-appb-000035
代表第二向量,
Figure PCTCN2021141472-appb-000036
代表第一向量;M r代表推荐物品与中间实体对应的物品或物品属性的关系矩阵,τ代表推荐物品的词向量,
Figure PCTCN2021141472-appb-000037
代表推荐物品与中间实体对应的物品或物品属性之间关系的词向量,i u代表历史物品的词向量,
Figure PCTCN2021141472-appb-000038
代表历史物品与中间实体对应的物品或物品属性之间关系的词向量,m为大于0的整数,m的取值与路径的数量相同。下面以
Figure PCTCN2021141472-appb-000039
代表第一向量,
Figure PCTCN2021141472-appb-000040
代表第二向量为例进行说明。
可以理解的是,还可以通过其他公式计算第一向量与第二向量,具体此处不做限定。
延续上述图10的举例,则第一条路径的第一向量为:《霸王别姬》的词向量*类型的矩阵+类型的词向量,第一条路径的第二向量为:《阿飞正传》的词向量*类型的矩阵+类型的词向量。则第二条路径的第一向量为:《霸王别姬》的词向量*主演的矩阵+主演的词向量,第二条路径的第二向量为:《阿飞正传》的词向量*主演的矩阵+主演的词向量。则第三条路径的第一向量为:《霸王别姬》的词向量*类型的矩阵+类型的词向量,第三条路径的第二向量为:《鸿门宴》的词向量*类型的矩阵+类型的词向量。则第四条路径的第一向量为:《霸王别姬》的词向量*导演的矩阵+导演的词向量,第四条路径的第二向量为:《梅兰芳》的词向量*导演的矩阵+导演的词向量。则第五条路径的第一向量为:《霸王别姬》的词向量*种类的矩阵+种类的词向量,第五条路径的第二向量为:《梅兰芳》的词向量*种类的矩阵+种类的词向量。数学表达式如下:
Figure PCTCN2021141472-appb-000041
Figure PCTCN2021141472-appb-000042
Figure PCTCN2021141472-appb-000043
Figure PCTCN2021141472-appb-000044
Figure PCTCN2021141472-appb-000045
Figure PCTCN2021141472-appb-000046
Figure PCTCN2021141472-appb-000047
Figure PCTCN2021141472-appb-000048
Figure PCTCN2021141472-appb-000049
Figure PCTCN2021141472-appb-000050
步骤8022、分别计算每条路径的第一向量和第二向量汇集到每条路径包括的一个实体(也可以称为中间实体)的概率。
确定路径的第一向量与第二向量之后,计算第一向量与第二向量的映射关系重合到一起的概率(即第一向量与第二向量汇集到一起的概率),该概率可被抽象成用户维度的词向量,可以反映用户对中间实体的喜好程度。可以使用该概率值表示每条路径的重要程度。
可以理解的是,假设路径的节点数量为奇数,则中间实体为路径的中间节点,若路径的节点数为偶数,则中间实体可以是路径最中间两个节点中的任一个节点(一般确定中间两个节点中离推荐物品近的节点为中间实体)。
示例性的,用户看过10部电影中的其中8部都是由演员张国荣出演的,则在该种情况下,路径中包括节点“张国荣”的概率较大。
可选地,可以通过下述公式计算每条路径的第一向量和第二向量汇集到中间实体的概率。
Figure PCTCN2021141472-appb-000051
其中,p m代表概率,
Figure PCTCN2021141472-appb-000052
代表第一向量,
Figure PCTCN2021141472-appb-000053
代表第二向量;exp代表以e为底的指数函数,M为正整数,M代表待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量(例如:图10中的3个M分别为2、1、2),其他参数的解释可以参照上述公式对应的解释,此处不再赘述。
可以理解的是,还可以通过其他公式计算第一向量与第二向量汇集到同一中间实体的概率,具体此处不做限定。
示例性的,结合前述图6以及延续上述图10的举例,计算配对块1中从《霸王别姬》通过电影的主演流向到“张国荣”这个节点;计算从用户观看的电影《阿飞正传》通过电影的主演流向张国荣这个节点,计算两个流向的信息汇集在“张国荣”的概率。
则第一向量与第二向量汇集到港片的概率p 1的数学表达式如下:
Figure PCTCN2021141472-appb-000054
Figure PCTCN2021141472-appb-000055
或者,
Figure PCTCN2021141472-appb-000056
可选地,上述分母如前述图6对应的描述类似,该分母可以是n个配对块中m条路径的概 率之和(即分母的概率数量可以是n*m个),也可以是一个配对块中m条路径的概率之和(即分母的概率数量可以是m个),具体此处不做限定。由于图10的举例只是路径的部分,一个配对块只有一条路径的情况下,会导致概率不准确,因此,本步骤中计算概率的分母采用所有路径的概率之和为例进行示意性说明。
则第一向量与第二向量汇集到张国荣的概率p 2的数学表达式如下:
Figure PCTCN2021141472-appb-000057
则第一向量与第二向量汇集到历史的概率p 3的数学表达式如下:
Figure PCTCN2021141472-appb-000058
则第一向量与第二向量汇集到陈凯歌的概率p 4的数学表达式如下:
Figure PCTCN2021141472-appb-000059
则第一向量与第二向量汇集到京剧的概率p 5的数学表达式如下:
Figure PCTCN2021141472-appb-000060
计算第一向量与第二向量汇集到同一中间实体的概率,即得到待推荐物品的解释。示例性的,延续上述举例,解释可以包括:解释1:p 1所对应的路径属性节点(港片),解释2:p 2所对应的路径属性节点(张国荣)。
步骤8023、基于概率以及中间实体对应的词向量确定用户的反馈词向量。
可选地,计算第一向量与第二向量汇集到同一中间实体的概率之后,可以基于概率以及对应的中间实体的词向量确定用户的反馈词向量。换句话说,可以先汇总每组包含了用户喜好的特征值为用户的反馈词向量。
可选地,可以通过下述公式计算用户的反馈词向量。
Figure PCTCN2021141472-appb-000061
Figure PCTCN2021141472-appb-000062
其中,c n代表在一个配对块中推荐物品与第n个历史物品的反馈词向量,e m代表中 间实体的词向量,p m代表左向量与右向量汇集到同一中间实体的概率,u代表用户的反馈词向量,N为大于1的整数,N代表历史物品的数量。
可以理解的是,还可以通过其他公式计算用户的反馈词向量,具体此处不做限定。
示例性的,延续上述图10的举例,
c 1=e 1p 1+e 2p 2;
c 2=e 3p 3;
c 3=e 4p 4+e 5p 5;
Figure PCTCN2021141472-appb-000063
其中,e 1为港片对应的词向量,e 2为张国荣对应的词向量,e 3为历史对应的词向量,e 4为陈凯歌对应的词向量,e 5为京剧对应的词向量,其他参数的解释可以参照上述公式对应的解释,此处不再赘述。
换句话说,路径中带有语义的实体节点,可用来描述用户的潜在喜好(如:电影的主演名字、电影类型、导演名字等)。这些属性节点的词向量,与对应路径的概率做运算(如:相乘等),就可以得出单条路径的反馈信息。
示例性的,延续上述图10的举例,得到概率之后,可以根据概率生成反馈信息,反馈信息可以包括:反馈信息1=p 1*港片在嵌入空间的词向量,反馈信息2=p 2*张国荣在嵌入空间的词向量等。
步骤8024、计算待推荐物品对应的词向量与反馈词向量之间的距离,以得到待推荐物品的分值。
可选地,还可以计算待推荐物品对应的词向量与反馈词向量之间的距离,得到待推荐物品的分值。
本申请实施例中,待推荐物品对应词向量与反馈词向量之间的距离可以通过向量点积、余弦值或相似度等方法进行计算,下面以向量点积为例。
可选地,可以通过下述公式计算待推荐物品对应的词向量与反馈词向量之间的距离:
Figure PCTCN2021141472-appb-000064
其中,
Figure PCTCN2021141472-appb-000065
代表分值,τ代表待推荐物品的词向量,σ为激活函数,u T代表用户的反馈词向量u对应的转置矩阵,·代表内积运算。
可以理解的是,还可以通过其他公式计算待推荐物品对应的词向量与反馈词向量之间的距离,具体此处不做限定。
可选地,上述激活函数可以是SIGMOID函数,用来将分值限制在[0,1]之内。
其中,分值越小,代表待推荐物品与用户的反馈词向量越近,代表用户越喜欢该推荐物品。
为了方便理解,下面以词向量维度为10以及向量内积的计算方式对上述计算分值的过程进行举例描述:假设推荐电影集{《霸王别姬》、《小时代》、《星际穿越》},且推荐网络已完成训练词向量的权重。计算出以下词向量:
用户A的反馈词向量为[0.6626494,0.5364959,-0.05639589,0.621532,0.59782714,0.44225037,-0.5474265,0.589441,0.39717668,0.16018206]。
《霸王别姬》的词向量为[1.2724952,0.44506034,0.12865402,1.6125565,1.03306697,-0.01394547,-0.6698308,0.6348874,0.4119322,0.071924224]。
《小时代》的词向量为[-0.00414435,0.0892299,-0.004835337,0.8153024,0.37877557,-0.096624255,-0.34244198,0.44271728,0.42087126,0.5350623]。
《星际穿越》的词向量为[0.008653568,0.2210477,-0.04570025,0.640234,0.38816172,-0.13182494,-0.48932806,0.56698304,0.6465809,0.8148861]。
分值计算结果:
内积(用户A,霸王别姬):3.604461848204668。
内积(用户A,小时代):1.437129814068635。
内积(用户A,星际穿越):1.6879938602873226。
激活函数后的数值(即推荐分值):
A霸王别姬:0.9735182781851668。
A小时代:0.8080097931691103。
A星际穿越:0.8439601507627418。
步骤8025、基于待推荐物品的分值确定被推荐物品。
得到待推荐物品的分值之后,可以根据TOPK的需要对分值从高到低选取,以得到被推荐物品。
可选地,在获取推荐物品的分值之后,可以按照分值排序待推荐物品,若选用Top5,则在推荐电影集中选择分值排在前5的待推荐物品作为被推荐物品,并展示给用户。
示例性的,延续上述举例,则对用户A来讲,推荐物品的排序为:《霸王别姬》、《星际穿越》、《小时代》。如果是TOP1,则《霸王别姬》为被推荐物品。
步骤8026、基于概率得到对被推荐物品或待推荐物品的解释。本步骤是可选地。
得到路径的概率之后,该概率可被抽象成用户维度的词向量,输出该概率(即待推荐物品或被推荐物品的解释)。可以反映用户对中间实体的喜好程度。可以使用该概率的数值表示每条路径的重要程度。
可选地,还可以将对被推荐物品或待推荐物品的解释通过图谱的方式进行展示,以前述介绍的游戏推荐场景以及相关举例,得到如图11所示的图谱,该游戏推荐场景下的背景介绍请参阅表1:
表1
为用户A推荐命中的游戏名称 军团要塞2《Team Fortress 2》
用户A玩过的游戏名称 半条命、DOTA2等
知识图谱中的关系属性 游戏类型、游戏发行商、游戏属性等
知识图谱中的属性实体节点 动作类、1998、免费等
如图11所示,该用户A喜欢Valve公司的程度为21.1%,喜欢动作类型游戏的程度为38.6%等,因此,为用户推荐游戏“军团要塞2”起到关键因素的两点是军团要塞2和用户玩过的游戏半条命同属于Valve公司开发的游戏,并且游戏类型都是动作类。当一款游戏同时具有这两个属性(Valve,动作类)的时候,用户A的喜好程度就会提升。
可选地,解释可以是概率,也可以是对得到推荐结果的一条或多条路径所指示的两端的实体之间的关联的描述。
示例性的,延续上述举例,若《霸王别姬》与《阿飞正传》在嵌入空间的距离非常相近。则可以生成如下解释语句:“为用户A推荐电影《霸王别姬》是因为它与用户观看过的电影《阿飞正传》非常相似,并且它们都是由明星张国荣主演。
步骤8027、基于分值评估被推荐物品的准确性。本步骤是可选地。
可选地,获取被推荐物品的分值后,可以基于该分值评估被推荐物品的准确性,也可以理解为基于该分值评估推荐网络的准确性。
本申请实施例中,基于分值评估被推荐物品的准确性有多种方式,下面分别描述:
1、精准率(precision)(即前述的推荐精准率)。
该精准率的计算方式如前面所述,推荐率=推荐出的正确信息条数/推荐出的信息条数。
具体过程:将用户观看过的历史物品不重复的分为训练集与测试集,该训练集用于前述图5所示实施例中的训练方法,测试集用于图6所示实施例中的推荐方法,并根据推荐出的正确信息条数(即TopK中正确的推荐物品,K为大于0的整数,K=1代表输出一个分值最高的待推荐物品,K=5代表输出五个分值排在前面的待推荐物品为被推荐物品)以及推荐出的信息条数(即K的数量)计算得到被推荐物品的精准率。
示例性的,用户看过的历史物品为40个,其中训练集包括30个,测试集包括10个。将100个待推荐物品输入推荐网络,若推荐出来的Top5中的4个被推荐物品为用户看过的历史物品,则精准率=4/5=0.8。
2、召回率(recall)(即前述的推荐召回率)。
该召回率的计算方式如前面所述,召回率=推荐出的正确信息条数/样本中的信息条数。
示例性的,延续上述计算精准率的例子,召回率为4/10=0.4。
3、AUC。
该AUC的具体描述如前面所述,计算ROC曲线下的面积。主要评估单个被推荐物品的正确性以及是否出现过拟合,通过二分类器以及阈值获知该单个被推荐物品是“真阳”还是“假阳”。
示例性的,阈值为0.5,若该被推荐物品在二分类器中的输出结果是0.7,即大于阈值,则该被推荐物品是正确的。若该被推荐物品在二分类器中的输出结果是0.3,即小于阈值, 则该被推荐物品是不正确的。
可以理解的是,上述三种评估推荐网络的方式只是举例,实际应用中,还可以有其他的方式(例如:准确率)评估被推荐物品的准确性,具体此处不做限定。
本申请实施例中的评估方式可以应用于推荐网络的训练阶段(例如图5所示的训练方法),也可以应用于推荐网络的推理阶段(例如图6所示的推荐方法),具体此处不做限定。
为了更直观的看出本申请实施例提供的推荐网络的推荐准确性,将现有的推荐模型与本申请实施例中的TB-Net进行对比。
其中,现有的推荐模型包括:波纹(ripple net)推荐模型、基于协同过滤和知识词向量(collaborative knowledge base embedding,CKE)的推荐网络、贝叶斯个性化排序(bayesian personalized ranking matrix factorization,BPRMF)推荐算法、神经因子分解机(neural factorization machine,NFM)推荐算法、深度知识感知网络(deepknowledge-aware network,DKN)、融合浅层模型和深层模型(Wide&Deep)的推荐模型。
1、精准率和召回率两个指标的对比结果。
精准率(precision)的对比结果可参考图12,召回率(recall)的对比结果可参考图13。
该对比结果为本申请提供的TB-Net与四个主流模型(ripple net、CKE、BPRMF、NFM)用于训练新闻推荐数据集:MIND(microsoft news dataset)来完成推荐新闻的任务,并用精准率和召回率两个指标来衡量被推荐物品的准确性。由图12与图13的对比结果可知,在精准率和召回率上,本申请提供的TB-Net的表现较好,高于其它主流模型(ripple net、CKE、BPRMF)。该对比结果证明了本申请实施例提供的TB-Net相对于现有的推荐系统(ripple net、CKE、BPRMF),推荐准确性有显著提升。
2、AUC与准确率两个指标的对比结果。
AUC与准确率的对比结果如表2所示:
表2
Figure PCTCN2021141472-appb-000066
由上述表2的对比结果可以看出,本申请实施例中的推荐网络(即TB-Net)从AUC何推荐的准确率指标上,优于现有技术,与业界领先的深度学习推荐模型(微软提出的ripple net和谷歌提出的Wide&Deep)基本持平,并一定程度上有所提升。本申请实施例提供的推荐网络具备高推荐准确性的特点。
步骤8028、基于概率以及知识图谱评估解释的准确性。本步骤是可选地。
可选地,获取路径对应的概率之后,可以按照概率的大小进行排序,并根据该排序以及知识图谱中子图节点的度(digree)排序评估对待推荐物品或被推荐物品的解释的准确性。 其中,节点的度是指和该节点相关联的边数(即连接的关系数量)。
示例性的,若解释采用Top2,路径中概率较高的两个p 2(即张国荣所在第二路径对应的概率)以及p 4(即陈凯歌所在第四路径对应的概率)。且知识图谱中digree排序中的前两位为张国荣节点以及京剧节点。相当于,张国荣对应的概率p 2以及张国荣节点在知识图谱中度的排序都在前两位,陈凯歌对应的概率p 4以及陈凯歌节点在知识图谱中度的排序没在前两位。则说明张国荣所在第二路径的解释比较准确。相对的,陈凯歌所在第四路径的解释相较张国荣对应的解释来说不够准确。
为了更直观的看出本申请实施例提供的推荐网络输出解释的准确性,将现有的推荐解释模型与本申请实施例中的推荐网络在电影推荐场景下(MovieLens数据集)进行解释对比。本申请实施例提供的推荐网络也可以称为塔桥网络(tower-bridge net,TB-Net),或者称为双向显著可解释推荐网络。
其中,现有的推荐解释模型包括:波纹(ripple net)推荐模型、多任务协同过滤模型(attentive multitask collaborative filtering,AMCF)、可解释的线性回归模型(interpretable linear regression model,LR)。
解释的对比结果如表3所示:
表3
推荐解释模型 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
其中,解释的召回率相当于TopG@K,K代表推荐模型输出解释的数量,G代表数据集中用户认可解释的前几个。示例性的,Top1@3表示推荐模型输出的3个解释中存在数据集中第1位解释的概率,相当于通过用户的反馈确定推荐模型输出被推荐物品的解释是否符合用户的真实预期。
该对比结果证明了本申请实施例提供的TB-Net相对于现有的推荐解释模型(ripple net、AMCF、LR),输出解释信息的准确性有显著提升。本申请实施例提供的推荐网络同时具备高解释性和高推荐准确性的特点,即在保持高推荐准确率的同时,给出语义级的解释。
本申请实施例中,图9所示的各个步骤不限定时序关系。例如:步骤8026可以在步骤8025之前,也可以在步骤8024之前,保证步骤8026在步骤8022之后即可。步骤8027可以在步骤8026之前,也可以在步骤8025之前,保证步骤8027在步骤8024之后即可。步骤8028可以在步骤8027之前。
可以理解的是,若推荐网络只输出待推荐物品的解释,则图9所示的步骤可以包括步骤8021、步骤8022、步骤8026。若推荐网络只输出被推荐物品,则图9所示的步骤可以包括步骤8021至步骤8025。
在一种可能实现的方式中,基于多条路径得到推荐结果的步骤可以包括步骤8021至步骤8025。在另一种可能实现的方式中,基于多条路径得到推荐结果的步骤可以包括步骤8021至步骤8026。在另一种可能实现的方式中,基于多条路径得到推荐结果的步骤可以包括步骤 8021至步骤8027。在另一种可能实现的方式中,基于多条路径得到推荐结果的步骤可以包括步骤8021至步骤8028。
本申请实施例中,一方面,通过双向传导计算,可以为待推荐物品或被推荐物品提供高语义的解释信息,可以与现有技术中的推荐系统进行嫁接,即可以为现有推荐系统输出的推荐物品提供高语义的解释信息。另一方面,通过在汇集处(即中间实体)计算路径左右两个流向汇集在中间实体的重合概率,用来表示该路径的重要程度。另一方面,通过重合概率与中间实体的计算,可以得到用户的偏好反馈信息(即用户的反馈词向量),该反馈词向量用来输出可信可靠的语义性解释。另一方面,可以聚合路径两端的偏好反馈信息形成反馈词向量,并与待推荐物品进行计算输出被推荐物品,能够得到更为精准的推荐结果,即提升推荐的召回率。
上面对本申请实施例中的推荐方法进行了描述,下面对本申请实施例中的推荐装置进行描述,其中,神经网络相当于前述的推荐网络,请参阅图14,本申请实施例中推荐装置1400的一个实施例包括:
获取单元1401,用于获取知识图谱,知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体;
运行单元1402,用于基于知识图谱以及用户的信息运行神经网络,以得到推荐结果,用户的信息指示用户的历史记录涉及的物品或者物品属性,推荐结果包括被推荐物品,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,第一方向起始于指示被推荐物品或者待推荐物品的第一实体,第二方向起始于指示用户的历史记录涉及的物品的第一实体,或者第二方向起始于指示用户的历史记录涉及的物品属性的第二实体。
本实施例中,推荐装置中各单元所执行的操作与前述图5、图8和/或图9所示实施例中描述的类似,此处不再赘述。
本实施例中,运行单元1402可以基于知识图谱以及用户的信息运行神经网络,以得到推荐结果,其中,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到推荐结果,提供了一种新的推荐方法。
请参阅图15,本申请实施例中推荐装置1500的另一个实施例包括:
获取单元1501,用于获取知识图谱、第一标识以及第二标识,知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体,第一标识指示待推荐物品,第二标识指示用户历史记录涉及的物品或者物品属性,知识图谱中包括与第一标识对应的第一实体,以及与第二标识对应的第一实体或第二实体;
运行单元1502,用于基于知识图谱、第一标识以及第二标识运行神经网络,以得到评估结果,评估结果包括待推荐物品被推荐的概率,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到评估结果,第一方向起始于与第一标识对应的第一实体,第二方向起始于与第二标识对应的第一实体或第二实体。
本实施例中,推荐装置中各单元所执行的操作与前述图5、图8和/或图9所示实施例中描述的类似,此处不再赘述。
本实施例中,运行单元1502可以基于知识图谱基于知识图谱、第一标识以及第二标识运 行神经网络,以得到评估结果,其中,神经网络用于基于知识图谱中的至少一个第一方向和至少一个第二方向计算以得到待推荐物品被推荐的概率,该概率可以用于输出对待推荐物品的解释,进而提供了一种具有解释性的推荐方法。
请参阅图16,本申请实施例中推荐装置1600的另一个实施例包括但不限于处理器1601、通信端口1602、存储器1603、总线1604,在本申请的实施例中,处理器1601用于对推荐装置1600的动作进行控制处理。
此外,处理器1601可以是中央处理器单元,通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。该处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
需要说明的是,图16所示推荐装置具体可以用于实现图5、图8和/或图9对应方法实施例中推荐装置所执行的步骤的功能,并实现推荐装置对应的技术效果,图16所示推荐装置的具体实现方式,均可以参考图5、图8和/或图9对应的各个方法实施例中的叙述,此处不再一一赘述。
本申请实施例还提供一种存储一个或多个计算机执行指令的计算机可读存储介质,当计算机执行指令被处理器执行时,该处理器执行如前述实施例中可能的实现方式所述的方法,其中,该推荐装置具体可以执行前述图5、图8和/或图9对应方法实施例中的步骤。
本申请实施例还提供一种存储一个或多个计算机的计算机程序产品,当计算机程序产品被该处理器执行时,该处理器执行上述可能实现方式的方法,其中,该推荐装置具体可以执行前述图5、图8和/或图9对应方法实施例中的步骤。
本申请实施例还提供了一种芯片系统,该芯片系统包括处理器,用于支持推荐装置实现上述推荐装置可能的实现方式中所涉及的功能。在一种可能的设计中,该芯片系统还可以包括存储器,存储器,用于保存该推荐装置必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件,其中,该推荐装置具体可以执行前述图5、图8和/或图9对应方法实施例中的步骤。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个 单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。

Claims (38)

  1. 一种推荐方法,其特征在于,所述方法包括:
    获取知识图谱,所述知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体;
    基于所述知识图谱以及用户的信息运行神经网络,以得到推荐结果,所述用户的信息指示所述用户的历史记录涉及的物品或者物品属性,所述推荐结果包括被推荐物品,所述神经网络用于基于所述知识图谱中的至少一个第一方向和至少一个第二方向计算以得到所述推荐结果,所述第一方向起始于指示所述被推荐物品或者待推荐物品的第一实体,所述第二方向起始于指示所述用户的历史记录涉及的物品的第一实体,或者起始于指示所述用户的历史记录涉及的物品属性的第二实体。
  2. 根据权利要求1所述的方法,其特征在于,所述推荐结果还包括对所述被推荐物品的解释,所述解释与一个第一方向和一个第二方向相关。
  3. 根据权利要求1所述的方法,其特征在于,所述基于所述知识图谱以及用户的信息运行神经网络,以得到推荐结果,包括:
    基于所述知识图谱以及所述用户的信息,在所述知识图谱中提取多条路径,每条所述路径指示所述路径两端的实体之间的关联,每条所述路径的一端对应待推荐物品,另一端对应所述用户的历史记录涉及的物品或物品属性;
    将所述多条路径输入所述神经网络以对多个待推荐物品打分,以使所述神经网络得到所述推荐结果,所述神经网络用于基于所述多条路径各自的第一方向和第二方向计算以得到所述推荐结果,对于一条路径,所述第一方向是所述路径的一端指向所述路径的另一端,所述第二方向是所述路径的另一端指向所述路径的一端。
  4. 根据权利要求1所述的方法,其特征在于,所述基于所述知识图谱以及所述用户信息运行神经网络,以得到推荐结果,包括:
    将所述知识图谱以及所述用户的信息输入所述神经网络;
    所述神经网络基于所述知识图谱以及所述用户的信息,在所述知识图谱中提取多条路径,每条所述路径指示所述路径两端的实体之间的关联,每条所述路径的一端对应待推荐物品,另一端对应所述用户的历史记录涉及的物品或物品属性;
    基于所述多条路径各自的第一方向和第二方向对多个待推荐物品打分,以使所述神经网络得到所述推荐结果,对于一条路径,所述第一方向是所述路径的一端指向所述路径的另一端,所述第二方向是所述路径的另一端指向所述路径的一端。
  5. 根据权利要求4所述的方法,其特征在于,所述第一方向与第一向量的方向一致,所述第二方向与第二向量的方向一致,对于一条路径,所述第一向量为从所述路径中,指示待推荐物品的第一实体,指向所述路径中,与所述指示待推荐物品的第一实体相邻的实体的向量,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品的第一实体,指向所述路径中,与所述指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品属性的第二实体,指向所述路径中,与所述用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;
    所述基于所述多条路径各自的第一方向和第二方向对所述多条路径对应的多个待推荐物 品打分,以使所述神经网络得到所述推荐结果,包括:
    对所述多条路径中的每条路径,都基于所述每条路径的第一向量和第二向量汇集到所述每条路径中的一个实体的概率对所述每条路径对应的待推荐物品打分,以得到所述被推荐物品。
  6. 根据权利要求3至5中任一项所述的方法,其特征在于,所述方法还包括:
    基于所述多条路径各自的第一方向和第二方向分别对所述多条路径打分,以得到对所述推荐结果的解释,所述解释是对得到所述推荐结果的一条或多条路径所指示的两端的实体之间的关联的描述。
  7. 根据权利要求6所述的方法,其特征在于,所述第一方向与第一向量的方向一致,所述第二方向与第二向量的方向一致,对于一条路径,所述第一向量为从所述路径中,指示待推荐物品的第一实体,指向所述路径中,与所述指示待推荐物品的第一实体相邻的实体的向量,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品的第一实体,指向所述路径中,与所述指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品属性的第二实体,指向所述路径中,与所述用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;
    所述基于所述多条路径各自的第一方向和第二方向对所述多条路径打分,以得到对所述推荐结果的解释,包括:
    分别计算每条路径的第一向量和第二向量汇集到所述每条路径包括的一个实体的概率,以得到对所述推荐结果的解释。
  8. 根据权利要求7所述的方法,其特征在于,所述分别计算每条路径的第一向量和第二向量汇集到所述每条路径包括的一个实体的概率,包括:
    Figure PCTCN2021141472-appb-100001
    其中,p m代表所述概率,
    Figure PCTCN2021141472-appb-100002
    代表所述第一向量,
    Figure PCTCN2021141472-appb-100003
    代表所述第二向量,或者,
    Figure PCTCN2021141472-appb-100004
    代表所述第一向量,
    Figure PCTCN2021141472-appb-100005
    代表所述第二向量;exp代表以e为底的指数函数,M为正整数,M代表所述待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量。
  9. 根据权利要求1至8中任一项所述的方法,其特征在于,所述神经网络是通过以训练样本作为所述神经网络的输入,以损失函数的值小于阈值为目标对神经网络进行训练得到,所述训练样本包括多条训练路径,或者所述训练样本包括用于训练的知识图谱、用于训练的用户的历史记录涉及的物品和/或物品属性,每条所述训练路径指示所述训练路径两端的实体之间的关联,每条所述训练路径的两端对应所述用户的历史记录涉及的物品或物品属性;
    所述损失函数包括第一损失函数,所述第一损失函数用于指示神经网络输出的推荐结果与目标结果之间的差异,所述目标结果与所述用户的历史记录涉及的物品或物品属性相关。
  10. 根据权利要求9所述的方法,其特征在于,所述损失函数还包括第二损失函数,所述第二损失函数用于指示所述用于训练的知识图谱的所述训练路径中第一训练向量与第二训练 向量之间词向量的差值,所述训练路径的两端对应所述用户的历史记录涉及的物品或物品属性。
  11. 根据权利要求10所述的方法,其特征在于,所述损失函数还包括第三损失函数,所述第三损失函数用于指示第一实体的计算词向量与所述第一实体的真实词向量的差值,和/或用于指示第二实体的计算词向量与所述第二实体的真实词向量的差值。
  12. 一种推荐方法,其特征在于,所述方法包括:
    获取知识图谱、第一标识以及第二标识,所述知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体,所述第一标识指示待推荐物品,所述第二标识指示用户历史记录涉及的物品或者物品属性,所述知识图谱中包括与所述第一标识对应的第一实体,以及与所述第二标识对应的第一实体或第二实体;
    基于所述知识图谱、所述第一标识以及所述第二标识运行所述神经网络,以得到评估结果,所述评估结果包括待推荐物品被推荐的概率,所述神经网络用于基于所述知识图谱中的至少一个第一方向和至少一个第二方向计算以得到所述评估结果,所述第一方向起始于与所述第一标识对应的第一实体,所述第二方向起始于与所述第二标识对应的第一实体或第二实体。
  13. 根据权利要求12所述的方法,其特征在于,所述评估结果还包括,所述待推荐物品被推荐时,基于的所述知识图谱中的路径对应的概率,所述路径的一端为所述与所述第一标识对应的第一实体,所述路径的另一端为所述与所述第二标识对应的第一实体。
  14. 根据权利要求12所述的方法,其特征在于,所述基于所述知识图谱、所述第一标识以及所述第二标识运行所述神经网络,以得到评估结果,包括:
    基于所述知识图谱、所述第一标识以及所述第二标识在所述知识图谱中提取多条路径,每条所述路径指示所述路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应所述用户的历史记录涉及的物品或物品属性;
    将所述多条路径输入所述神经网络以对多个待推荐物品打分,以使所述神经网络得到所述评估结果,所述神经网络用于基于所述多条路径各自的第一方向和第二方向计算以得到所述概率,对于一条路径,所述第一方向是所述路径的一端指向所述路径的另一端,所述第二方向是所述路径的另一端指向所述路径的一端。
  15. 根据权利要求13所述的方法,其特征在于,所述基于所述知识图谱、所述第一标识以及与所述第二标识运行所述神经网络,以得到评估结果,包括:
    将所述知识图谱、所述第一标识以及所述第二标识输入所述神经网络;
    所述神经网络基于所述知识图谱、所述第一标识以及所述第二标识在所述知识图谱中提取多条路径,每条所述路径指示所述路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应所述用户的历史记录涉及的物品或物品属性;
    基于所述多条路径各自的第一方向和第二方向对所述多条路径对应的多个待推荐物品打分,以使所述神经网络得到所述评估结果,对于一条路径,所述第一方向是所述路径的一端指向所述路径的另一端,所述第二方向是所述路径的另一端指向所述路径的一端。
  16. 根据权利要求15所述的方法,其特征在于,所述第一方向与第一向量的方向一致,所述第二方向与第二向量的方向一致,对于一条路径,所述第一向量为从所述路径中,指示 待推荐物品的第一实体,指向所述路径中,与所述指示待推荐物品的第一实体相邻的实体的向量,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品的第一实体,指向所述路径中,与所述指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品属性的第二实体,指向所述路径中,与所述用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;
    所述基于所述多条路径各自的第一方向和第二方向对所述多条路径对应的多个待推荐物品打分,包括:
    分别计算每条路径的第一向量和第二向量汇集到所述每条路径包括的一个实体的概率。
  17. 根据权利要求16所述的方法,其特征在于,所述分别计算每条路径的第一向量和第二向量汇集到所述每条路径包括的一个实体的概率,包括:
    Figure PCTCN2021141472-appb-100006
    其中,p m代表所述概率,
    Figure PCTCN2021141472-appb-100007
    代表所述第一向量,
    Figure PCTCN2021141472-appb-100008
    代表所述第二向量,或者,
    Figure PCTCN2021141472-appb-100009
    代表所述第一向量,
    Figure PCTCN2021141472-appb-100010
    代表所述第二向量;exp代表以e为底的指数函数,M为正整数,M代表所述待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量。
  18. 根据权利要求12至17中任一项所述的方法,其特征在于,所述神经网络是通过以训练样本作为所述神经网络的输入,以损失函数的值小于阈值为目标对神经网络进行训练得到,所述训练样本包括多条训练路径,或者所述训练样本包括用于训练的知识图谱、第一训练标识以及第二训练标识,所述第一训练标识指示的物品与所述第二训练标识指示的物品或物品属性为用户的历史物品涉及的物品或物品属性;
    所述损失函数包括第一损失函数,所述第一损失函数用于指示神经网络输出的评估结果与目标结果之间的差异,所述目标结果与所述用户的历史记录涉及的物品或物品属性相关。
  19. 根据权利要求18所述的方法,其特征在于,所述损失函数还包括第二损失函数,所述第二损失函数用于指示所述用于训练的知识图谱的所述训练路径中第一训练向量与第二训练向量之间词向量的差值,所述训练路径的两端对应所述用户的历史记录涉及的物品或物品属性。
  20. 根据权利要求19所述的方法,其特征在于,所述损失函数还包括第三损失函数,所述第三损失函数用于指示第一实体的计算词向量与所述第一实体的真实词向量的差值,和/或用于指示第二实体的计算词向量与所述第二实体的真实词向量的差值。
  21. 一种推荐装置,其特征在于,所述推荐装置包括:
    获取单元,用于获取知识图谱,所述知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体;
    运行单元,用于基于所述知识图谱以及用户的信息运行神经网络,以得到推荐结果,所述用户的信息指示所述用户的历史记录涉及的物品或者物品属性,所述推荐结果包括被推荐物品,所述神经网络用于基于所述知识图谱中的至少一个第一方向和至少一个第二方向计算 以得到所述推荐结果,所述第一方向起始于指示所述被推荐物品或者待推荐物品的第一实体,所述第二方向起始于指示所述用户的历史记录涉及的物品的第一实体,或者起始于指示所述用户的历史记录涉及的物品属性的第二实体。
  22. 根据权利要求21所述的推荐装置,其特征在于,所述推荐结果还包括对所述被推荐物品的解释,所述解释与一个第一方向和一个第二方向相关。
  23. 根据权利要求21所述的推荐装置,其特征在于,
    所述运行单元,具体用于基于所述知识图谱以及所述用户的信息,在所述知识图谱中提取多条路径,每条所述路径指示所述路径两端的实体之间的关联,每条所述路径的一端对应待推荐物品,另一端对应所述用户的历史记录涉及的物品或物品属性;
    所述运行单元,具体用于将所述多条路径输入所述神经网络以对多个待推荐物品打分,以使所述神经网络得到所述推荐结果,所述神经网络用于基于所述多条路径各自的第一方向和第二方向计算以得到所述推荐结果,对于一条路径,所述第一方向是所述路径的一端指向所述路径的另一端,所述第二方向是所述路径的另一端指向所述路径的一端。
  24. 根据权利要求21所述的推荐装置,其特征在于,
    所述运行单元,具体用于将所述知识图谱以及所述用户的信息输入所述神经网络;
    所述运行单元,具体用于所述神经网络基于所述知识图谱以及所述用户的信息,在所述知识图谱中提取多条路径,每条所述路径指示所述路径两端的实体之间的关联,每条所述路径的一端对应待推荐物品,另一端对应所述用户的历史记录涉及的物品或物品属性;
    所述运行单元,具体用于基于所述多条路径各自的第一方向和第二方向对多个待推荐物品打分,以使所述神经网络得到所述推荐结果,对于一条路径,所述第一方向是所述路径的一端指向所述路径的另一端,所述第二方向是所述路径的另一端指向所述路径的一端。
  25. 根据权利要求24所述的推荐装置,其特征在于,所述第一方向与第一向量的方向一致,所述第二方向与第二向量的方向一致,对于一条路径,所述第一向量为从所述路径中,指示待推荐物品的第一实体,指向所述路径中,与所述指示待推荐物品的第一实体相邻的实体的向量,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品的第一实体,指向所述路径中,与所述指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品属性的第二实体,指向所述路径中,与所述用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;
    所述运行单元,具体用于对所述多条路径中的每条路径,都基于所述每条路径的第一向量和第二向量汇集到所述每条路径中的一个实体的概率对所述每条路径对应的待推荐物品打分,以得到所述被推荐物品。
  26. 根据权利要求23至25中任一项所述的推荐装置,其特征在于,
    所述运行单元,还用于基于所述多条路径各自的第一方向和第二方向分别对所述多条路径打分,以得到对所述推荐结果的解释,所述解释是对得到所述推荐结果的一条或多条路径所指示的两端的实体之间的关联的描述。
  27. 根据权利要求26所述的推荐装置,其特征在于,所述第一方向与第一向量的方向一致,所述第二方向与第二向量的方向一致,对于一条路径,所述第一向量为从所述路径中,指示待推荐物品的第一实体,指向所述路径中,与所述指示待推荐物品的第一实体相邻的实 体的向量,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品的第一实体,指向所述路径中,与所述指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品属性的第二实体,指向所述路径中,与所述用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;
    所述运行单元,具体用于分别计算每条路径的第一向量和第二向量汇集到所述每条路径包括的一个实体的概率,以得到对所述推荐结果的解释。
  28. 根据权利要求27所述的推荐装置,其特征在于,
    所述运行单元,具体用于通过如下公式分别计算每条路径的第一向量和第二向量汇集到所述每条路径包括的一个实体的概率:
    Figure PCTCN2021141472-appb-100011
    其中,p m代表所述概率,
    Figure PCTCN2021141472-appb-100012
    代表所述第一向量,
    Figure PCTCN2021141472-appb-100013
    代表所述第二向量,或者,
    Figure PCTCN2021141472-appb-100014
    代表所述第一向量,
    Figure PCTCN2021141472-appb-100015
    代表所述第二向量;exp代表以e为底的指数函数,M为正整数,M代表所述待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量。
  29. 一种推荐装置,其特征在于,所述推荐装置包括:
    获取单元,用于获取知识图谱、第一标识以及第二标识,所述知识图谱中包括多个用于指示物品的第一实体和多个用于指示物品属性的第二实体,所述第一标识指示待推荐物品,所述第二标识指示用户历史记录涉及的物品或者物品属性,所述知识图谱中包括与所述第一标识对应的第一实体,以及与所述第二标识对应的第一实体或第二实体;
    运行单元,用于基于所述知识图谱、所述第一标识以及所述第二标识运行所述神经网络,以得到评估结果,所述评估结果包括待推荐物品被推荐的概率,所述神经网络用于基于所述知识图谱中的至少一个第一方向和至少一个第二方向计算以得到所述评估结果,所述第一方向起始于与所述第一标识对应的第一实体,所述第二方向起始于与所述第二标识对应的第一实体或第二实体。
  30. 根据权利要求29所述的推荐装置,其特征在于,所述评估结果还包括,所述待推荐物品被推荐时,基于的所述知识图谱中的路径对应的概率,所述路径的一端为所述与所述第一标识对应的第一实体,所述路径的另一端为所述与所述第二标识对应的第一实体。
  31. 根据权利要求29所述的推荐装置,其特征在于,
    所述运行单元,具体用于基于所述知识图谱、所述第一标识以及所述第二标识在所述知识图谱中提取多条路径,每条所述路径指示所述路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应所述用户的历史记录涉及的物品或物品属性;
    所述运行单元,具体用于将所述多条路径输入所述神经网络以对多个待推荐物品打分,以使所述神经网络得到所述评估结果,所述神经网络用于基于所述多条路径各自的第一方向和第二方向计算以得到所述概率,对于一条路径,所述第一方向是所述路径的一端指向所述路径的另一端,所述第二方向是所述路径的另一端指向所述路径的一端。
  32. 根据权利要求30所述的推荐装置,其特征在于,
    所述运行单元,具体用于将所述知识图谱、所述第一标识以及所述第二标识输入所述神经网络;
    所述运行单元,具体用于所述神经网络基于所述知识图谱、所述第一标识以及所述第二标识在所述知识图谱中提取多条路径,每条所述路径指示所述路径两端的实体之间的关联,每条路径的一端对应待推荐物品,另一端对应所述用户的历史记录涉及的物品或物品属性;
    所述运行单元,具体用于基于所述多条路径各自的第一方向和第二方向对所述多条路径对应的多个待推荐物品打分,以使所述神经网络得到所述评估结果,对于一条路径,所述第一方向是所述路径的一端指向所述路径的另一端,所述第二方向是所述路径的另一端指向所述路径的一端。
  33. 根据权利要求32所述的推荐装置,其特征在于,所述第一方向与第一向量的方向一致,所述第二方向与第二向量的方向一致,对于一条路径,所述第一向量为从所述路径中,指示待推荐物品的第一实体,指向所述路径中,与所述指示待推荐物品的第一实体相邻的实体的向量,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品的第一实体,指向所述路径中,与所述指示用户的历史记录涉及的物品的第一实体相邻的实体的向量,或者,所述第二向量为从所述路径中,所述用户的历史记录涉及的物品属性的第二实体,指向所述路径中,与所述用户的历史记录涉及的物品属性的第二实体相邻的实体的向量;
    所述运行单元,具体用于分别计算每条路径的第一向量和第二向量汇集到所述每条路径包括的一个实体的概率。
  34. 根据权利要求33所述的推荐装置,其特征在于,
    所述运行单元,具体用于通过下述公式分别计算每条路径的第一向量和第二向量汇集到所述每条路径包括的一个实体的概率:
    Figure PCTCN2021141472-appb-100016
    其中,p m代表所述概率,
    Figure PCTCN2021141472-appb-100017
    代表所述第一向量,
    Figure PCTCN2021141472-appb-100018
    代表所述第二向量,或者,
    Figure PCTCN2021141472-appb-100019
    代表所述第一向量,
    Figure PCTCN2021141472-appb-100020
    代表所述第二向量;exp代表以e为底的指数函数,M为正整数,M代表所述待推荐物品与一个用户的历史记录涉及的物品或物品属性之间路径的数量。
  35. 一种推荐装置,其特征在于,包括处理器,所述处理器与存储器耦合,所述存储器用于存储计算机程序或指令,所述处理器用于执行存储器中的所述计算机程序或指令,使得权利要求1至11任一项所述的方法被执行,或者使得权利要求12至20任一项所述的方法被执行。
  36. 一种芯片,其特征在于,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行计算机程序或指令,使得权利要求1至11任一项所述的方法被执行,或者使得权利要求12至20任一项所述的方法被执行。
  37. 一种计算机存储介质,其特征在于,所述计算机存储介质中存储有指令,所述指令在 计算机上执行时,使得所述计算机执行如权利要求1至11中任一项所述的方法,或者使得所述计算机执行如权利要求12至20中任一项所述的方法。
  38. 一种计算机程序产品,其特征在于,所述计算机程序产品在计算机上执行时,使得所述计算机执行如权利要求1至11中任一项所述的方法,或者使得所述计算机执行如权利要求12至20中任一项所述的方法。
PCT/CN2021/141472 2020-12-31 2021-12-27 一种推荐方法、推荐网络及相关设备 WO2022143482A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP21914219.7A EP4258132A4 (en) 2020-12-31 2021-12-27 RECOMMENDATION METHOD, RECOMMENDATION NETWORK AND ASSOCIATED DEVICE
US18/215,959 US20230342833A1 (en) 2020-12-31 2023-06-29 Recommendation method, recommendation network, and related device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011640574.7A CN114691973A (zh) 2020-12-31 2020-12-31 一种推荐方法、推荐网络及相关设备
CN202011640574.7 2020-12-31

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/215,959 Continuation US20230342833A1 (en) 2020-12-31 2023-06-29 Recommendation method, recommendation network, and related device

Publications (1)

Publication Number Publication Date
WO2022143482A1 true WO2022143482A1 (zh) 2022-07-07

Family

ID=82135663

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/141472 WO2022143482A1 (zh) 2020-12-31 2021-12-27 一种推荐方法、推荐网络及相关设备

Country Status (4)

Country Link
US (1) US20230342833A1 (zh)
EP (1) EP4258132A4 (zh)
CN (1) CN114691973A (zh)
WO (1) WO2022143482A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115063209A (zh) * 2022-07-12 2022-09-16 武汉沁纯服饰有限公司 一种基于多维特征分析的服装电商平台商品推荐系统
CN116645244A (zh) * 2023-05-29 2023-08-25 深圳博时特科技有限公司 一种基于计算机视觉的就餐导引系统及导引方法

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116108267A (zh) * 2022-12-19 2023-05-12 华为技术有限公司 一种推荐方法及相关设备
CN116610820B (zh) * 2023-07-21 2023-10-20 智慧眼科技股份有限公司 一种知识图谱实体对齐方法、装置、设备及存储介质
CN117290611B (zh) * 2023-11-24 2024-02-23 北京信立方科技发展股份有限公司 基于多层次知识图谱的仪器推荐方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110909174A (zh) * 2019-11-19 2020-03-24 南京航空航天大学 一种基于知识图谱的简单问答中实体链接的改进方法
US20200110746A1 (en) * 2018-10-05 2020-04-09 Accenture Global Solutions Limited Density-based computation for information discovery in knowledge graphs
CN112131472A (zh) * 2020-09-24 2020-12-25 腾讯科技(深圳)有限公司 信息推荐方法、装置、电子设备和存储介质
CN112148885A (zh) * 2020-09-04 2020-12-29 上海晏鼠计算机技术股份有限公司 一种基于知识图谱的智能搜索方法及系统

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11042922B2 (en) * 2018-01-03 2021-06-22 Nec Corporation Method and system for multimodal recommendations

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200110746A1 (en) * 2018-10-05 2020-04-09 Accenture Global Solutions Limited Density-based computation for information discovery in knowledge graphs
CN110909174A (zh) * 2019-11-19 2020-03-24 南京航空航天大学 一种基于知识图谱的简单问答中实体链接的改进方法
CN112148885A (zh) * 2020-09-04 2020-12-29 上海晏鼠计算机技术股份有限公司 一种基于知识图谱的智能搜索方法及系统
CN112131472A (zh) * 2020-09-24 2020-12-25 腾讯科技(深圳)有限公司 信息推荐方法、装置、电子设备和存储介质

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4258132A4

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115063209A (zh) * 2022-07-12 2022-09-16 武汉沁纯服饰有限公司 一种基于多维特征分析的服装电商平台商品推荐系统
CN116645244A (zh) * 2023-05-29 2023-08-25 深圳博时特科技有限公司 一种基于计算机视觉的就餐导引系统及导引方法

Also Published As

Publication number Publication date
EP4258132A1 (en) 2023-10-11
EP4258132A4 (en) 2024-06-12
CN114691973A (zh) 2022-07-01
US20230342833A1 (en) 2023-10-26

Similar Documents

Publication Publication Date Title
WO2022143482A1 (zh) 一种推荐方法、推荐网络及相关设备
WO2022041979A1 (zh) 一种信息推荐模型的训练方法和相关装置
CN111602147B (zh) 基于非局部神经网络的机器学习模型
US11544550B2 (en) Analyzing spatially-sparse data based on submanifold sparse convolutional neural networks
WO2021047593A1 (zh) 推荐模型的训练方法、预测选择概率的方法及装置
WO2021233199A1 (zh) 搜索推荐模型的训练方法、搜索结果排序的方法及装置
WO2020094060A1 (zh) 推荐方法及装置
US20190188285A1 (en) Image Search with Embedding-based Models on Online Social Networks
WO2023065859A1 (zh) 物品推荐方法、装置及存储介质
WO2022016556A1 (zh) 一种神经网络蒸馏方法以及装置
KR20180099812A (ko) 딥러닝 모델을 사용한 엔티티의 식별
WO2024131762A1 (zh) 一种推荐方法及相关设备
WO2023185925A1 (zh) 一种数据处理方法及相关装置
Yan et al. A unified video recommendation by cross-network user modeling
CN111091010A (zh) 相似度确定、网络训练、查找方法及装置和存储介质
WO2024041483A1 (zh) 一种推荐方法及相关装置
WO2024002167A1 (zh) 一种操作预测方法及相关装置
WO2023165361A1 (zh) 一种数据处理方法及相关设备
Cheung et al. Characterizing user connections in social media through user-shared images
US10387934B1 (en) Method medium and system for category prediction for a changed shopping mission
Solainayagi et al. Trustworthy media news content retrieval from web using truth content discovery algorithm
WO2023246735A1 (zh) 一种项目推荐方法及其相关设备
Zhou et al. PEA-YOLO: a lightweight network for static gesture recognition combining multiscale and attention mechanisms
WO2023137050A1 (en) Systems and methods for generating a personality profile based on user data from different sources
Liu POI recommendation model using multi-head attention in location-based social network big data

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21914219

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021914219

Country of ref document: EP

Effective date: 20230707

NENP Non-entry into the national phase

Ref country code: DE