Resource recall method, computer device, and storage medium
By acquiring seed resources of target users' interaction behaviors and their topic information, and using heterogeneous graphs to find similar resources and related topics, a resource recall model is constructed. This solves the problem of inaccurate recall when there are few target user interaction behaviors, and achieves higher resource recall accuracy and user interactivity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAOHONGSHU TECH CO LTD
- Filing Date
- 2023-02-25
- Publication Date
- 2026-07-24
AI Technical Summary
Existing technologies struggle to accurately calculate the match between users and resources when there is limited interaction with the target user, resulting in poor resource retrieval performance.
By acquiring seed resources of the target object's interaction behavior and its topic information within a preset time period, and using heterogeneous graphs to find the first resource with similarity higher than a threshold and the second resource associated with the topic information, a resource retrieval model is constructed to improve the accuracy of resource retrieval.
When the target audience has limited interaction, accurately identifying resources of interest based on their topics of interest can improve the accuracy and richness of resource retrieval, thereby increasing user interaction and engagement on the content publishing platform.
Smart Images

Figure CN117743674B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer application technology, and in particular to resource retrieval methods, computer equipment, and storage media. Background Technology
[0002] With the rapid development of computing technology, recommending resources to users in various social applications and search scenarios (such as resource recall) has become a major research hotspot. Currently, resource recall targeting specific users typically involves calculating the matching degree between the target user and the resource based on the target user's interaction behavior to determine the resources to recall. However, the inventors have found in practice that resource recall targeting users with limited interaction behavior is usually ineffective. If the target user's interaction behavior is minimal, it is difficult to accurately calculate the matching degree between the target user and the resource based on their interaction behavior, resulting in significant errors. Therefore, improving the accuracy of resource recall is a problem that urgently needs to be solved. Summary of the Invention
[0003] This application provides a resource retrieval method, computer device, and storage medium, which can accurately find resources of interest to an object based on a topic of interest to that object, thereby improving the accuracy of resource retrieval.
[0004] On the one hand, embodiments of this application provide a resource recall method, the method comprising:
[0005] Obtain seed resources of interactive behaviors generated by the target object within a preset time period, as well as topic information of the seed resources;
[0006] Based on the seed resource and the heterogeneous graph, a first resource with a similarity higher than a similarity threshold is found; wherein, the heterogeneous graph includes multiple nodes, the multiple nodes include topic nodes and resource nodes, and the weight of the edge between every two nodes is used to indicate the degree of association between every two nodes;
[0007] Based on the topic information and the heterogeneous graph, find the second resource associated with the topic information;
[0008] The first resource and the second resource are used as recall resources for the target object.
[0009] In one embodiment, finding a first resource with a similarity higher than a similarity threshold to the seed resource based on the seed resource and the heterogeneous graph includes:
[0010] In the heterogeneous graph, a target resource node is determined to indicate the seed resource;
[0011] Based on at least one first candidate node that has a connection with the target resource node, and the weight of the edge between each pair of nodes in the target resource node and the at least one first candidate node, the distance between the target resource node and each first candidate node is obtained.
[0012] Find a first candidate node whose distance to the target resource node is less than a distance threshold, and use the resource indicated by the found first candidate node as the first resource.
[0013] In one embodiment, the step of finding a second resource associated with the topic information based on the topic information and the heterogeneous graph includes:
[0014] In the heterogeneous graph, a target topic node is determined to indicate the topic information;
[0015] Based on at least one second candidate node that has a connection with the target topic node, and the weight of the edge between each pair of nodes in the target topic node and the at least one second candidate node, the distance between the target topic node and each second candidate node is obtained.
[0016] Find a second candidate node whose distance to the target topic node is less than a distance threshold, and use the resource indicated by the found second candidate node as the second resource.
[0017] In one embodiment, the first resource and the second resource are found by invoking a resource retrieval model, and the method further includes:
[0018] Obtain training samples, which include topic information of multiple interacted resources that have interactive behavior within a historical time period, and at least one set of training resource pairs; wherein each set of training resource pairs includes two training resources, one of which is a similar training resource to the other.
[0019] The initial resource retrieval model is invoked, and based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph, the distance between each training resource and any training resource other than the training resources included in the at least one set of training resource pairs is obtained; wherein, the initial heterogeneous graph is constructed based on the training resources in the at least one set of training resource pairs and the topic information of each interacted resource.
[0020] The initial resource retrieval model is trained with the training objective of reducing the distance between two neighboring nodes in the initial heterogeneous graph and increasing the distance between two non-neighboring nodes in the initial heterogeneous graph, and the resource retrieval model is obtained.
[0021] In one embodiment, the initial heterogeneous graph is constructed in the following manner:
[0022] Determine resource nodes for indicating each training resource in the training sample, and topic nodes for indicating each topic information in the training sample;
[0023] Traverse any two nodes among the determined resource nodes and the determined topic nodes. If the two nodes currently traversed include one topic node and one resource node, determine the weight of the edge between the currently traversed resource node and the currently traversed topic node based on the number of training resource topic information indicated by the currently traversed resource node in the topic information of the multiple interacted resources.
[0024] When the two nodes being traversed include two topic nodes, the weight of the edge between the two topic nodes being traversed is determined based on the number of training resources corresponding to the topic information indicated by each of the currently traversed topic nodes in the training resources contained in the training sample, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes.
[0025] When the two nodes being traversed include two resource nodes, the weights of the edges between the two resource nodes being traversed are determined based on whether the training resources indicated by the two resource nodes being traversed are training resources in the same training resource pair.
[0026] After the traversal is completed, the initial heterogeneous graph is constructed based on the determined resource nodes, the determined topic nodes, the weights of the edges between each resource node and topic node, and the weights of the edges between each topic node.
[0027] In one embodiment, determining the weight of the edge between the two currently traversed topic nodes based on the number of training resources corresponding to the topic information indicated by each currently traversed topic node in the training resources included in the training samples, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes, includes:
[0028] Compare the number of training resources corresponding to the topic information indicated by the two topic nodes currently being traversed, and determine the number with the smaller value;
[0029] The ratio between the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes and the determined number is used as the weight of the edge between the two currently traversed topic nodes.
[0030] In one embodiment, determining resource nodes for indicating each training resource in the training sample, and topic nodes for indicating each topic information in the training sample, includes:
[0031] Long-tail topics in the topic information contained in the training samples are filtered to obtain filtered topic information, and topic nodes for indicating each filtered topic information are determined; wherein, the long-tail topics refer to: topic information in the training resources contained in the training samples where the number of corresponding training resources is less than a first quantity threshold.
[0032] The long-tail resources in the training resources contained in the training sample are filtered to obtain filtered training resources, and resource nodes for indicating each filtered training resource are determined; wherein, the long-tail resources refer to training resources whose number of connections with other training resources in the training resources contained in the training sample is less than a second quantity threshold.
[0033] In one embodiment, the invocation of the initial resource retrieval model, based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph, to obtain the distance between each training resource and any training resource other than the individual training resources included in the at least one set of training resource pairs, includes:
[0034] Based on the edge weights of each resource node and topic node in the initial heterogeneous graph, and the edge weights of each topic node and topic node, the nodes in the initial heterogeneous graph are sampled to obtain multiple node triples; wherein each node triple includes three nodes.
[0035] For any node triple, obtain the distance between every two nodes in the triple; wherein every two nodes are either neighboring nodes or non-neighboring nodes, and the determination of whether every two nodes are neighboring nodes or non-neighboring nodes is based on the connection relationship between every two nodes in the initial heterogeneous graph.
[0036] On the other hand, embodiments of this application provide a resource recall device, which includes:
[0037] The acquisition unit is used to acquire seed resources of interactive behaviors generated by the target object within a preset time period, as well as topic information of the seed resources;
[0038] The first search unit is used to search for a first resource with a similarity higher than a similarity threshold to the seed resource based on the seed resource and the heterogeneous graph; wherein, the heterogeneous graph includes multiple nodes, the multiple nodes include topic nodes and resource nodes, and the weight of the edge between every two nodes is used to indicate the degree of association between every two nodes;
[0039] The second search unit is used to search for a second resource associated with the topic information based on the topic information and the heterogeneous graph;
[0040] A determining unit is configured to use the first resource and the second resource as recall resources for the target object.
[0041] On the other hand, embodiments of this application provide a computer device including a processor, a storage device, and a communication interface, wherein the processor, storage device, and communication interface are interconnected, wherein the storage device is used to store a computer program that supports the computer device in executing the above-described method, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the following steps:
[0042] Obtain seed resources of interactive behaviors generated by the target object within a preset time period, as well as topic information of the seed resources;
[0043] Based on the seed resource and the heterogeneous graph, a first resource with a similarity higher than a similarity threshold is found; wherein, the heterogeneous graph includes multiple nodes, the multiple nodes include topic nodes and resource nodes, and the weight of the edge between every two nodes is used to indicate the degree of association between every two nodes;
[0044] Based on the topic information and the heterogeneous graph, find the second resource associated with the topic information;
[0045] The first resource and the second resource are used as recall resources for the target object.
[0046] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a processor, cause the processor to perform the above-described resource recall method.
[0047] On the other hand, embodiments of this application provide a computer program product, which includes a computer program adapted to be loaded by a processor and executed by the above-described resource recall method.
[0048] In this embodiment, since topics are a common feature of community-based products, they allow content creators to more directly express their content themes. Furthermore, for consumers, topics help them more easily find content on topics of interest. Based on this, seed resources that generate interactive behavior from the target object within a preset time period, along with the topic information of these seed resources, are obtained. Then, based on the seed resources and a heterogeneous graph, a first resource with a similarity higher than a similarity threshold is found. The heterogeneous graph includes multiple nodes, including topic nodes and resource nodes. The weight of the edge between each pair of nodes indicates the degree of association between them. Based on the topic information and the heterogeneous graph, a second resource associated with the topic information is found. The first and second resources are then used as recall resources for the target object. This allows mapping topic information and resources to a unified semantic space, thereby learning the relationship between topic information and resources. Based on topics of interest to the target object, resources of interest to that object can be accurately found, improving the richness of the resources recalled for that object. In addition, when there are few interactive behaviors of the target object, it is relatively difficult to accurately identify the recall resources of the object based on the limited number of interactive behaviors. The embodiments of this application can accurately find the resources that the object is interested in based on the topics that the object is interested in, which can improve the accuracy of resource recall. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 This is a flowchart illustrating a resource retrieval method provided in an embodiment of this application;
[0051] Figure 2 This is a flowchart illustrating another resource retrieval method provided in an embodiment of this application;
[0052] Figure 3a This is a schematic diagram of a heterogeneous diagram provided in an embodiment of this application;
[0053] Figure 3b This is a schematic diagram of another heterogeneous diagram provided in an embodiment of this application;
[0054] Figure 4 This is a schematic diagram of the structure of a resource recall device provided in an embodiment of this application;
[0055] Figure 5This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0056] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0057] In the entire recommendation system architecture, recall is the most fundamental module. Its significance lies in narrowing the computational scope of the candidate set, responsible for selecting the set of resources that the user might be interested in from a massive candidate set. The closer the recalled resources are to the user's interests, the higher the overall accuracy of the recommendation system. However, in the short period of time after a user registers, the amount of user interaction behavior that can be collected is limited, or the user's interaction with the content publishing platform is also limited. This results in a lack of collected user interaction behavior, making it impossible to accurately calculate the resources that the user might be interested in based on a small amount of interaction. In other words, existing recall methods cannot ensure the accuracy of resource recall in scenarios with limited user interaction behavior.
[0058] The inventors discovered through research that topics are a common feature of community-based products. For content creators, topics allow for a more direct expression of their content themes. Furthermore, for consumers, topics help them more easily find content on topics of interest. Based on this, this application provides a resource retrieval method that maps topic information and resources to a unified semantic space, thereby learning the relationship between topic information and resources. Based on topics of interest to a target audience, it accurately identifies resources of interest to that audience, improving the accuracy of resource retrieval and thus increasing user interaction and engagement on the content publishing platform.
[0059] The target audience refers to users, specifically at least one user or at least one type of user.
[0060] Resources refer to resources published by content publishing platforms, such as electronic or physical resources. Resources can include advertisements, videos, audio, text, images, or products. For example, resources can specifically include notes or short videos.
[0061] In specific embodiments of this application, data related to objects is involved, such as seed resources for the target object to generate interactive behaviors within a preset time period. When the embodiments of this application are applied to specific products or technologies, permission or consent from the object is required, and the collection, use and processing of related data must comply with local laws, regulations and standards.
[0062] The resource retrieval method provided in this application embodiment can be applied to a resource retrieval device. The resource retrieval device can be installed or integrated into a content publishing platform. The content publishing platform can run on a computer device. The computer device can include terminal devices or servers, etc. The computer device includes, but is not limited to, smartphones, in-vehicle devices, wearable devices, or computers.
[0063] Please see Figure 1 , Figure 1 This is a flowchart illustrating a resource retrieval method provided in an embodiment of this application. This resource retrieval method can be executed by a resource retrieval device or a computer device; such as... Figure 1 The resource retrieval scheme shown includes, but is not limited to, steps S101 to S104, wherein:
[0064] S101, Obtain seed resources for interactive behaviors generated by the target object within a preset time period, as well as topic information of the seed resources.
[0065] Seed resources refer to resources that the target audience will interact with within a preset time period. There can be one or more seed resources. The preset time period refers to a time frame consisting of points in time when the current system time is less than a preset duration. For example, the preset time period could be the most recent month, the most recent week, or the most recent hour. Interactive behavior refers to the actions taken by the target audience to interact with the seed resource, such as liking, sharing, commenting, or saving. The topic information of the seed resource can be used to describe its content theme. For example, if the seed resource is a note sharing a set of pediatric massage techniques for strengthening the lungs when dealing with large temperature differences between day and night in autumn and children's coughs and diarrhea, then the topic information for the seed resource could be "pediatric massage."
[0066] For example, in the process of resource recall for a target object, seed resources in which the target object has interacted within a preset time period can be obtained first. The interaction between the target object and the seed resources indicates that the seed resources are highly likely to be of interest to the target object. Therefore, based on the seed resources and the heterogeneous graph, a first resource with a similarity higher than a similarity threshold can be found. Since the topic of the seed resources is highly likely to be of interest to the target object, topic information of the seed resources can also be obtained. Based on the topic information and the heterogeneous graph, a second resource associated with the topic information can be found. Then, the first and second resources are used as recall resources for the target object. In other words, if the target object is interested in the seed resources, then the target object is highly likely to be interested in the topic of the seed resources. Therefore, this embodiment can find resources similar to the seed resources and resources corresponding to topics similar to the seed resources. These found resources are highly likely to be of interest to the target object. Therefore, using these found resources as recall resources for the target object can improve the accuracy of resource recall.
[0067] Optionally, if no topic information exists for the seed resource, it can be obtained based on the seed resource's description information. The description information includes one or more of the following: brand, keywords, category, or tags. For example, the seed resource's description information can be used as its topic information, or keywords can be extracted from the seed resource's description information to obtain its topic information.
[0068] S102, based on seed resources and heterogeneous graphs, find the first resource with a similarity higher than the similarity threshold with the seed resources.
[0069] The heterogeneous graph consists of multiple nodes, including topic nodes and resource nodes. The weight of the edge between any two nodes indicates the degree of correlation between them. In other words, the heterogeneous graph can be used to represent the relationships between resources, between resources and topics, and between topics themselves. By analyzing the relationships between resources represented by the heterogeneous graph, resources similar to the seed resource (i.e., the first resource) can be found. Similarly, by analyzing the relationships between topics and between resources represented by the heterogeneous graph, resources corresponding to topics similar to the seed resource (i.e., the second resource) can be found.
[0070] In one implementation, a target resource node for indicating seed resources can be determined in the heterogeneous graph. Based on at least one first candidate node that has a connection relationship with the target resource node, and the weight of the edge between each pair of nodes in the target resource node and at least one first candidate node, the distance between the target resource node and each first candidate node is obtained. First candidate nodes whose distance to the target resource node is less than a distance threshold are found, and the resources indicated by the found first candidate nodes are taken as the first resources.
[0071] In one example, assuming the seed resource includes resource 1, and the target resource node in the heterogeneous graph used to indicate resource 1 is resource node 1, and resource node 1 is connected to resource node 2 and resource node 3 in the heterogeneous graph, then at least one first candidate node connected to resource node 1 can be determined to include resource node 2 and resource node 3. Furthermore, the distance between resource node 1 and resource node 2 can be obtained based on the weights of the edges between them in the heterogeneous graph. The distance between two nodes is negatively correlated with the weights of the edges between them; specifically, the larger the weights of the edges between resource node 1 and resource node 2, the smaller the distance between them, meaning the resource indicated by resource node 1 is more similar to the resource indicated by resource node 2. Similarly, the distance between resource node 1 and resource node 3 can be obtained based on the weights of the edges between them. If the distance between a resource node and resource node 1 is less than a distance threshold, it can be understood that the similarity between the resource indicated by that resource node and the resource indicated by resource node 1 is higher than the similarity threshold, and therefore the resource indicated by that resource node can be considered the first resource. The distance threshold is a pre-set distance limit, which can be set by researchers based on experience or obtained through neural network learning, and is not limited to the specific implementation of this application.
[0072] Optionally, if the distance between a resource node and resource node 1 is less than a distance threshold, not only can the resource indicated by the resource node be used as the first resource, but the next-hop node of the resource node (i.e., the node that is connected to the resource node) can also be obtained. If the next-hop node is a resource node, the distance between the resource node and the next-hop node can be obtained based on the weight of the edge between the resource node and the next-hop node. If the distance between the resource node and the next-hop node is less than the distance threshold, it can be determined that the distance between resource node 1 and the next-hop node is less than the distance threshold. This can be understood as the similarity between the resource indicated by the next-hop node and the resource indicated by resource node 1 being higher than the similarity threshold. Therefore, the resource indicated by the next-hop node can be used as the first resource.
[0073] Optionally, if the next-hop node is a topic node (e.g., topic node 3), the distance between the resource node and topic node 3 can be obtained based on the weight of the edge between the resource node and topic node 3. If the distance between the resource node and topic node 3 is less than a distance threshold, it can be determined that the resource indicated by the resource node and the topic indicated by topic node 3 are strongly related. Further, the next-hop node of topic node 3 can be obtained. If the next-hop node of topic node 3 is a resource node, the distance between topic node 3 and the next-hop node can be obtained based on the weight of the edge between topic node 3 and the next-hop node. If the distance between topic node 3 and the next-hop node is less than a distance threshold, it can be determined that the distance between resource node 1 and the next-hop node is less than the distance threshold. This can be understood as the resource indicated by the next-hop node having a similarity higher than the similarity threshold with the resource indicated by resource node 1. Therefore, the resource indicated by the next-hop node can be used as the first resource.
[0074] In another example, assuming the seed resource includes resource 1, and the target resource node in the heterogeneous graph indicating resource 1 is resource node 1, and resource node 1 is connected to topic node 1 and topic node 2 in the heterogeneous graph, then at least one first candidate node connected to resource node 1 can be determined to include topic node 1 and topic node 2. Furthermore, the distance between resource node 1 and topic node 1 can be obtained based on the weights of the edges between them in the heterogeneous graph. The distance between two nodes is negatively correlated with the weights of the edges between them; specifically, the larger the weight of the edge between resource node 1 and topic node 1, the smaller the distance between them, meaning the more relevant the resource indicated by resource node 1 and the topic indicated by topic node 1 are. Similarly, the distance between resource node 1 and topic node 2 can be obtained based on the weights of the edges between them in the heterogeneous graph.
[0075] If the distance between a topic node and resource node 1 is less than a distance threshold, it indicates that the topic indicated by the topic node is strongly related to the resource indicated by resource node 1. Then, the next-hop node of the topic node can be obtained. If the next-hop node is a resource node, the distance between the topic node and the next-hop node can be obtained based on the weight of the edge between the topic node and the next-hop node. If the distance between the topic node and the next-hop node is less than a distance threshold, it can be determined that the distance between resource node 1 and the next-hop node is less than the distance threshold. This can be understood as the similarity between the resource indicated by the next-hop node and the resource indicated by resource node 1 being higher than the similarity threshold. Therefore, the resource indicated by the next-hop node can be regarded as the first resource.
[0076] Optionally, if the topic indicated by topic node 1 is strongly related to the resource indicated by resource node 1, and the next-hop node of topic node 1 is a topic node (e.g., topic node 4), then the distance between topic node 1 and topic node 4 can be obtained based on the weights of the edges between them. If the distance between topic node 1 and topic node 4 is less than a distance threshold, then the topic indicated by topic node 1 and the topic indicated by topic node 4 can be determined to be similar topics. Further, the next-hop node of topic node 4 can be obtained. If the next-hop node of topic node 4 is a resource node, then the distance between topic node 4 and the next-hop node can be obtained based on the weights of the edges between them. If the distance between topic node 4 and the next-hop node is less than a distance threshold, then the distance between resource node 1 and this next-hop node is less than the distance threshold. This can be understood as the resource indicated by this next-hop node having a similarity higher than the similarity threshold with the resource indicated by resource node 1. Therefore, the resource indicated by this next-hop node can be considered the first resource.
[0077] In this embodiment, the number of hops between the seed resource and the first resource can be limited. Specifically, if the number of hops between the seed resource and the first resource is limited to less than n, then the first resource can be searched in the first hop node, the second hop node, ..., the (n-1)th hop node of the seed resource. For example, if the number of hops between the seed resource and the first resource is limited to less than 3, the first resource can be searched in the first hop node and the second hop node of the seed resource.
[0078] S103, based on topic information and heterogeneous graph, find the second resource associated with the topic information.
[0079] In one implementation, a target topic node for indicating topic information can be determined in the heterogeneous graph. Based on at least one second candidate node that has a connection relationship with the target topic node, and the weight of the edge between each pair of nodes in the target topic node and at least one second candidate node, the distance between the target topic node and each second candidate node is obtained. A second candidate node whose distance to the target topic node is less than a distance threshold is found, and the resource indicated by the found second candidate node is used as the second resource.
[0080] In one example, suppose the seed resource includes resource 1, the topic information of resource 1 includes topic 1, and the node in the heterogeneous graph that indicates topic 1 is topic node 1. In the heterogeneous graph, topic node 1 is connected to resource node 2 and resource node 3. Then, it can be determined that at least one node connected to topic node 1 includes resource node 2 and resource node 3. Further, the distance between resource node 2 and topic node 1 can be obtained based on the edge weights of topic node 1 and resource node 2. If the distance between resource node 2 and topic node 1 is less than a distance threshold, then the resource indicated by resource node 2 is strongly correlated with the topic indicated by topic node 1, and therefore the resource indicated by resource node 2 is designated as the second resource. Similarly, the distance between resource node 3 and topic node 1 can be obtained based on the edge weights of topic node 1 and resource node 3. If the distance between resource node 3 and topic node 1 is greater than or equal to a distance threshold, then the resource indicated by resource node 3 is weakly correlated with the topic indicated by topic node 1, and therefore the resource indicated by resource node 3 is not designated as the second resource.
[0081] Optionally, if the distance between a resource node and topic node 1 is less than a distance threshold, not only can the resource indicated by the resource node be used as the second resource, but the next-hop node of the resource node (i.e., the node that is connected to the resource node) can also be obtained. If the next-hop node is a resource node, the distance between the resource node and the next-hop node can be obtained based on the weight of the edge between the resource node and the next-hop node. If the distance between the resource node and the next-hop node is less than the distance threshold, it can be determined that the distance between topic node 1 and the next-hop node is less than the distance threshold. This can be understood as the resource indicated by the next-hop node being strongly related to the topic indicated by topic node 1. Therefore, the resource indicated by the next-hop node can be used as the second resource.
[0082] In another example, suppose the seed resource includes resource 1, the topic information of resource 1 includes topic 1, and the node in the heterogeneous graph that indicates topic 1 is topic node 1. In the heterogeneous graph, topic node 1 and topic node 2 are connected. Then, it can be determined that at least one node connected to topic node 1 includes topic node 2. Further, the distance between topic node 1 and topic node 2 can be obtained based on the weights of the edges between them. If the distance between topic node 1 and topic node 2 is less than a distance threshold, then it can be determined that the topics indicated by topic node 1 and topic node 2 are similar topics. Further, the next-hop node of topic node 2 can be obtained. If the next-hop node of topic node 2 is a resource node, the distance between topic node 2 and the next-hop node can be obtained based on the weights of the edges between them. If the distance between topic node 2 and the next-hop node is less than a distance threshold, then it can be determined that the distance between topic node 1 and the next-hop node is less than the distance threshold. This can be understood as the resource indicated by the next-hop node being strongly correlated with the topic indicated by topic node 1. Therefore, the resource indicated by the next-hop node can be considered a second resource.
[0083] In this embodiment, the number of hops between the topic information of the seed resource and the second resource can be limited. Specifically, if the number of hops between the topic information of the seed resource and the second resource is limited to less than n, then the second resource can be searched in the first hop node, the second hop node, ..., the (n-1)th hop node of the topic information of the seed resource. For example, if the number of hops between the topic information of the seed resource and the second resource is limited to less than 3, the second resource can be searched in the first hop node and the second hop node of the topic information of the seed resource.
[0084] S104, use the first resource and the second resource as the recall resources for the target object.
[0085] In practice, recall resources for the target object can be generated, including a first resource and a second resource. These recall resources can then be applied to the recommendation system to achieve resource recommendation for the target object.
[0086] In this embodiment, seed resources that generate interactive behavior of the target object within a preset time period and topic information of the seed resources are obtained. Then, based on the seed resources and the heterogeneous graph, a first resource with a similarity higher than the similarity threshold with the seed resources is found. The heterogeneous graph includes multiple nodes, including topic nodes and resource nodes. The weight of the edge between each pair of nodes is used to indicate the degree of association between each pair of nodes. Based on the topic information and the heterogeneous graph, a second resource associated with the topic information is found. The first and second resources are then used as recall resources for the target object, which can improve the accuracy of resource recall.
[0087] Based on the above description, please refer to Figure 2 , Figure 2 This is a flowchart illustrating another resource retrieval method provided in this application embodiment. This resource retrieval method can be executed by a resource retrieval device or a computer device; such as... Figure 2 The resource retrieval scheme shown includes, but is not limited to, steps S201 to S207, wherein:
[0088] S201, Obtain training samples, which include topic information of multiple interacted resources that have interactive behavior during a historical time period, and at least one set of training resource pairs.
[0089] Each training resource pair consists of two training resources, one of which is a similar training resource to the other.
[0090] Optionally, the resource pairs generated per hour can be used as a set of training resource pairs through the Swing algorithm. The Swing algorithm is a recall algorithm proposed by Alibaba. The Swing algorithm considers the local graph structure relationship such as user-item-user. For users who click on the same item, the fewer items they click on together, the more similar the items are.
[0091] S202, invoke the initial resource recall model, based on the training resources in at least one set of training resource pairs, the topic information of each interacted resource and the initial heterogeneous graph, to obtain the distance between each training resource and any training resource other than each training resource in the training resources contained in at least one set of training resource pairs.
[0092] The initial heterogeneous graph is constructed based on the training resources and topic information of each interacting resource in at least one set of training resource pairs.
[0093] Optionally, the initial heterogeneous graph can be constructed by: determining resource nodes to indicate each training resource in the training samples, and topic nodes to indicate each topic information in the training samples; traversing any two nodes among the determined resource nodes and topic nodes. If the two nodes being traversed include one topic node and one resource node, the weight of the edge between the currently traversed resource node and the currently traversed topic node is determined based on the number of times the topic information of the training resource indicated by the currently traversed resource node exists in the topic information of multiple interacting resources. If the two nodes being traversed include two topic nodes, the weight of the edge between the currently traversed topic nodes is determined based on the number of training resources corresponding to the topic information indicated by each of the currently traversed topic nodes in the training resources included in the training samples, and the number of identical training resources corresponding to the topic information indicated by the currently traversed topic nodes. If the two nodes being traversed include two resource nodes, the weight of the edge between the currently traversed resource nodes is determined based on whether the training resources indicated by the currently traversed resource nodes are training resources in the same pair of training resources. After the traversal is complete, an initial heterogeneous graph is constructed based on the determined resource nodes, the determined topic nodes, the weights of the edges between each resource node and topic node, and the weights of the edges between each topic node.
[0094] Optionally, the method for determining the weight of the edge between the currently traversed resource node and the currently traversed topic node based on the number of times the topic information of the training resource indicated by the currently traversed resource node exists in the topic information of multiple interacted resources may include: using the reciprocal of the number of times the topic information of the training resource indicated by the currently traversed resource node exists in the topic information of multiple interacted resources as the weight of the edge between the currently traversed resource node and the currently traversed topic node.
[0095] For example, suppose the training sample includes 100 topic information items, namely topic information 1, topic information 2, ..., topic information 100. The topic information of the training resource indicated by the currently traversed resource node includes topic information 3, topic information 5, and topic information 120. Then it can be determined that the topic information of the training resource indicated by the currently traversed resource node exists in the topic information of multiple interacted resources, including topic information 3 and topic information 5. That is, the number of times the topic information of the training resource indicated by the currently traversed resource node exists in the topic information of multiple interacted resources is 2. Then the weight of the edge between the currently traversed resource node and the currently traversed topic node is 1 / 2. In this embodiment, the weight of the edge between the currently traversed resource node and the currently traversed topic node can be used to characterize the relevance between the resource indicated by the currently traversed resource node and the topic indicated by the currently traversed topic node. The fewer the number of topic information of the training resource indicated by the currently traversed resource node exists in the topic information of multiple interacting resources, the larger the weight of the edge between the currently traversed resource node and the currently traversed topic node, indicating that the resource indicated by the currently traversed resource node and the topic indicated by the currently traversed topic node are more relevant.
[0096] Optionally, based on the number of training resources corresponding to the topic information indicated by each topic node in the training samples, and the number of identical training resources corresponding to the topic information indicated by the two topic nodes in the current traversal, the weight of the edge between the two topic nodes in the current traversal is determined, including: comparing the number of training resources corresponding to the topic information indicated by the two topic nodes in the current traversal and determining the smaller number; and using the ratio between the number of identical training resources corresponding to the topic information indicated by the two topic nodes in the current traversal and the determined number as the weight of the edge between the two topic nodes in the current traversal.
[0097] In a specific implementation, the weight of the edge between the two currently traversed topic nodes can be determined by comparing the number of training resources corresponding to the topic information indicated by each topic node in the training resources contained in the training samples, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes.
[0098] For example, suppose the currently traversed topic nodes include topic node 1 and topic node 2, topic node 1 indicates topic 1, topic node 2 indicates topic 2, and the training resources included in the training sample contain topic information for training resource 1, training resource 5, and training resource 10. Then, we can determine that the training resources corresponding to topic 1 include training resource 1, training resource 5, and training resource 10. That is, the number of training resources corresponding to topic 1 in the training sample is 3. Similarly, suppose the training resources included in the training sample contain topic information for training resource 5, training resource 12, training resource 15, and training resource 20. Then, we can determine that the training resources corresponding to topic 2 include training resource 5, training resource 12, training resource 15, and training resource 20. That is, the number of training resources corresponding to topic 2 in the training sample is 4. The common training resources corresponding to topics 1 and 2 include training resource 5, meaning the number of common training resources corresponding to topics 1 and 2 is 1. Furthermore, comparing the number of training resources corresponding to topic 1 and topic 2 in the training samples, the smaller value is determined to be 3. Therefore, the weight of the edge between topics 1 and 2 can be determined to be 1 / 3. In this embodiment, the weight of the edge between the two currently traversed topic nodes can be used to characterize the similarity between the topics indicated by the currently traversed topic nodes. Topics with a number of corresponding resources greater than a threshold are considered "hot topics," meaning hot topics have a large number of resources. By obtaining the edge weights of the two topic nodes through the method disclosed in this embodiment, the weight of the edge for hot topics can be reduced. That is, to address the negative impact of hot topics, this embodiment performs a "cooling" process when calculating the edge weights of the two topic nodes, helping the model learn more structural information and reducing the Matthew effect in the system.
[0099] Optionally, the weight of the edge between the two resource nodes being traversed can be determined based on whether the training resources indicated by the two resource nodes are in the same training resource pair: if the training resources indicated by the two resource nodes are in the same training resource pair, then the weight of the edge between the two resource nodes is determined to be 1. If the training resources indicated by the two resource nodes are not in the same training resource pair, then the weight of the edge between the two resource nodes is determined to be 0.
[0100] In one implementation, determining resource nodes for indicating each training resource in the training samples and topic nodes for indicating each topic information in the training samples includes: filtering long-tail topics in the topic information contained in the training samples to obtain filtered topic information, and determining topic nodes for indicating each filtered topic information. Then, filtering long-tail resources in the training resources contained in the training samples to obtain filtered training resources, and determining resource nodes for indicating each filtered training resource. This embodiment of the application, by filtering long-tail topics and long-tail resources, can avoid the negative impact of long-tail topics and long-tail resources on model training, thereby improving the accuracy of the trained model.
[0101] In this context, "long-tail topics" refer to topics whose number of corresponding training resources in the training samples is less than a first quantity threshold. The first quantity threshold can be a pre-set threshold, set by researchers based on experience, or learned through a neural network; it is not specifically limited by the embodiments of this application. For example, assuming the first quantity threshold is 6, then long-tail topics refer to topics whose number of corresponding training resources in the training samples is less than 6.
[0102] In this context, "long-tail resources" refer to training resources whose number of connections to other training resources included in the training samples is less than a second threshold. The second threshold can be a pre-set threshold, set by researchers based on experience, or learned through a neural network, and is not specifically limited by the embodiments of this application. For example, assuming the second threshold is 10, then long-tail resources refer to resources whose number of connections to other training resources included in the training samples is less than 10. The number of connections for a particular resource can refer to the number of nodes in the heterogeneous graph that have connections to the resource node used to indicate that resource.
[0103] In one implementation, an initial resource retrieval model is invoked. Based on the training resources in at least one set of training resource pairs, the topic information of each interacted resource, and an initial heterogeneous graph, the distance between each training resource and any training resource other than the training resources in the at least one set of training resource pairs is obtained. This includes: sampling the nodes in the initial heterogeneous graph based on the weights of the edges between each resource node and the topic node in the initial heterogeneous graph, and the weights of the edges between each topic node and the topic node, to obtain multiple node triples; wherein each node triple includes three nodes; for any node triple, the distance between every two nodes in any node triple is obtained; wherein every two nodes are either neighboring nodes or non-neighboring nodes, and whether every two nodes are neighboring nodes or non-neighboring nodes is determined based on the connection relationship between every two nodes in the initial heterogeneous graph.
[0104] In specific implementation, node vector learning can be performed using a graph neural network (Graph Sample Aggregate, graphsage) algorithm. Two-hop neighbors are sampled according to edge weight probabilities, with six sampling strategies: topic-topic-topic, topic-topic-resource, topic-resource-topic, resource-resource-resource, resource-resource-topic, and resource-topic-resource. For example... Figure 3a Taking the heterogeneous graph shown as an example, sampling strategies can include topic-topic-topic, topic-topic-resource, and topic-resource-topic. For example... Figure 3b As shown, sampling strategies can include resource-resource-resource, resource-resource-topic, and resource-topic-resource.
[0105] S203, with the training objective of reducing the distance between two neighboring nodes in the initial heterogeneous graph and increasing the distance between two non-neighboring nodes in the initial heterogeneous graph, the initial resource recall model is trained to obtain the resource recall model.
[0106] In practice, the loss function can be used to calculate the loss value based on the distance between two neighboring nodes in the initial heterogeneous graph and the distance between two non-neighboring nodes in the initial heterogeneous graph. The loss function is as follows:
[0107] Loss = -[0.5*log_sigmoid(<topic,note+> -<topic,note-> )+0.5*log_sigmoid(<topic,topic+> -<topic,topic-> )]
[0108] Here, Loss represents the loss value, topic represents a topic node, note+ represents the sampled neighbor resource nodes of the topic node in the vector space, note- represents the negative sampled neighbor resource nodes of the topic node in the vector space, topic+ represents the sampled neighbor topic nodes of the topic node in the vector space, and topic- represents the negative sampled neighbor topic nodes of the topic node in the vector space. The loss function can be defined as maximizing the distance between a node (n) and its sampled neighbor node (n+) in the vector space, and maximizing the distance between it and its negative sampled neighbor node (n-).
[0109] This application's embodiments can construct a heterogeneous graph through the distribution relationship between topics and resources, employing different walk methods to fully connect different node information and improve the model's generalization ability. Secondly, in the initial heterogeneous graph construction stage, the node selection scheme fully considers the relevance between topics and resources, ensuring the recall accuracy during model training. Furthermore, since the granularity of topics is much larger than that of resources, to enhance the model's ability to distinguish topics, it learns not only the distance between topics and resources but also the distance between topics themselves, improving the model's prediction efficiency and accuracy for topics.
[0110] S204, Obtain seed resources for the target object to generate interactive behavior within a preset time period, as well as topic information of the seed resources.
[0111] S205, invoke the resource retrieval model, based on seed resources and heterogeneous graphs, to find the first resource with a similarity higher than the similarity threshold with the seed resource.
[0112] The heterogeneous graph consists of multiple nodes, including topic nodes and resource nodes. The weight of the edge between each pair of nodes is used to indicate the degree of association between each pair of nodes.
[0113] S206, based on topic information and heterogeneous graph, find the second resource associated with the topic information.
[0114] S207, the first resource and the second resource are used as the recall resources for the target object.
[0115] Steps S204 to S207 can be found in the detailed descriptions of steps S101 and S104 in the above embodiments, and will not be repeated in this application embodiment.
[0116] In this embodiment, training samples are obtained, including topic information of multiple interacting resources that have interactive behavior within a historical time period, and at least one set of training resource pairs. An initial resource recall model is invoked. Based on the training resources in the at least one set of training resource pairs, the topic information of each interacting resource, and the initial heterogeneous graph, the distance between each training resource and any training resource other than each training resource in the training resources included in the at least one set of training resource pairs is obtained. The training objective is to reduce the distance between two neighboring nodes in the initial heterogeneous graph and increase the distance between two non-neighboring nodes in the initial heterogeneous graph. The initial resource recall model is then trained to obtain a resource recall model. Seed resources that generate interactive behavior of the target object within a preset time period and the topic information of the seed resources are obtained. The resource recall model is invoked. Based on the seed resources and the heterogeneous graph, a first resource with a similarity higher than a similarity threshold with the seed resources is found. Based on the topic information and the heterogeneous graph, a second resource associated with the topic information is found. The first and second resources are used as recall resources for the target object, which can improve the accuracy and richness of resource recall.
[0117] This application also provides a computer storage medium storing program instructions, which, when executed, are used to implement the corresponding methods described in the above embodiments.
[0118] Please see again Figure 4 , Figure 4 This is a schematic diagram of the structure of a resource recall device provided in an embodiment of this application.
[0119] In one implementation of the resource retrieval device according to the embodiments of this application, the resource retrieval device includes the following structure.
[0120] The acquisition unit 401 is used to acquire seed resources of interactive behaviors generated by the target object within a preset time period, as well as topic information of the seed resources;
[0121] The first search unit 402 is used to search for a first resource with a similarity higher than a similarity threshold with the seed resource based on the seed resource and the heterogeneous graph; wherein, the heterogeneous graph includes multiple nodes, the multiple nodes include topic nodes and resource nodes, and the weight of the edge between every two nodes is used to indicate the degree of association between every two nodes;
[0122] The second search unit 403 is used to search for a second resource associated with the topic information based on the topic information and the heterogeneous graph;
[0123] The determining unit 404 is used to identify the first resource and the second resource as recall resources for the target object.
[0124] In one embodiment, the first search unit 402 searches for a first resource with a similarity higher than a similarity threshold to the seed resource based on the seed resource and the heterogeneous graph, including:
[0125] In the heterogeneous graph, a target resource node is determined to indicate the seed resource;
[0126] Based on at least one first candidate node that has a connection with the target resource node, and the weight of the edge between each pair of nodes in the target resource node and the at least one first candidate node, the distance between the target resource node and each first candidate node is obtained.
[0127] Find a first candidate node whose distance to the target resource node is less than a distance threshold, and use the resource indicated by the found first candidate node as the first resource.
[0128] In one embodiment, the second search unit 403 searches for a second resource associated with the topic information based on the topic information and the heterogeneous graph, including:
[0129] In the heterogeneous graph, a target topic node is determined to indicate the topic information;
[0130] Based on at least one second candidate node that has a connection with the target topic node, and the weight of the edge between each pair of nodes in the target topic node and the at least one second candidate node, the distance between the target topic node and each second candidate node is obtained.
[0131] Find a second candidate node whose distance to the target topic node is less than a distance threshold, and use the resource indicated by the found second candidate node as the second resource.
[0132] In one embodiment, the first and second resources are found by invoking a resource retrieval model.
[0133] The acquisition unit 401 is further configured to acquire training samples, the training samples including topic information of multiple interacted resources that have interactive behavior within a historical time period, and at least one set of training resource pairs; wherein each set of training resource pairs includes two training resources, one of the two training resources being a similar training resource to the other training resource.
[0134] The acquisition unit 401 is further configured to invoke the initial resource retrieval model, based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph, to acquire the distance between each training resource and any training resource other than the training resources included in the at least one set of training resource pairs; wherein, the initial heterogeneous graph is constructed based on the training resources in the at least one set of training resource pairs and the topic information of each interacted resource;
[0135] The resource retrieval device may further include a training unit 405, used to train the initial resource retrieval model with the training objectives of reducing the distance between two neighboring nodes in the initial heterogeneous graph and increasing the distance between two non-neighboring nodes in the initial heterogeneous graph, so as to obtain the resource retrieval model.
[0136] In one embodiment, the initial heterogeneous graph is constructed in the following manner:
[0137] Determine resource nodes for indicating each training resource in the training sample, and topic nodes for indicating each topic information in the training sample;
[0138] Traverse any two nodes among the determined resource nodes and the determined topic nodes. If the two nodes currently traversed include one topic node and one resource node, determine the weight of the edge between the currently traversed resource node and the currently traversed topic node based on the number of training resource topic information indicated by the currently traversed resource node in the topic information of the multiple interacted resources.
[0139] When the two nodes being traversed include two topic nodes, the weight of the edge between the two topic nodes being traversed is determined based on the number of training resources corresponding to the topic information indicated by each of the currently traversed topic nodes in the training resources contained in the training sample, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes.
[0140] When the two nodes being traversed include two resource nodes, the weights of the edges between the two resource nodes being traversed are determined based on whether the training resources indicated by the two resource nodes being traversed are training resources in the same training resource pair.
[0141] After the traversal is completed, the initial heterogeneous graph is constructed based on the determined resource nodes, the determined topic nodes, the weights of the edges between each resource node and topic node, and the weights of the edges between each topic node.
[0142] In one embodiment, the determining unit 404 determines the weight of the edge between the two currently traversed topic nodes based on the number of training resources corresponding to the topic information indicated by each currently traversed topic node in the training resources included in the training samples, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes, including:
[0143] Compare the number of training resources corresponding to the topic information indicated by the two topic nodes currently being traversed, and determine the number with the smaller value;
[0144] The ratio between the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes and the determined number is used as the weight of the edge between the two currently traversed topic nodes.
[0145] In one embodiment, the determining unit 404 determines resource nodes for indicating each training resource in the training sample, and topic nodes for indicating each topic information in the training sample, including:
[0146] Long-tail topics in the topic information contained in the training samples are filtered to obtain filtered topic information, and topic nodes for indicating each filtered topic information are determined; wherein, the long-tail topics refer to: topic information in the training resources contained in the training samples where the number of corresponding training resources is less than a first quantity threshold.
[0147] The long-tail resources in the training resources contained in the training sample are filtered to obtain filtered training resources, and resource nodes for indicating each filtered training resource are determined; wherein, the long-tail resources refer to training resources whose number of connections with other training resources in the training resources contained in the training sample is less than a second quantity threshold.
[0148] In one embodiment, the acquisition unit 401 invokes an initial resource retrieval model to obtain the distance between each training resource and any training resource other than the individual training resources in the at least one set of training resource pairs, based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph. This includes:
[0149] Based on the edge weights of each resource node and topic node in the initial heterogeneous graph, and the edge weights of each topic node and topic node, the nodes in the initial heterogeneous graph are sampled to obtain multiple node triples; wherein each node triple includes three nodes.
[0150] For any node triple, obtain the distance between every two nodes in the triple; wherein every two nodes are either neighboring nodes or non-neighboring nodes, and the determination of whether every two nodes are neighboring nodes or non-neighboring nodes is based on the connection relationship between every two nodes in the initial heterogeneous graph.
[0151] In this embodiment, the acquisition unit 401 acquires seed resources of interactive behaviors generated by the target object within a preset time period, as well as topic information of the seed resources. The first search unit 402 searches for a first resource with a similarity higher than the similarity threshold based on the seed resources and the heterogeneous graph. The second search unit 403 searches for a second resource associated with the topic information based on the topic information and the heterogeneous graph. The determination unit 404 uses the first and second resources as recall resources for the target object, which can improve the accuracy of resource recall.
[0152] Please see again Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device in this embodiment includes a power supply module and other structures, and includes a processor 501, a storage device 502, and a communication interface 503. The processor 501, the storage device 502, and the communication interface 503 can exchange data, and the processor 501 implements the corresponding target detection method.
[0153] Storage device 502 may include volatile memory, such as random-access memory (RAM); storage device 502 may also include non-volatile memory, such as flash memory, solid-state drive (SSD), etc.; storage device 502 may also include combinations of the above types of memory.
[0154] Processor 501 may be a central processing unit (CPU). Processor 501 may also be a combination of CPU and GPU. In a server, multiple CPUs and GPUs may be included as needed for corresponding data processing. In one embodiment, storage device 502 is used to store program instructions. Processor 501 can invoke program instructions to implement the various methods described above in the embodiments of this application.
[0155] In a first possible implementation, the processor 501 of the computer device invokes program instructions stored in the storage device 502 to obtain seed resources of interactive behavior generated by the target object within a preset time period, and topic information of the seed resources; based on the seed resources and the heterogeneous graph, it searches for a first resource with a similarity higher than a similarity threshold to the seed resources; wherein the heterogeneous graph includes multiple nodes, the multiple nodes include topic nodes and resource nodes, and the weight of the edge between each pair of nodes is used to indicate the degree of association between each pair of nodes; based on the topic information and the heterogeneous graph, it searches for a second resource associated with the topic information; and uses the first resource and the second resource as recall resources for the target object.
[0156] In one embodiment, when the processor 501 searches for a first resource with a similarity higher than a similarity threshold to the seed resource based on the seed resource and the heterogeneous graph, it may perform the following operations:
[0157] In the heterogeneous graph, a target resource node is determined to indicate the seed resource;
[0158] Based on at least one first candidate node that has a connection with the target resource node, and the weight of the edge between each pair of nodes in the target resource node and the at least one first candidate node, the distance between the target resource node and each first candidate node is obtained.
[0159] Find a first candidate node whose distance to the target resource node is less than a distance threshold, and use the resource indicated by the found first candidate node as the first resource.
[0160] In one embodiment, when the processor 501 searches for a second resource associated with the topic information based on the topic information and the heterogeneous graph, it may perform the following operations:
[0161] In the heterogeneous graph, a target topic node is determined to indicate the topic information;
[0162] Based on at least one second candidate node that has a connection with the target topic node, and the weight of the edge between each pair of nodes in the target topic node and the at least one second candidate node, the distance between the target topic node and each second candidate node is obtained.
[0163] Find a second candidate node whose distance to the target topic node is less than a distance threshold, and use the resource indicated by the found second candidate node as the second resource.
[0164] In one embodiment, the first resource and the second resource are found by invoking a resource retrieval model, and the processor 501 is further configured to perform the following operations:
[0165] Obtain training samples, which include topic information of multiple interacted resources that have interactive behavior within a historical time period, and at least one set of training resource pairs; wherein each set of training resource pairs includes two training resources, one of which is a similar training resource to the other.
[0166] The initial resource retrieval model is invoked, and based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph, the distance between each training resource and any training resource other than the training resources included in the at least one set of training resource pairs is obtained; wherein, the initial heterogeneous graph is constructed based on the training resources in the at least one set of training resource pairs and the topic information of each interacted resource.
[0167] The initial resource retrieval model is trained with the training objective of reducing the distance between two neighboring nodes in the initial heterogeneous graph and increasing the distance between two non-neighboring nodes in the initial heterogeneous graph, and the resource retrieval model is obtained.
[0168] In one embodiment, the initial heterogeneous graph is constructed in the following manner:
[0169] Determine resource nodes for indicating each training resource in the training sample, and topic nodes for indicating each topic information in the training sample;
[0170] Traverse any two nodes among the determined resource nodes and the determined topic nodes. If the two nodes currently traversed include one topic node and one resource node, determine the weight of the edge between the currently traversed resource node and the currently traversed topic node based on the number of training resource topic information indicated by the currently traversed resource node in the topic information of the multiple interacted resources.
[0171] When the two nodes being traversed include two topic nodes, the weight of the edge between the two topic nodes being traversed is determined based on the number of training resources corresponding to the topic information indicated by each of the currently traversed topic nodes in the training resources contained in the training sample, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes.
[0172] When the two nodes being traversed include two resource nodes, the weights of the edges between the two resource nodes being traversed are determined based on whether the training resources indicated by the two resource nodes being traversed are training resources in the same training resource pair.
[0173] After the traversal is completed, the initial heterogeneous graph is constructed based on the determined resource nodes, the determined topic nodes, the weights of the edges between each resource node and topic node, and the weights of the edges between each topic node.
[0174] In one embodiment, when the processor 501 determines the weight of the edge between the two currently traversed topic nodes based on the number of training resources corresponding to the topic information indicated by each currently traversed topic node in the training resources contained in the training samples, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes, it may perform the following operation:
[0175] Compare the number of training resources corresponding to the topic information indicated by the two topic nodes currently being traversed, and determine the number with the smaller value;
[0176] The ratio between the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes and the determined number is used as the weight of the edge between the two currently traversed topic nodes.
[0177] In one embodiment, when the processor 501 determines resource nodes for indicating each training resource in the training sample and topic nodes for indicating each topic information in the training sample, it may perform the following operations:
[0178] Long-tail topics in the topic information contained in the training samples are filtered to obtain filtered topic information, and topic nodes for indicating each filtered topic information are determined; wherein, the long-tail topics refer to: topic information in the training resources contained in the training samples where the number of corresponding training resources is less than a first quantity threshold.
[0179] The long-tail resources in the training resources contained in the training sample are filtered to obtain filtered training resources, and resource nodes for indicating each filtered training resource are determined; wherein, the long-tail resources refer to training resources whose number of connections with other training resources in the training resources contained in the training sample is less than a second quantity threshold.
[0180] In one embodiment, when the processor 501 invokes the initial resource retrieval model and, based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph, obtains the distance between each training resource and any training resource other than the individual training resources included in the at least one set of training resource pairs, the processor 501 may perform the following operations:
[0181] Based on the edge weights of each resource node and topic node in the initial heterogeneous graph, and the edge weights of each topic node and topic node, the nodes in the initial heterogeneous graph are sampled to obtain multiple node triples; wherein each node triple includes three nodes.
[0182] For any node triple, obtain the distance between every two nodes in the triple; wherein every two nodes are either neighboring nodes or non-neighboring nodes, and the determination of whether every two nodes are neighboring nodes or non-neighboring nodes is based on the connection relationship between every two nodes in the initial heterogeneous graph.
[0183] In this embodiment, the processor 501 obtains seed resources of interactive behavior generated by the target object within a preset time period, as well as topic information of the seed resources. Based on the seed resources and the heterogeneous graph, it searches for a first resource with a similarity higher than the similarity threshold with the seed resources. Based on the topic information and the heterogeneous graph, it searches for a second resource associated with the topic information. The first and second resources are used as recall resources for the target object, which can improve the accuracy of resource recall.
[0184] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. The computer-readable storage medium can mainly include a program storage area and a data storage area. The program storage area can store the operating system, at least one application program required for a function, etc.; the data storage area can store data created based on the use of blockchain nodes, etc.
[0185] The above-disclosed embodiments are merely some of the embodiments of this application, and should not be construed as limiting the scope of this application. Those skilled in the art can understand that implementing all or part of the above embodiments and making equivalent changes in accordance with the claims of this application still fall within the scope of this invention.
Claims
1. A resource recall method, characterized in that, include: Obtain seed resources of interactive behaviors generated by the target object within a preset time period, as well as topic information of the seed resources; Based on the seed resource and the heterogeneous graph, a first resource with a similarity higher than a similarity threshold is found; wherein, the heterogeneous graph includes multiple nodes, the multiple nodes include topic nodes and resource nodes, and the weight of the edge between every two nodes is used to indicate the degree of association between every two nodes; Based on the topic information and the heterogeneous graph, find the second resource associated with the topic information; The first resource and the second resource are used as recall resources for the target object; The first and second resources are found by calling the resource retrieval model. The training method of the resource retrieval model includes: obtaining training samples, which include topic information of multiple interactive resources that have interactive behavior in a historical time period, and at least one set of training resource pairs; wherein each set of training resource pairs includes two training resources, one of which is a similar training resource to the other. The initial resource retrieval model is invoked, and based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph, the distance between each training resource and any training resource other than the training resources included in the at least one set of training resource pairs is obtained; wherein, the initial heterogeneous graph is constructed based on the training resources in the at least one set of training resource pairs and the topic information of each interacted resource. The initial resource retrieval model is trained with the training objective of reducing the distance between two neighboring nodes in the initial heterogeneous graph and increasing the distance between two non-neighboring nodes in the initial heterogeneous graph, and the resource retrieval model is obtained. The initial heterogeneous graph is constructed in the following ways: Determine resource nodes for indicating each training resource in the training sample, and topic nodes for indicating each topic information in the training sample; Traverse any two nodes among the determined resource nodes and the determined topic nodes. If the two nodes currently traversed include one topic node and one resource node, determine the weight of the edge between the currently traversed resource node and the currently traversed topic node based on the number of training resource topic information indicated by the currently traversed resource node in the topic information of the multiple interacted resources. When the two nodes being traversed include two topic nodes, the weight of the edge between the two topic nodes being traversed is determined based on the number of training resources corresponding to the topic information indicated by each of the currently traversed topic nodes in the training resources contained in the training sample, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes. When the two nodes being traversed include two resource nodes, the weights of the edges between the two resource nodes being traversed are determined based on whether the training resources indicated by the two resource nodes being traversed are training resources in the same training resource pair. After the traversal is completed, the initial heterogeneous graph is constructed based on the determined resource nodes, the determined topic nodes, the weights of the edges between each resource node and topic node, and the weights of the edges between each topic node.
2. The method according to claim 1, characterized in that, The step of finding a first resource with a similarity higher than a similarity threshold to the seed resource based on the seed resource and the heterogeneous graph includes: In the heterogeneous graph, a target resource node is determined to indicate the seed resource; Based on at least one first candidate node that has a connection with the target resource node, and the weight of the edge between each pair of nodes in the target resource node and the at least one first candidate node, the distance between the target resource node and each first candidate node is obtained. Find a first candidate node whose distance to the target resource node is less than a distance threshold, and use the resource indicated by the found first candidate node as the first resource.
3. The method according to claim 1, characterized in that, The step of finding the second resource associated with the topic information based on the topic information and the heterogeneous graph includes: In the heterogeneous graph, a target topic node is determined to indicate the topic information; Based on at least one second candidate node that has a connection with the target topic node, and the weight of the edge between each pair of nodes in the target topic node and the at least one second candidate node, the distance between the target topic node and each second candidate node is obtained. Find a second candidate node whose distance to the target topic node is less than a distance threshold, and use the resource indicated by the found second candidate node as the second resource.
4. The method according to claim 1, characterized in that, The determination of the weight of the edge between the two currently traversed topic nodes, based on the number of training resources corresponding to the topic information indicated by each currently traversed topic node in the training resources contained in the training samples, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes, includes: Compare the number of training resources corresponding to the topic information indicated by the two topic nodes currently being traversed, and determine the number with the smaller value; The ratio between the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes and the determined number is used as the weight of the edge between the two currently traversed topic nodes.
5. The method according to claim 1, characterized in that, The determination of resource nodes for indicating each training resource in the training sample, and topic nodes for indicating each topic information in the training sample, includes: Long-tail topics in the topic information contained in the training samples are filtered to obtain filtered topic information, and topic nodes for indicating each filtered topic information are determined; wherein, the long-tail topics refer to: topic information in the training resources contained in the training samples where the number of corresponding training resources is less than a first quantity threshold. The long-tail resources in the training resources contained in the training sample are filtered to obtain filtered training resources, and resource nodes for indicating each filtered training resource are determined; wherein, the long-tail resources refer to training resources whose number of connections with other training resources in the training resources contained in the training sample is less than a second quantity threshold.
6. The method according to claim 1, characterized in that, The invocation of the initial resource retrieval model, based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph, obtains the distance between each training resource and any training resource other than the individual training resources included in the at least one set of training resource pairs, including: Based on the edge weights of each resource node and topic node in the initial heterogeneous graph, and the edge weights of each topic node and topic node, the nodes in the initial heterogeneous graph are sampled to obtain multiple node triples; wherein each node triple includes three nodes. For any node triple, obtain the distance between every two nodes in the triple; wherein every two nodes are either neighboring nodes or non-neighboring nodes, and the determination of whether every two nodes are neighboring nodes or non-neighboring nodes is based on the connection relationship between every two nodes in the initial heterogeneous graph.
7. A computer device, characterized in that, Includes storage devices and a processor, wherein: The storage device is used to store a computer program, the computer program including program instructions; The processor is configured to invoke the program instructions to execute the steps of the method as described in any one of claims 1-6.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause a computer device having the processor to perform the steps of the method according to any one of claims 1-6.
9. A resource recall device, characterized in that, The resource recall device includes: The acquisition unit is used to acquire seed resources of interactive behaviors generated by the target object within a preset time period, as well as topic information of the seed resources; The first search unit is used to search for a first resource with a similarity higher than a similarity threshold to the seed resource based on the seed resource and the heterogeneous graph; wherein, the heterogeneous graph includes multiple nodes, the multiple nodes include topic nodes and resource nodes, and the weight of the edge between every two nodes is used to indicate the degree of association between every two nodes; The second search unit is used to search for a second resource associated with the topic information based on the topic information and the heterogeneous graph; A determining unit is configured to use the first resource and the second resource as recall resources for the target object; The first and second resources are found by calling the resource retrieval model. The training method of the resource retrieval model includes: obtaining training samples, which include topic information of multiple interactive resources that have interactive behavior in a historical time period, and at least one set of training resource pairs; wherein each set of training resource pairs includes two training resources, one of which is a similar training resource to the other. The initial resource retrieval model is invoked, and based on the training resources in the at least one set of training resource pairs, the topic information of each interacted resource, and the initial heterogeneous graph, the distance between each training resource and any training resource other than the training resources included in the at least one set of training resource pairs is obtained; wherein, the initial heterogeneous graph is constructed based on the training resources in the at least one set of training resource pairs and the topic information of each interacted resource. The initial resource retrieval model is trained with the training objective of reducing the distance between two neighboring nodes in the initial heterogeneous graph and increasing the distance between two non-neighboring nodes in the initial heterogeneous graph, and the resource retrieval model is obtained. The initial heterogeneous graph is constructed in the following ways: Determine resource nodes for indicating each training resource in the training sample, and topic nodes for indicating each topic information in the training sample; Traverse any two nodes among the determined resource nodes and the determined topic nodes. If the two nodes currently traversed include one topic node and one resource node, determine the weight of the edge between the currently traversed resource node and the currently traversed topic node based on the number of training resource topic information indicated by the currently traversed resource node in the topic information of the multiple interacted resources. When the two nodes being traversed include two topic nodes, the weight of the edge between the two topic nodes being traversed is determined based on the number of training resources corresponding to the topic information indicated by each of the currently traversed topic nodes in the training resources contained in the training sample, and the number of identical training resources corresponding to the topic information indicated by the two currently traversed topic nodes. When the two nodes being traversed include two resource nodes, the weights of the edges between the two resource nodes being traversed are determined based on whether the training resources indicated by the two resource nodes being traversed are training resources in the same training resource pair. After the traversal is completed, the initial heterogeneous graph is constructed based on the determined resource nodes, the determined topic nodes, the weights of the edges between each resource node and topic node, and the weights of the edges between each topic node.
10. A computer program product, characterized in that, The computer program product includes a computer program adapted to be loaded by a processor and to execute the steps of the method according to any one of claims 1-6.