Cross-domain sequence recommendation model training method and cross-domain sequence recommendation method and system
By constructing heterogeneous graphs and using item attribute information and metapathic path guidance node embedding representations, the problem of ignoring different domain associations in cross-domain sequence recommendations is solved, and more efficient model training and prediction accuracy is achieved.
Patent Information
- Application Number
- CN202510165005.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-13
AI Technical Summary
The prior art ignores the association of items between different fields in cross-domain sequence recommendation, resulting in failure to fully utilize the user's item conversion mode in different fields sequences, affecting the model training effect and prediction accuracy.
By obtaining historical interaction data and training sample sets, heterogeneous graphs are constructed to associate nodes in different fields, and using item attribute information and metapathic paths to guide node embedding representations, training of cross-domain sequence recommendation models is carried out.
This method can more effectively utilize potential correlation information between different fields, improve model training effect and prediction accuracy, thereby improving the accuracy of information recommendation.
Smart Images

Figure CN120144858A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data processing, and particularly relates to a method for training a cross-domain sequential recommendation model, a cross-domain sequential recommendation method, and a system. Background Art
[0002] The rapid development of Internet technology has met the user's demand for information. However, the substantial increase in the amount of information has also made it impossible for users to efficiently obtain the useful part for themselves when facing a large amount of information, resulting in the problem of "information overload". Currently, information recommendation methods or information recommendation systems can be used to solve this problem. The information recommendation system mines the historical behavior data of users, models the user's interest preferences, and then recommends information to users, guiding users to find their information needs in the intricate choices.
[0003] Sequential recommendation is an important method in information recommendation systems. Currently, in most scenarios, cross-domain sequential recommendation needs to be implemented. Specifically, it is necessary to first train a cross-domain sequential recommendation model to perform information recommendation based on the trained cross-domain sequential recommendation model. In the prior art, usually, the sequences composed of the historical interaction items of users in each domain are directly obtained, and each item sequence is used as a training sample for model training. The problem with the prior art is that it ignores the association between items in different domains, thus ignoring the item conversion pattern of users in different domain sequences, and does not fully utilize the potential association information between different domains, which is not conducive to improving the effect of model training, not conducive to improving the prediction accuracy of the trained model, and thus not conducive to improving the accuracy when using the trained model for information recommendation.
[0004] Therefore, the related art still needs to be improved and developed. Summary of the Invention
[0005] The main purpose of the present application is to provide a method for training a cross-domain sequential recommendation model, a cross-domain sequential recommendation method, and a system, aiming to solve the technical problem that in the related art, the sequences composed of the historical interaction items of users in each domain are directly obtained, and each item sequence is used as a training sample for model training, without fully utilizing the potential association information between different domains, which is not conducive to improving the effect of model training, not conducive to improving the prediction accuracy of the trained model, and thus not conducive to improving the accuracy when using the trained model for information recommendation.
[0006] To achieve the above purpose, in the first aspect of the present application, a method for training a cross-domain sequential recommendation model is provided. Among them, the method for training a cross-domain sequential recommendation model includes:
[0007] Obtain historical interaction data and a training sample set. Among them, the above historical interaction data includes items corresponding to each field, attribute information of the above items, and interaction behavior information of each user for the above items. The above training sample set includes multiple training samples, and each of the above training samples includes an interaction sequence of a user in each of the above fields. The interaction sequence includes the items interacted by the user and the attribute information of the above items;
[0008] Input the above historical interaction data into the cross-domain sequence recommendation model to be trained, so as to trigger the cross-domain sequence recommendation model to be trained to construct a heterogeneous graph according to the above historical interaction data, and determine a contrast loss according to the heterogeneous graph. Among them, the nodes in the heterogeneous graph are determined according to the corresponding users, items, and attribute information of the above items in the historical interaction data, and the edges in the heterogeneous graph are determined according to the interaction behavior information and the corresponding relationship between the above items and the attribute information;
[0009] Input the training samples in the above training sample set into the cross-domain sequence recommendation model to be trained, so as to trigger the cross-domain sequence recommendation model to be trained to determine the predicted interaction scores of the user for the items in each of the above fields according to each of the above training samples, and determine the recommendation losses corresponding to each of the above fields according to each of the above predicted interaction scores;
[0010] Adjust the parameters of the cross-domain sequence recommendation model to be trained according to the above contrast loss and the recommendation losses corresponding to each of the above fields, and return to the step of inputting the above historical interaction data into the cross-domain sequence recommendation model to be trained until the preset training termination condition is met, and obtain the trained cross-domain sequence recommendation model.
[0011] Optionally, the above attribute information includes at least one of category, brand, and price.
[0012] Optionally, the step of inputting the above historical interaction data into the cross-domain sequence recommendation model to be trained, so as to trigger the cross-domain sequence recommendation model to be trained to construct a heterogeneous graph according to the above historical interaction data, and determine a contrast loss according to the heterogeneous graph, includes:
[0013] Input the above historical interaction data into the cross-domain sequence recommendation model to be trained;
[0014] Construct nodes through the cross-domain sequence recommendation model according to the users, items, and attribute information of the above items in the historical interaction data;
[0015] Construct initial edges between the above nodes according to the interaction behavior information and the corresponding relationship between the above items and the attribute information;
[0016] For the nodes corresponding to the above attribute information, determine the correlation scores between the above attribute information, and construct extended edges between the nodes corresponding to the above attribute information according to the above correlation scores;
[0017] Construct the above heterogeneous graph according to the above nodes, the above initial edges, and the above extended edges;
[0018] Determine the contrastive loss according to the above heterogeneous graph through the above cross-domain sequence recommendation model to be trained.
[0019] Optionally, the determining the contrastive loss according to the above heterogeneous graph includes:
[0020] For each node in the above heterogeneous graph, according to the preset path types and the preset path determination rules, respectively determine multiple types of meta-paths corresponding to the above node through the above cross-domain sequence recommendation model to be trained, and respectively obtain the neighbor node sets corresponding to each type of meta-path;
[0021] Respectively determine the aggregated node embedding representations of the above node based on each type of meta-path according to the above neighbor node sets, where the above aggregated node embedding representations correspond one-to-one with the above neighbor node sets;
[0022] Use the aggregated node embedding representations obtained from different neighbor node sets based on the same node as positive sample pairs, and use the aggregated node embedding representations corresponding to different nodes as negative sample pairs. Determine the above contrastive loss according to the similarity between the above positive sample pairs and the similarity between the above negative sample pairs.
[0023] Optionally, inputting the training samples in the above training sample set into the above cross-domain sequence recommendation model to be trained to trigger the above cross-domain sequence recommendation model to be trained to determine the predicted interaction scores of the above user for the items in each of the above domains according to each of the above training samples, and respectively determining the recommendation losses corresponding to each of the above domains includes:
[0024] Input the training samples in the above training sample set into the above cross-domain sequence recommendation model to be trained;
[0025] Through the above cross-domain sequence recommendation model, obtain the user node corresponding to the user in the above heterogeneous graph in the above training sample, and perform average pooling processing on the aggregated node embedding representations of the above user node based on each type of meta-path to obtain the average node embedding representation corresponding to the above user node;
[0026] For each domain, determine the sequence preference representation of the above user in the above domain through the above cross-domain sequence recommendation model according to the above training samples;
[0027] Determine the comprehensive preference representation corresponding to the user in each of the above fields based on the average node embedding representation corresponding to the above user nodes and the sequence preference representation corresponding to the above user in each field;
[0028] For each field, determine the predicted interaction score of the user for the items in the above field based on the comprehensive preference representation corresponding to the user in the above field, and determine the recommendation loss corresponding to the above field according to each of the above predicted interaction scores.
[0029] The second aspect of the present application provides a cross-domain sequential recommendation model training system, wherein the cross-domain sequential recommendation model training system includes:
[0030] A training data acquisition module, configured to acquire historical interaction data and a training sample set, wherein the historical interaction data includes items corresponding to each field, attribute information of the items, and interaction behavior information of each user for the items, and the training sample set includes a plurality of training samples, and each of the above training samples includes an interaction sequence of a user in each of the above fields, and the interaction sequence includes the items interacted by the user and the attribute information of the items;
[0031] A contrast loss determination module, configured to input the historical interaction data into a cross-domain sequential recommendation model to be trained, so as to trigger the cross-domain sequential recommendation model to be trained to construct a heterogeneous graph according to the historical interaction data, and determine a contrast loss according to the heterogeneous graph, wherein the nodes in the heterogeneous graph are determined according to the corresponding users, items, and attribute information of the items in the historical interaction data, and the edges in the heterogeneous graph are determined according to the interaction behavior information and the corresponding relationship between the items and the attribute information;
[0032] A recommendation loss determination module, configured to input the training samples in the training sample set into the cross-domain sequential recommendation model to be trained, so as to trigger the cross-domain sequential recommendation model to be trained to determine the predicted interaction scores of the user for the items in each of the above fields according to each of the above training samples, and determine the recommendation losses corresponding to each of the above fields according to each of the above predicted interaction scores;
[0033] A training control module, configured to adjust the parameters of the cross-domain sequential recommendation model to be trained according to the contrast loss and the recommendation losses corresponding to each of the above fields, and return to execute the step of inputting the historical interaction data into the cross-domain sequential recommendation model to be trained until a preset training termination condition is met, and obtain a trained cross-domain sequential recommendation model.
[0034] The third aspect of the present application provides a cross-domain sequential recommendation method, wherein the cross-domain sequential recommendation method includes:
[0035] Obtain the historical interaction sequences of the user to be recommended in each domain, where the historical interaction sequences include the items interacted with by the user to be recommended and the attribute information of the items;
[0036] Input the historical interaction sequences into the trained cross - domain sequence recommendation model to trigger the trained cross - domain sequence recommendation model to determine the predicted interaction scores of the user to be recommended for the items in each domain according to each historical interaction sequence, and determine the target recommended items from the items according to each predicted interaction score, where the trained cross - domain sequence recommendation model is trained according to any one of the cross - domain sequence recommendation model training methods.
[0037] The fourth aspect of this application provides a cross - domain sequence recommendation system, where the cross - domain sequence recommendation system includes:
[0038] A historical data acquisition module, which obtains the historical interaction sequences of the user to be recommended in each domain, where the historical interaction sequences include the items interacted with by the user to be recommended and the attribute information of the items;
[0039] An item recommendation module, which is used to input the historical interaction sequences into the trained cross - domain sequence recommendation model to trigger the trained cross - domain sequence recommendation model to determine the predicted interaction scores of the user to be recommended for the items in each domain according to each historical interaction sequence, and determine the target recommended items from the items according to each predicted interaction score, where the trained cross - domain sequence recommendation model is trained according to any one of the cross - domain sequence recommendation model training methods.
[0040] The fifth aspect of this application provides an intelligent terminal, where the intelligent terminal includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of any one of the cross - domain sequence recommendation model training methods, or when the computer program is executed by the processor, it implements the steps of any one of the cross - domain sequence recommendation methods.
[0041] The sixth aspect of this application provides a computer - readable storage medium, where a computer program is stored on the computer - readable storage medium. When the computer program is executed by a processor, it implements the steps of any one of the cross - domain sequence recommendation model training methods, or when the computer program is executed by the processor, it implements the steps of any one of the cross - domain sequence recommendation methods.
[0042] As can be seen from the above, in the solution of this application, historical interaction data and a training sample set are obtained. Among them, the above historical interaction data includes items corresponding to each field, attribute information of the above items, and interaction behavior information of each user with respect to the above items. The above training sample set includes a plurality of training samples. Each of the above training samples includes an interaction sequence of a user in each of the above fields. The above interaction sequence includes the items interacted by the user and the attribute information of the above items; the above historical interaction data is input into a cross-domain sequence recommendation model to be trained, so as to trigger the cross-domain sequence recommendation model to be trained to construct a heterogeneous graph according to the above historical interaction data, and determine a contrast loss according to the above heterogeneous graph. Among them, the nodes in the above heterogeneous graph are determined according to the corresponding users, items, and attribute information of the above items in the above historical interaction data. The edges in the above heterogeneous graph are determined according to the above interaction behavior information and the corresponding relationship between the above items and the above attribute information; the training samples in the above training sample set are input into the cross-domain sequence recommendation model to be trained, so as to trigger the cross-domain sequence recommendation model to be trained to determine the predicted interaction scores of the above user for the items in each of the above fields according to each of the above training samples, and determine the recommendation losses corresponding to each of the above fields according to each of the above predicted interaction scores; according to the above contrast loss and the recommendation losses corresponding to each of the above fields, the parameters of the cross-domain sequence recommendation model to be trained are adjusted, and the step of inputting the above historical interaction data into the cross-domain sequence recommendation model to be trained is returned until a preset training termination condition is met, and a trained cross-domain sequence recommendation model is obtained.
[0043] Compared with the prior art, in the solution corresponding to the cross-domain sequence recommendation model training method provided by this application, when training the model, it does not directly obtain the sequence composed of the historical interaction items of the user in each field as the training sample for training. Instead, historical interaction data and a training sample set are obtained for training, and the historical interaction data and the training sample set not only include the items interacted by the user and the corresponding interaction behavior information, but also include the attribute information of the items. Items in different fields may have the same item attribute information. In this application, item attribute information is introduced, and a heterogeneous graph is constructed to assist the training process. Based on the heterogeneous graph, nodes in different fields can be associated. In this way, the association between items in different fields is considered, so that the item conversion mode of the user in different field sequences is considered, the potential association information between different fields can be fully utilized, which is beneficial to improving the effect of model training, beneficial to improving the prediction accuracy of the trained model, and thus beneficial to improving the accuracy when using the trained model for information recommendation. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0045] Figure 1 is a schematic flowchart of a cross - domain sequence recommendation model training method provided by an embodiment of the present application;
[0046] Figure 2 is a schematic diagram of the overall architecture of a heterogeneous graph transfer learning model provided by an embodiment of the present application;
[0047] Figure 3 is a schematic diagram of the component modules of a cross - domain sequence recommendation model training system provided by an embodiment of the present application;
[0048] Figure 4 is a schematic flowchart of a cross - domain sequence recommendation method provided by an embodiment of the present application;
[0049] Figure 5 is a schematic diagram of the component modules of a cross - domain sequence recommendation system provided by an embodiment of the present application;
[0050] Figure 6 is a schematic diagram of the internal structure principle of an intelligent terminal provided by an embodiment of the present application. Detailed implementation manners
[0051] In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well - known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.
[0052] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0053] It should also be understood that the terms used in the specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the specification of the present application and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0054] It should also be further understood that the term "and / or" used in the specification and appended claims of the present application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0055] Sequential Recommendation (SR) is an important approach in recommendation systems. By analyzing the user's behavior sequence, it captures the user's dynamic preferences and has strong accuracy and practicality. However, most existing sequential recommendation algorithms only focus on the behavioral data in a single domain, which will lead to a significant decline in recommendation quality in the case of data sparsity. Cross-domain Sequential Recommendation (CDSR) aims to capture the user's sequential preferences while alleviating the data sparsity problem. In the prior art, the sequences composed of the historical interaction items of the user in each domain are usually directly obtained, and each item sequence is used as a training sample for model training. The problem with the prior art is that it ignores the association between items in different domains, thus ignoring the item transition pattern of the user in different domain sequences, and does not fully utilize the potential association information between different domains, which is not conducive to improving the effect of model training, the prediction accuracy of the trained model, and thus the accuracy when using the trained model for information recommendation.
[0056] Specifically, most existing cross-domain sequential recommendation methods focus on learning the user preferences in different domains and then performing information transfer between different domains. When learning preferences, each domain is often independent, and this approach ignores the item transfer pattern existing between different domain sequences. In the actual scenario, a user's interaction in one domain may affect his next interaction in other domains. If the information between different domain sequences can be further mined, the quality of recommendation can be improved. In addition, the existing methods cannot be applied to multi-domain scenarios, which brings a huge overhead problem to computing and storage resources. At the same time, the existing methods rely on overlapping users as the bridge for knowledge transfer and it is difficult to capture the complex associations between domains in the absence of sufficient overlapping users, thus limiting the performance and generalization ability of the recommendation system.
[0057] In the prior art, there is no attribute-aware method specifically designed for CDSR, and it still faces challenges from the lack of overlapping users. To solve at least one of the above-mentioned multiple technical problems, this application introduces item attributes into cross-domain sequential recommendation and proposes a knowledge transfer learning algorithm based on heterogeneous graphs for model training. By constructing a cross-domain heterogeneous graph, it allows user, item, and category nodes in different domains to be associated, and enhances model flexibility through edge expansion based on semantic similarity and co-occurrence probability. By guiding node information aggregation with metapaths, it reduces the model's dependence on the number of overlapping users, and captures users' dynamic preferences and transition patterns within category sequences through an attention module. Finally, cross-domain knowledge transfer is performed to achieve mutual complementation of user preferences between different domains.
[0058] Specifically, obtain historical interaction data and a training sample set. Among them, the above historical interaction data includes items corresponding to each domain, attribute information of the above items, and interaction behavior information of each user for the above items. The above training sample set includes multiple training samples, and each of the above training samples includes an interaction sequence of a user in each of the above domains. The interaction sequence includes the items interacted with by the user and the attribute information of the above items; input the above historical interaction data into the cross-domain sequential recommendation model to be trained, so as to trigger the cross-domain sequential recommendation model to be trained to construct a heterogeneous graph according to the above historical interaction data, and determine a contrast loss according to the above heterogeneous graph. Among them, the nodes in the above heterogeneous graph are determined according to the corresponding users, items, and attribute information of the above items in the historical interaction data, and the edges in the above heterogeneous graph are determined according to the above interaction behavior information and the corresponding relationship between the above items and the above attribute information; input the training samples in the above training sample set into the cross-domain sequential recommendation model to be trained, so as to trigger the cross-domain sequential recommendation model to be trained to determine the predicted interaction scores of the above user for the items in each of the above domains according to each of the above training samples, and determine the recommendation losses corresponding to each of the above domains according to each of the above predicted interaction scores; adjust the parameters of the cross-domain sequential recommendation model to be trained according to the above contrast loss and the recommendation losses corresponding to each of the above domains, and return to execute the step of inputting the above historical interaction data into the cross-domain sequential recommendation model to be trained until a preset training termination condition is met, and obtain a trained cross-domain sequential recommendation model.
[0059] Compared with the prior art, in the solution corresponding to the cross-domain sequence recommendation model training method provided by this application, when training the model, it does not directly obtain the sequence composed of the historical interaction items of the user in each domain as the training sample for training. Instead, it obtains the historical interaction data and the training sample set for training, and both the historical interaction data and the training sample set include not only the items interacted by the user and the corresponding interaction behavior information, but also the attribute information of the items. Items in different domains may have the same item attribute information. In this application, the item attribute information is introduced, and a heterogeneous graph is constructed to assist the training process. Based on the heterogeneous graph, nodes in different domains can be associated. In this way, the association between items in different domains is considered, thus considering the item conversion mode of the user in different domain sequences, and the potential association information between different domains can be fully utilized, which is beneficial to improving the effect of model training, beneficial to improving the prediction accuracy of the trained model, and thus beneficial to improving the accuracy when using the trained model for information recommendation.
[0060] As Figure 1 shown, an embodiment of this application provides a cross-domain sequence recommendation model training method. Specifically, the above method includes the following steps:
[0061] Step S100, obtain historical interaction data and a training sample set. Among them, the above historical interaction data includes items corresponding to each domain, the attribute information of the above items, and the interaction behavior information of each user for the above items. The above training sample set includes multiple training samples, and each of the above training samples includes an interaction sequence of a user in each of the above domains. The above interaction sequence includes the items interacted by the user and the attribute information of the above items.
[0062] Among them, the above historical interaction data and the above training sample set can be collected in advance. It should be noted that there may be overlapping data between the above historical interaction data and the above training sample set, or they can be pre-divided to ensure that the two sets of data do not repeat to obtain a better training effect, and no specific limitation is made here.
[0063] Specifically, the above attribute information includes at least one of category, brand, and price. In the embodiment of this application, the above attribute information including the category of the item is taken as an example for specific description, but it is not used as a specific limitation.
[0064] It should be noted that for different items in the same domain or different items in different domains, they may have the same attribute information, so that items in different domains can be associated based on the attribute information, and the potential association information between different domains can be fully utilized.
[0065] For example, domain A represents the movie domain, and domain B represents the book domain. The interaction sequences of the user in domain A can include: Movie 1, Movie 2, Movie 3, and Movie 4; the interaction sequences of the user in domain B can include Book 1, Book 2, Book 3, and Book 4. Among them, Movie 2 and Book 4 may have the same category, such as the category of "action".
[0066] In the embodiments of the present application, based on a specific application scenario, the problems in training a cross-domain sequence recommendation model and performing cross-domain sequence recommendation are defined. It should be noted that in the embodiments of the present application, specific descriptions are made from the perspective of training a cross-domain sequence recommendation model, but the data processing process based on the model when using the model for information recommendation is similar to that during model training, so they can be referred to each other.
[0067] It should be further noted that in the embodiments of the present application, specific descriptions are made by taking the processing of two domains as an example. However, in actual applications, more domains can be processed. For example, it can be applied to three domains, four domains, or even more domains. The processing process for each domain refers to the processing process provided in the embodiments of the present application.
[0068] Specifically, use to represent the user set. For each user The present application uses S A ={A 1 , A 2 , …, A L} and S B ={B 1 , B 2 , …, B L} to represent the interaction sequences of the user in domain A and domain B (sorted in chronological order), where A i represents the interaction of the user at the i-th time step in domain A. L represents the maximum length of the user sequence in a single domain, and its value can be set and adjusted according to actual needs. If the length of the user's sequence is less than L, "padding" items are added at the head of the sequence as padding until the sequence length is equal to L. The specific content of the padding can be set and adjusted according to actual needs and is not specifically limited here. In the embodiments of the present application, the category is used as the auxiliary information of the item, and the category set can be represented as Since an item can belong to multiple categories at the same time, the present application uses to represent the i-th interaction of the user, where represents the identification information of the item (such as the item ID), and represents the j-th category of item i. Given the input data of the user's behavior sequences S A and S B, the goal of category-aware cross-domain sequential recommendation (i.e., the result to be output) is to predict the items that a user may interact with next in two domains. and
[0069] Step S200: Input the above historical interaction data into the cross-domain sequential recommendation model to be trained, so as to trigger the cross-domain sequential recommendation model to be trained to construct a heterogeneous graph according to the above historical interaction data, and determine a contrastive loss according to the heterogeneous graph. Among them, the nodes in the heterogeneous graph are determined according to the corresponding users, items, and the attribute information of the items in the above historical interaction data, and the edges in the heterogeneous graph are determined according to the interaction behavior information and the corresponding relationship between the items and the attribute information.
[0070] It should be noted that the historical interaction data used in the embodiments of the present application includes historical interaction sequences corresponding to multiple users, specifically including item IDs corresponding to each domain in a preset multiple domains, the attribute information of the items, and the interaction behavior information of the users. The historical interaction data can adopt the same sequence representation method as above. In the embodiments of the present application, the heterogeneous graph is constructed according to the historical interaction behaviors of users in multiple domains and the attribute information of items. The construction process of the heterogeneous graph is integrated in the cross-domain sequential recommendation model. When using the trained model for prediction, the historical data of the user has been constructed into the heterogeneous graph corresponding to the model, and there is no need to reconstruct it. In the embodiments of the present application, meta-path extraction is also performed based on the heterogeneous graph to determine relevant nodes for better learning.
[0071] Specifically, the above step of inputting the above historical interaction data into the cross-domain sequential recommendation model to be trained, so as to trigger the cross-domain sequential recommendation model to be trained to construct a heterogeneous graph according to the above historical interaction data, and determine a contrastive loss according to the heterogeneous graph, includes:
[0072] Input the above historical interaction data into the cross-domain sequential recommendation model to be trained;
[0073] Through the above cross-domain sequential recommendation model, construct nodes according to the users, items, and the attribute information of the items in the above historical interaction data;
[0074] Construct initial edges between the above nodes according to the above interaction behavior information and the corresponding relationship between the items and the attribute information;
[0075] For the nodes corresponding to the above attribute information, determine the correlation scores between the above attribute information, and construct extended edges between the nodes corresponding to the above attribute information according to the correlation scores;
[0076] Construct the above heterogeneous graph according to the above nodes, the above initial edges, and the above extended edges;
[0077] Determine the contrastive loss according to the above heterogeneous graph by means of the above cross - domain sequential recommendation model to be trained.
[0078] Further, determining the contrastive loss according to the above heterogeneous graph includes:
[0079] For each node in the above heterogeneous graph, according to the preset path types and the preset path determination rules, respectively determine multiple types of meta - paths corresponding to the above node through the above cross - domain sequential recommendation model to be trained, and respectively obtain the neighbor node sets corresponding to each type of meta - path;
[0080] Respectively determine the aggregated node embedding representations of the above node based on each type of meta - path according to the above neighbor node sets, where the above aggregated node embedding representations are in one - to - one correspondence with the above neighbor node sets;
[0081] Take the aggregated node embedding representations obtained from different neighbor node sets based on the same node as positive sample pairs, and take the aggregated node embedding representations corresponding to different nodes as negative sample pairs, and determine the above contrastive loss according to the similarity between the above positive sample pairs and the similarity between the above negative sample pairs.
[0082] Among them, the above - mentioned preset path types can be set and adjusted according to actual needs. Figure 2 It is a schematic diagram of the overall architecture of a heterogeneous graph transfer learning model provided by an embodiment of the present application. As Figure 2 shown, the cross - domain sequential recommendation model provided in the embodiment of the present application is a heterogeneous graph transfer learning (HGTL, Heterogeneous Graph Transfer Learning) model, which specifically includes multiple parts such as cross - domain heterogeneous graph construction, node representation learning guided by meta - paths, category - aware sequential preference learning, and a prediction layer.
[0083] Specifically, as Figure 2 shown in the cross - domain heterogeneous graph construction part, in the embodiment of the present application, item, user, and item attribute information are used as nodes. According to the above interaction behavior information and the correspondence between the above item and the above attribute information, construct the initial edges between the above nodes. For the nodes corresponding to the above attribute information, determine the correlation scores between each of the above attribute information, and construct extended edges between the nodes corresponding to the above attribute information according to the above correlation scores. Both the initial edges and the extended edges are used as the edges of the heterogeneous graph.
[0084] In the embodiment of the present application, use to represent the heterogeneous graph, where and respectively represent the sets of nodes and edges in the graph. For the node type function φ: and the edge type function This application uses and to represent predefined node types and edge types respectively, and restricts
[0085] As Figure 2 shown, in the embodiment of this application, the heterogeneous graph includes three types of nodes, including user node u, item node v, and category node c, where the item node can be subdivided into item node v A in domain A and item node v B in domain B. At the same time, there are two types of edges in the graph. The edge between the user node and the item node indicates that the user has interacted with the item, and the edge between the item node and the category node indicates that the item belongs to the category.
[0086] By constructing a cross-domain heterogeneous graph, item nodes in different domains can be correlated with each other, thereby realizing rich knowledge transfer between different domains. In traditional cross-domain recommendation, usually only overlapping users are relied on as a bridge to connect items in different domains. However, in the heterogeneous graph constructed in this application, items in different domains can also be correlated through the same category, which makes the effect of the model no longer severely dependent on the number of overlapping users.
[0087] Furthermore, for each node in the above heterogeneous graph, according to the preset path types and the preset path determination rules, multiple types of meta-paths corresponding to the above nodes are respectively determined through the above cross-domain sequential recommendation model to be trained, and the neighbor node sets corresponding to each type of meta-path are respectively obtained. Among them, the above path types and path determination rules are preset according to actual needs and can also be adjusted according to actual needs. It should be noted that different path types and path determination rules can be set for different types of nodes respectively, or the same path types and path determination rules can be used for different types of nodes, which is not specifically limited here. For example, for the item node, two paths such as item-user-item (I-U-I) and item-category-item (I-C-I) are set, and the path determination rules are used to define how to determine the corresponding meta-paths.
[0088] Specifically, in the heterogeneous graph, two nodes can be connected through different meta-paths. A meta-path can be defined as a path in the form of . It describes the composite relationship between the starting node type and the ending node where ° represents the composite operator on the relationship. By using the designed meta-paths, this application can identify entity pairs that are far apart but have a certain association in the heterogeneous graph.
[0089] In the embodiments of the present application, taking the item level (i.e., for item nodes) as an example, the designed meta-paths are specifically described. For the user level and the item attribute information level, the descriptions of the item level can be referred to. It should be noted that the attribute information used in the embodiments of the present application is the category. As Figure 2 shown, at the item level, two item nodes can be connected to each other through different meta-paths, such as item-user-item (I-U-I) and item-category-item (I-C-I). When designing the meta-paths, according to the actual scenario, different meta-paths are used to represent different semantics. For example, I-U-I means that two items are purchased by the same user, indicating that there is a certain connection between them. I-C-I means that two items belong to the same category, implying that they share some similar features. The present application also designs meta-paths for the user level and the category level. At the user level, the present application has two meta-paths: user-item-user (U-I-U) and user-item-category-item-user (U-I-C-I-U). The former connects two users who purchase the same item, while the latter connects two users who prefer items of the same category. At the category level, the present application has category-item-category (C-I-C), which associates different categories of the same item, and category-item-user-item-category (C-I-U-I-C), which connects two categories preferred by the same user.
[0090] Considering that in the actual application scenario, there are some similar categories, and there may also be associations between different categories. Therefore, when constructing the heterogeneous graph, such category nodes are connected by additional extended edges to further improve the learning effect of the model, so that the item can obtain useful information from more categories and alleviate the problem of a small number of overlapping users. Specifically, the present application measures the correlation between two category nodes through semantic similarity and co-occurrence patterns, and connects two nodes with strong correlation with extended edges. That is, in the embodiments of the present application, the correlation score between attribute information is determined based on semantic similarity and co-occurrence patterns. In the actual application process, it can also be determined based on only one of semantic similarity and co-occurrence patterns, or other types of similarity judgment results can also be referred to for determination, which is not specifically limited herein.
[0091] In most real datasets, there are some categories that are semantically similar but not exactly the same, such as "fantasy movies" and "magic movies". Due to the limitations during data collection, items that should belong to the same category may not be correctly recorded. To solve this problem, the present application uses a pre-trained BERT model for semantic encoding, calculates the similarity between any two categories, and connects those categories with high similarity. The present application uses cosine similarity as the measure of semantic similarity, and its definition is shown in the following formula (1):
[0092]
[0093] Among them, sim(c i .c j ) represents the semantic relevance between c i and category c j . represents the word embedding vector of category c i , which is initialized by a pre-trained BERT model. Similarly, it will not be elaborated here. represents 's transpose. On the other hand, in actual application scenarios, there are certain dependencies between different categories, and some categories often appear together with another category. For example, "thriller movies" often appear together with "suspense movies", indicating a strong connection between them. To further explore and capture these important dependencies, this application defines the relevance between them by mining the co-occurrence patterns of categories in the data. Specifically, this application uses the conditional probability P ij =P(c j |c i ) to simulate the dependency relationship between categories, which represents the probability that category c i appears when category c j appears. This application uses N i to represent the number of times c i appears in the dataset, and uses M ij to represent the number of times c i and c i co-occur. The conditional probability can be calculated according to the following formula (2):
[0094]
[0095] In an application scenario, the relevance score between two categories is determined according to the above semantic similarity and co-occurrence probability. Specifically, it is decided whether to associate these two categories according to the semantic similarity and co-occurrence probability between category c i and category c j , as shown in the following formula (3):
[0096]
[0097] Among them, τ 1 and τ 2 are two set constants used to control the difficulty of edge expansion. δ ij is the relevance score. When δ ij =1, this application constructs an extended edge between category c i and category c j .
[0098] When the meta - path passes through a category node, the present application allows it to connect to other category nodes through some extended edges. Through edge extension, the present application can further explore the important dependencies between categories, enabling item nodes to find their neighbor nodes through more useful meta - paths. On the other hand, through extended edges, the present application can allow more categories to be associated with each other. In addition, constructing more category bridges also helps to alleviate the problem of a small number of overlapping users.
[0099] Furthermore, based on the meta - path, a set of neighbor nodes corresponding to the node is determined. Given a starting node i and a type of meta - path, the neighbors connected by the node i through the meta - path can be defined as a set of all end nodes (i.e., nodes of the same type) connected by the node i through the meta - path For the same starting node, different sets of neighbor nodes will be obtained through different types of meta - paths. Since the number of neighbor nodes may be large, to improve the efficiency and performance of the model, the present application only selects the top K nodes (the most relevant) with the largest number of connection paths as the neighbor set for each type of meta - path. The specific value of K can be set and adjusted according to actual needs and is not specifically limited here.
[0100] In the present application, node aggregation is guided by the meta - path, and based on the above - mentioned set of neighbor nodes, the aggregated node embedding representations of the above - mentioned nodes based on each type of meta - path are respectively determined, where the above - mentioned aggregated node embedding representations correspond one - to - one with the above - mentioned set of neighbor nodes, that is, for a type of meta - path, an aggregated node embedding representation corresponding to the node is aggregated. In the embodiments of the present application, for each node, two types of meta - paths are designed. Therefore, a node corresponds to two aggregated node embedding representations.
[0101] By constructing the meta - path, node i can identify nodes of the same type associated with it. The goal of the present application is to perform information propagation between node i and its set of neighbor nodes, enabling it to collect richer context information and achieve knowledge transfer between different domains. Since different nodes in the set of neighbor nodes have different impacts on node i, the present application uses an attention aggregation method to aggregate the information of these nodes, as shown in the following formulas (4) and (5):
[0102]
[0103] Among them, is the set of neighbor nodes connected by node i through the meta - path h k is the representation vector of node k, and a k is the assignment to h kThe weight represents the importance of node k to the target node i. σ(·) is the sigmoid activation function. is the aggregated node embedding representation determined by node i based on the meta-path represents the transposed vector of h i , T represents the transpose symbol, and h i is the representation vector of node i, and h k′ represents the representation vector of node k′. It should be noted that the value of a k is within the range of [0, 1].
[0104] In this way, the attention-based aggregation method allows the model to dynamically adjust its contribution to information aggregation according to the importance of each neighbor node. This method not only enhances the model's understanding of the complex relationships between nodes but also improves the performance of cross-domain recommendation because it can more effectively utilize information from different domains. In this way, each node can update its representation according to its association strength with neighbor nodes, thereby capturing cross-domain commonalities while maintaining domain-specific features.
[0105] Furthermore, the aggregated node embedding representations obtained from different neighbor node sets based on the same node are used as positive sample pairs, and the aggregated node embedding representations corresponding to different nodes are used as negative sample pairs. According to the similarity between the above positive sample pairs and the similarity between the above negative sample pairs, the above contrast loss is determined, thereby performing contrast learning based on the meta-path.
[0106] Specifically, at the item, user, and category levels, this application adopts two different perspectives and designs two different meta-paths to explore and aggregate its neighbor nodes. To jointly learn complementary information from different neighbor sets, this application applies a contrast learning mechanism to the node embeddings aggregated by two different meta-paths. This application constructs a contrast learning task to maximize the mutual information between positive samples while minimizing the consistency between negative samples.
[0107] It should be noted that the model learning process in the embodiments of this application is only applied during the model training process. After training, the model can be directly used for prediction and recommendation without performing the relevant training process.
[0108] Specifically, this application takes the aggregated node embedding representations of the same node i (i.e., and ) obtained through two different meta-paths (which belong to the same type level) as positive sample pairs. Then, the representations of different nodes (i.e., and ) are used as and And pairs where i is not equal to j are regarded as negative sample pairs, and the standard binary cross-entropy form loss of InfoNce is used for optimization. The loss function can be shown as the following formula (6):
[0109]
[0110] Where represents the contrastive loss. σ(·) is the sigmoid function, and sim(·) is used to measure the similarity between two node representations, which corresponds to the dot product operation here. For each node at the item, user, and category levels, the present application calculates its corresponding contrastive loss.
[0111] Step S300: Input the training samples in the above training sample set into the above cross-domain sequential recommendation model to trigger the above cross-domain sequential recommendation model to determine the predicted interaction scores of the above user for the items in each of the above domains according to each of the above training samples, and determine the recommendation losses corresponding to each of the above domains according to each of the above predicted interaction scores.
[0112] Specifically, the above inputting the training samples in the above training sample set into the above cross-domain sequential recommendation model to trigger the above cross-domain sequential recommendation model to determine the predicted interaction scores of the above user for the items in each of the above domains according to each of the above training samples, and determine the recommendation losses corresponding to each of the above domains according to each of the above predicted interaction scores includes:
[0113] Input the training samples in the above training sample set into the above cross-domain sequential recommendation model;
[0114] Through the above cross-domain sequential recommendation model, obtain the user node corresponding to the user in the above heterogeneous graph in the above training sample, and perform average pooling processing on the aggregated node embedding representations of the above user node based on each type of meta-path to obtain the average node embedding representation corresponding to the above user node;
[0115] For each domain, determine the sequential preference representation of the above user in the above domain according to the above training samples through the above cross-domain sequential recommendation model;
[0116] According to the average node embedding representation corresponding to the above user node and the sequential preference representation corresponding to the above user in each domain, determine the comprehensive preference representation corresponding to the above user in each of the above domains;
[0117] For each domain, determine the predicted interaction scores of the above user for the items in the above domain according to the comprehensive preference representation corresponding to the above user in the above domain, and determine the recommendation loss corresponding to the above domain according to each of the above predicted interaction scores.
[0118] In the embodiments of the present application, heterogeneous graph embedding aggregation is first performed for item-based sequential preference learning. Specifically, by aggregating nodes at the same level through two different meta-paths, two different representations will be obtained, and these representations contain diverse information. To obtain appropriate node representations, the present application uses the method of mean pooling to aggregate them, as shown in the following formula (7):
[0119]
[0120] where h i can be the average node embedding representation corresponding to nodes at any level of items, users, or categories, and represent two different meta-path types corresponding to node i.
[0121] In the embodiments of the present application, a multi-head attention module is set in the cross-domain sequential recommendation model. To capture the dynamic preferences of users and the sequential dependencies between items, the present application uses a self-attention module as the encoder for the item sequence, where the encoding is used as a feature processor to extract feature information in the item sequence. For the sake of simplicity in description, the present application takes the sequence of users from domain A as an example below. In the actual processing process, the same processing is performed for the sequence of users from domain B, which will not be elaborated here.
[0122] To consider the position information of previous items, a learnable position embedding vector will be added to the embedding vector of the sequence in domain A . Then, the present application can obtain the input with position information It should be noted that the position embedding vector is used to represent and learn the position information in the sequence. The position embedding vector is first randomly initialized to determine the initial value and then learned through model training, that is, the position embedding vector is a parameter that needs to be learned during the model training process. In the embodiments of the present application, the position vector is directly added to the item vector to obtain the item representation with position information, that is, an embedding vector of the same dimension, as shown in the following formula (8):
[0123]
[0124] where L is the length of the sequence, which can be set and adjusted according to actual needs and will not be specifically limited here.
[0125] Specifically, as shown in the upper half of the category-aware sequential preference learning part in Figure 2 , the present application uses the position-aware sequence X of domain A AInput into multiple stacked self-attention blocks (SABs). Ignoring the residual network and normalization layer, each SAB can be regarded as a self-attention layer SAL followed by a feed-forward network FFL, and its processing process is as shown in the following formulas (9) to (11):
[0126] SAB(X) = FFL(SAL(X)) (9);
[0127]
[0128] FFL(X′) = ReLU(X′W 1 + b 1 )W 2 + b 2 (11);
[0129] where Q = XW Q , K = XW K , V = XW V , are the projection matrices of query, key, and value respectively, and △ is a causal mask used to ensure that only the first t items can be considered when predicting the (t + 1)-th item. and are the learnable weight matrices and biases of the two-layer feed-forward network respectively. SAB(X) represents the data obtained after the self-attention block processes the sequence X. It should be noted that the initial values of the above parameters are determined according to the results of random initialization, and during the model training process, they are updated through backpropagation of gradients.
[0130] The role of the self-attention block is to extract dynamically changing key features from a sequence. Stacked self-attention blocks (SABs) usually help the model extract more complex sequence patterns. Finally, this application takes the final output vector of the top SAB as the item-based sequence preference representation of the user at time step t in domain A.
[0131] Furthermore, in the embodiments of this application, category-based sequence preference learning is also performed based on the item-category attention layer. User dynamic preferences can be reflected not only from the item sequences they interact with but also from the transition patterns between categories in the sequences. Considering that an item usually belongs to multiple categories, most traditional methods cannot be directly applied to model such sequences. To solve this problem, this application designs an item-category attention layer to measure the association between an item and its corresponding category and aggregates multiple category features into a comprehensive category representation.
[0132] Specifically, for the interaction sequence S A = {A 1 , A2 , …, A L}, where in the i-th interaction, this application has This application embeds the interactive item into the representation as the query in the attention network, and embeds all category representations of the item as the key and value, as shown in the following formulas (12) and (13):
[0133]
[0134] where a j is the weight assigned to , representing the importance of category j in describing the attributes of item i, and σ(·) is the sigmoid activation function. Finally, this application uses as the final category representation of the item .
[0135] Furthermore, it also learns the category-based sequence preference. After obtaining the user's category representation sequence , this application inputs it into the attention module to explore the transfer pattern of categories in the user's sequential behavior, which can be considered as reflecting the user's coarse-grained preference.
[0136] Finally, this application uses the output at the top of the SAB module as the user's category-based sequence preference representation at time step t in domain A. Among them, the output is actually a vector used to characterize the user's preference. Coarse-grained preference refers to a relatively broad and general description of the user's preference. For example, a user may be labeled as "likes science fiction movies", which is a coarse-grained preference. It does not distinguish which type of science fiction movies are liked (such as space travel, time travel, etc.).
[0137] Furthermore, in the embodiments of this application, cross-domain sequence preference learning is performed. Considering that the user's interaction in a certain domain may affect their interaction in the next moment in other domains, this means that there is also a certain conversion pattern between different domains. Therefore, this application hopes to consider the user preferences in both the target domain and the source domain simultaneously to achieve cross-domain knowledge transfer. The source domain and the target domain are both scenarios where the user has interacted, and the difference is that the target domain here refers to the scenario where prediction needs to be made. For example, a user has interacted in both the "book" and "movie" scenarios, and the goal in the next moment is to predict which movie he will watch in the "movie" scenario.
[0138] Specifically, as Figure 2As shown in the second half of this part of category-aware sequential preference learning, this application takes the item sequence of the user in domain B and inputs it into the attention module SAB to obtain the item-based sequential preference of the user in domain B Similar to domain A, this application also takes the interaction sequence S of the user in domain B B ={B 1 ,B 2 ,…,B L} and inputs it into the item-category attention layer to obtain the category representation sequence in domain B and finally captures the category-based sequential preference of the user in domain B Note that t′ is the most recent time step when the user interacts with items in domain B, corresponding to the time before the actual moment of time step t in domain A. This is to ensure the causal relationship of user behavior from the source domain to the target domain.
[0139] It should be noted that the model of this application can be simply extended to the multi-domain version when implementing cross-domain heterogeneous graph construction and category-aware sequential preference learning. This is different from most previous methods, which only use a single source domain to assist target domain recommendation. The HGTL (Heterogeneous Graph Transfer Learning) model of this application can achieve knowledge transfer across multiple domains and improve the performance of multiple domains simultaneously.
[0140] In the prediction layer of the model, the goal of this application is to aggregate information from different domains. To alleviate the problem of inconsistent distributions between the two domains, the idea of domain adaptation is borrowed, and a cross-domain transfer unit is adopted to map the user's preference from the source domain to the feature space of the target domain.
[0141] Specifically, taking domain A as the target domain, this application concatenates the item-based sequential preference and the category-based sequential preference in domain B. Then, the concatenated result is input into a multi-layer perceptron (MLP) to obtain the final representation of the user's sequential preference in domain B, as shown in the following formula (14):
[0142]
[0143] where, and are learnable parameters in the cross-domain transfer unit from domain B to domain A.
[0144] Next, this application aggregates the item-based sequential preference and the category-based sequential preference of the user from domain A and the sequential preference and the user node representation u learned in the heterogeneous graph to obtain the final representation of user preferences, as shown in the following formula (15):
[0145]
[0146] where and are learnable parameters. Finally, the predicted interaction score of the next recommended item i in domain A is shown in the following formula (16):
[0147]
[0148] This application uses the binary cross-entropy loss function as the recommendation loss for domain A, as shown in the following formula (17):
[0149]
[0150] where is the sampled negative sample, that is, the item that has not interacted with user u in domain A. σ(·) is the sigmoid function. When v t+1 is not a padding item, the indicator function δ(v t+1 ) = 1, otherwise it is 0. The base of the logarithmic function log can be taken as 2.
[0151] Similarly, this application can migrate the sequential preferences of users from domain A to domain B, and then calculate the recommendation loss of domain B, as shown in the following formula (18):
[0152]
[0153] In this way, the recommendation losses corresponding to domain A and domain B can be obtained respectively.
[0154] Step S400, according to the above comparison loss and the recommendation losses corresponding to each of the above domains, adjust the parameters of the above cross-domain sequential recommendation model to be trained, and return to the step of inputting the above historical interaction data into the cross-domain sequential recommendation model to be trained until the preset training termination condition is met, and obtain the trained cross-domain sequential recommendation model.
[0155] Specifically, this application combines the recommendation losses of the two domains and the comparison loss to obtain the final training loss of the model, as shown in the following formula (19):
[0156]
[0157] Among them, λ is a hyperparameter used to control the weight of the contrastive learning task. Based on the above training loss, the parameters of the above cross-domain sequential recommendation model to be trained are adjusted, and the step of inputting the above historical interaction data into the cross-domain sequential recommendation model to be trained is returned until a preset training termination condition is met, and a trained cross-domain sequential recommendation model is obtained. Among them, the above training termination condition can be set and adjusted according to actual needs. For example, it can be set that the number of iterations reaches a preset maximum number of iterations and / or the training loss is less than a preset loss threshold, which is not specifically limited here.
[0158] As can be seen from the above, in the cross-domain sequential recommendation model training method provided by the embodiments of the present application, when training the model, it does not directly obtain the sequence composed of the historical interaction items of the user in each domain as the training sample for training. Instead, historical interaction data and a training sample set are obtained for training, and the historical interaction data and the training sample set not only include the items interacted by the user and the corresponding interaction behavior information, but also include the attribute information of the items. Items in different domains may have the same item attribute information. In the present application, item attribute information is introduced, and a heterogeneous graph is constructed to assist the training process. Based on the heterogeneous graph, nodes in different domains can be associated. In this way, the association between items in different domains is considered, so that the item conversion mode of the user in different domain sequences is considered, and the potential association information between different domains can be fully utilized, which is beneficial to improving the effect of model training, beneficial to improving the prediction accuracy of the trained model, and thus beneficial to improving the accuracy when using the trained model for information recommendation.
[0159] As Figure 3 shown in, corresponding to the above cross-domain sequential recommendation model training method, the embodiments of the present application further provide a cross-domain sequential recommendation model training system. The above cross-domain sequential recommendation model training system includes:
[0160] A training data acquisition module 310, configured to acquire historical interaction data and a training sample set, where the historical interaction data includes items corresponding to each domain, the attribute information of the items, and the interaction behavior information of each user for the items, and the training sample set includes a plurality of training samples, and each of the training samples includes an interaction sequence of a user in each of the domains, and the interaction sequence includes the items interacted by the user and the attribute information of the items;
[0161] A contrastive loss determination module 320, configured to input the above historical interaction data into a cross - domain sequential recommendation model to be trained, so as to trigger the cross - domain sequential recommendation model to be trained to construct a heterogeneous graph according to the historical interaction data, and determine a contrastive loss according to the heterogeneous graph, where the nodes in the heterogeneous graph are determined according to the corresponding users, items, and attribute information of the items in the historical interaction data, and the edges in the heterogeneous graph are determined according to the interaction behavior information and the corresponding relationship between the items and the attribute information;
[0162] A recommendation loss determination module 330, configured to input the training samples in the above training sample set into the cross - domain sequential recommendation model to be trained, so as to trigger the cross - domain sequential recommendation model to be trained to determine the predicted interaction scores of the user for the items in each of the above domains according to each of the training samples, and determine the recommendation losses corresponding to each of the above domains according to each of the predicted interaction scores;
[0163] A training control module 340, configured to adjust the parameters of the cross - domain sequential recommendation model to be trained according to the contrastive loss and the recommendation losses corresponding to each of the above domains, and return to execute the step of inputting the above historical interaction data into the cross - domain sequential recommendation model to be trained until a preset training termination condition is met, and obtain a trained cross - domain sequential recommendation model.
[0164] In this way, in the present application, item attribute information is introduced, and a heterogeneous graph is constructed to assist the training process. Based on the heterogeneous graph, nodes in different domains can be associated. In this way, the association of items between different domains is considered, so that the item conversion pattern of the user in different domain sequences is considered, and the potential association information between different domains can be fully utilized, which is beneficial to improving the effect of model training, beneficial to improving the prediction accuracy of the trained model, and thus beneficial to improving the accuracy when using the trained model for information recommendation.
[0165] It should be noted that the specific structures and implementation manners of the above cross - domain sequential recommendation model training system and its various modules or units can refer to the corresponding descriptions in the above method embodiments, and will not be elaborated here.
[0166] It should be noted that the division method of each module of the above cross - domain sequential recommendation model training system is not unique, and is not specifically limited here either.
[0167] As Figure 4 shown, corresponding to the above cross - domain sequential recommendation model training method, an embodiment of the present application further provides a cross - domain sequential recommendation method, and the cross - domain sequential recommendation method includes:
[0168] Step A100: Obtain the historical interaction sequences of the user to be recommended in each field. The above historical interaction sequences include the items interacted with by the user to be recommended and the attribute information of the above items.
[0169] Step A200: Input the above historical interaction sequences into the trained cross - domain sequence recommendation model to trigger the trained cross - domain sequence recommendation model to determine the predicted interaction scores of the user to be recommended for the items in each of the above fields according to each of the above historical interaction sequences, and determine the target recommended items from the above items according to each of the above predicted interaction scores. The above trained cross - domain sequence recommendation model is obtained by training according to any of the above cross - domain sequence recommendation model training methods.
[0170] Among them, the user to be recommended is the user who needs information recommendation. In the embodiments of the present application, the historical data of the user to be recommended is also used as part of the training data to improve the accuracy during prediction and recommendation. It should be noted that when performing cross - domain sequence recommendation, the form of the historical interaction sequences used and the processing method of the model for the historical interaction sequences are the same as the form of the training samples and the processing method of the model for the training samples during model training. The specific processing process can refer to the description of the model training process and will not be elaborated here.
[0171] In the embodiments of the present application, the predicted interaction scores of the items in each field are determined by the trained cross - domain sequence recommendation model, and the item with the highest predicted interaction score in each field (or the target field) is selected as the item that the user may interact with next (i.e., the target recommended item), and the above target recommended item is recommended to the user to improve the user experience.
[0172] In this way, in the embodiments of the present application, the trained cross - domain sequence recommendation model is used for information recommendation. When the model is trained, it does not directly obtain the sequences composed of the historical interaction items of the user in each field as training samples for training. Instead, it obtains historical interaction data and a training sample set for training, and the historical interaction data and the training sample set not only include the items interacted with by the user and the corresponding interaction behavior information, but also include the attribute information of the items. Items in different fields may have the same item attribute information. In the present application, the item attribute information is introduced and a heterogeneous graph is constructed to assist the training process. Based on the heterogeneous graph, nodes in different fields can be associated. In this way, the association between items in different fields is considered, thus considering the item conversion mode of the user in different field sequences, being able to make full use of the potential association information between different fields, being beneficial to improving the effect of model training, being beneficial to improving the prediction accuracy of the trained model, and thus being beneficial to improving the accuracy when using the trained model for information recommendation.
[0173] It should be noted that the specific training process of the trained cross-domain sequential recommendation model can be referred to the above specific description and will not be elaborated here.
[0174] As Figure 5 shown in
[0175] a historical data acquisition module 510 that acquires the historical interaction sequences of the user to be recommended in each domain, where the historical interaction sequences include the items interacted by the user to be recommended and the attribute information of the items;
[0176] an item recommendation module 520 that inputs the historical interaction sequences into the trained cross-domain sequential recommendation model to trigger the trained cross-domain sequential recommendation model to determine the predicted interaction scores of the user to be recommended for the items in each domain according to each historical interaction sequence, and determines the target recommended items from the items according to each predicted interaction score, where the trained cross-domain sequential recommendation model is trained according to any one of the cross-domain sequential recommendation model training methods.
[0177] Specifically, the predicted interaction scores of the items in each domain are determined by the trained cross-domain sequential recommendation model, and the items with the highest predicted interaction scores in each domain (or the target domain) are selected as the items that the user may interact with next time (i.e., the target recommended items), and the target recommended items are recommended to the user to improve the user experience.
[0178] When the model used in this application is pre-trained, the item attribute information is introduced, and a heterogeneous graph is constructed to assist the training process. Based on the heterogeneous graph, the nodes in different domains can be associated. In this way, the association between items in different domains is considered, so the item conversion pattern of the user in different domain sequences is considered, and the potential association information between different domains can be fully utilized, which is beneficial to improving the effect of model training, beneficial to improving the prediction accuracy of the trained model, and thus beneficial to improving the accuracy of information recommendation when using the trained model.
[0179] In the embodiments of this application, the effect of information recommendation is also verified based on a specific application scenario. Specifically, comment data is collected on a preset e-commerce platform, which contains the category information corresponding to the overlapping users and items in multiple domains. This application selects three datasets of different categories, namely "Movie", "CD" and "Book" from the data to evaluate the model. The following preprocessing is performed on the datasets:
[0180] Consider comments, clicks, and purchase behaviors as positive feedback (i.e., users interact with items), and use timestamps to determine the order of interactions. Only retain users and items with no less than five relevant interactions, and discard duplicate user-item pairs. Only retain user sequences that have interacted in all three domains. This application adopts the "leave-one-out" evaluation method, dividing each sequence into three parts, i.e., the last interaction of the user is used for testing, the penultimate interaction is used for verification, and the remaining interactions are used for training.
[0181] To evaluate the recommendation performance of all models, this application adopts two common evaluation metrics for ranking problems, namely Hit Rate (HR@k) and Normalized Discounted Cumulative Gain (NDCG@k). Specifically, @k represents the value of this score when recommending k items. HR@10 refers to the proportion of real items that appear in the top 10 of the recommendation list, while NDCG@10 is more sensitive to the exact ranking position of items in the list.
[0182] To verify the effectiveness of the HGTL of this application, this application compares them with fifteen competitive baseline methods, including five sequential recommendation methods (i.e., GRU4Rec, Caser, GCSAN, SASRec, and CL4SRec), seven cross-domain sequential recommendation methods (i.e., DA-GCN, CD-SASRec, Tri-CDR, RecGURU, C2DSR, MGCL, and TJAPL), and three attribute-aware sequential recommendation methods (i.e., NOVA, DIF-SR). The comparison results are shown in Table 1 below.
[0183] Table 1
[0184]
[0185]
[0186] Table 1 is a schematic table showing the recommendation effects of the method corresponding to the model trained based on the embodiments of the present application (i.e., the HGTL method) and the baseline methods on three datasets. As shown in Table 1, the proposed HGTL in the present application significantly outperforms all baseline methods on all three datasets, with an average increase of 14.58% in NDCG@10 and an average increase of 12.52% in HR@10, exceeding the strongest baseline. This indicates that HGTL can effectively utilize data and category information from multiple domains by constructing a cross-domain heterogeneous graph and explore cross-domain transformation patterns through knowledge transfer and attention modules. In addition, among the same group of methods, attention-based methods tend to achieve the best results, which proves the effectiveness of Transformer in capturing sequence patterns. Moreover, cross-domain sequence methods and attribute-aware sequence methods generally perform better than traditional sequence methods. This verifies the importance of introducing cross-domain data and attribute information and also demonstrates the potential of their combination. Further, the multi-domain version of HGTL (i.e., HGTL-Multi) achieves the best results on the "Movie" dataset and the "Book" dataset, while on the "CD" dataset, the HGTL of the present application performs better with the assistance of single-domain data.
[0187] To verify the effect of the model of the present application in scenarios with different user overlap ratios, the present application adjusts the overlapping user ratios to 0%, 20%, 40%, 60% and 100% respectively. Specifically, the present application retains all the complete training data of all users in the target domain and randomly selects the corresponding number of users according to the overlap ratio, and only retains the interactions of these users in the source domain and the target domain. For single-domain recommendation methods and attribute-aware single-domain recommendation methods, changing the overlapping user ratio does not affect performance because these models only utilize single-domain data. However, for most previous cross-domain recommendation methods, reducing the overlapping user ratio will result in fewer bridges for knowledge transfer, which may lead to a decline in recommendation effects.
[0188] Table 2
[0189]
[0190]
[0191] Table 2 is a schematic table showing the recommendation effects of the method corresponding to the model trained based on the embodiments of the present application (i.e., the HGTL method) and the baseline method on three datasets under different overlapping user ratios. As shown in Table 2, when the overlapping user ratio is low, traditional cross-domain sequential recommendation methods perform poorly and are even worse than single-domain recommendation methods in some cases (especially when users are completely non-overlapping), because they rely on overlapping users as a bridge to transfer knowledge. In contrast, the model of the present application achieves the best results in all cases because it can utilize the information of non-overlapping users through categories, which demonstrates the robustness of the model of the present application in terms of the overlapping user ratio.
[0192] Thus, in the embodiments of the present application, category information is introduced into cross-domain sequential recommendation, and a knowledge transfer learning algorithm based on a heterogeneous graph is proposed. Specifically, the present application associates nodes in different domains by constructing a cross-domain heterogeneous graph, and designs a node representation learning module guided by a meta-path for cross-domain knowledge transfer. In addition, the present application enhances the correlation between different domains through an edge expansion module. Then, a category-aware sequential preference learning module is used to capture item-based and category-based preferences in each domain. It should be noted that the present application can be applied to multi-domain scenarios, which is more adaptable and flexible in practical applications. Extensive empirical studies on three real-world datasets show that the algorithm proposed in the present application significantly outperforms various baseline methods in all cases.
[0193] Specifically, the solution of the present application introduces item category information based on the original research problem, because they can reflect the preferences of users within the same domain and between different domains over a period of time. A cross-domain heterogeneous graph is constructed, and different domain item nodes can be associated with each other by designing a meta-path, so as to achieve rich knowledge transfer between different domains. It is worth mentioning that in traditional cross-domain recommendation, usually only overlapping users are relied on as a bridge to connect items in different domains, while in the constructed heterogeneous graph, items in different domains can also be associated through the same category, which makes the effect of the model no longer severely dependent on the number of overlapping users. A sequential preference learning algorithm based on items and categories is designed to capture the fine-grained (realized by item-based sequential preference learning during training) and coarse-grained preferences of users respectively. The association between an item and its corresponding category is measured through an item-category attention layer, and multiple category features are aggregated into a comprehensive category representation.
[0194] It should be noted that the heterogeneous graph knowledge transfer method proposed in the present application is not limited to the category-aware cross-domain sequential recommendation scenario. For example, using only data from a single domain can become a sequential recommendation algorithm.
[0195] Based on the above embodiments, the present application further provides an intelligent terminal, and its principle block diagram can be as Figure 6 shown. The above intelligent terminal includes a processor, a memory, a network interface, and a display screen connected through a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements the steps of any of the above cross-domain sequence recommendation model training methods, or when the computer program is executed by the processor, it implements the steps of any of the above cross-domain sequence recommendation methods. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen.
[0196] Those skilled in the art can understand that Figure 6 the principle block diagram shown in
[0197] is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the intelligent terminal to which the solution of the present application is applied. The specific intelligent terminal may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0198] It should be understood that the sequence numbers of the above steps do not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0199] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the above device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working process of the units and modules in the above device can refer to the corresponding process in the foregoing method embodiments and will not be elaborated here.
[0200] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0201] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0202] In the embodiments provided in this application, it should be understood that the disclosed system / terminal device and method can be implemented in other ways. For example, the system / terminal device embodiments described above are only illustrative. For example, the above-mentioned division of modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0203] If the above integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above embodiment methods of this application, it can also be completed by a computer program instructing relevant hardware. The above computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above various method embodiments can be implemented. Among them, the above computer program includes computer program code, and the above computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The above computer-readable medium can include: any entity or device capable of carrying the above computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, and software distribution medium, etc. It should be noted that the content included in the above computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
[0204] The above embodiments are only used to illustrate the technical solutions of this application, rather than to limit it; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not deviate from the spirit and scope of the technical solutions of the various embodiments of this application, and should all be included in the protection scope of this application.
Claims
1. A cross-domain sequence recommendation model training method, characterized in that: The method comprises: Acquire historical interaction data and a training sample set, wherein the historical interaction data includes items corresponding to each field, attribute information of the items, and interaction behavior information of each user with respect to the items, and the training sample set includes a plurality of training samples, each of which includes an interaction sequence of a user in each field, and the interaction sequence includes items interacted by the user and attribute information of the items; Inputting the historical interaction data into a cross-domain sequence recommendation model to be trained to trigger the cross-domain sequence recommendation model to be trained to construct a heterogeneous graph according to the historical interaction data, and determining the contrast loss according to the heterogeneous graph, wherein the nodes in the heterogeneous graph are determined according to the corresponding users, items and attribute information of the items in the historical interaction data, and the edges in the heterogeneous graph are determined according to the interaction behavior information and the corresponding relationship between the items and the attribute information; Inputting the training samples in the training sample set into the cross-domain sequence recommendation model to be trained, so as to trigger the cross-domain sequence recommendation model to be trained to determine the predicted interaction score of the user for the items in each of the fields according to each of the training samples, and to determine the recommendation loss corresponding to each of the fields according to each of the predicted interaction scores; According to the contrast loss and the recommendation loss corresponding to each of the fields, the parameters of the cross-domain sequence recommendation model to be trained are adjusted, and the step of inputting the historical interaction data into the cross-domain sequence recommendation model to be trained is returned to execute until a preset training termination condition is met, so as to obtain a trained cross-domain sequence recommendation model.
2. The cross-domain sequence recommendation model training method according to claim 1, characterized in that: The attribute information includes at least one of category, brand and price.
3. The cross-domain sequence recommendation model training method according to claim 1, characterized in that: The inputting the historical interaction data into the cross-domain sequence recommendation model to be trained to trigger the cross-domain sequence recommendation model to be trained to construct a heterogeneous graph according to the historical interaction data, and determining the contrast loss according to the heterogeneous graph includes: Inputting the historical interaction data into a cross-domain sequence recommendation model to be trained; By using the cross-domain sequence recommendation model, constructing nodes according to the users, items and attribute information of the items in the historical interaction data; Constructing initial edges between the nodes according to the interaction behavior information and the corresponding relationship between the item and the attribute information; For the nodes corresponding to the attribute information, determining the correlation scores between the respective attribute information, and constructing the extended edges between the nodes corresponding to the attribute information according to the correlation scores; Constructing the heterogeneous graph according to the nodes, the initial edges, and the extended edges; The contrast loss is determined according to the heterogeneous graph by using the cross-domain sequence recommendation model to be trained.
4. The cross-domain sequence recommendation model training method according to claim 1, characterized in that: The determining the contrast loss according to the heterogeneous graph includes: For each node in the heterogeneous graph, according to a preset path type and a preset path determination rule, the cross-domain sequence recommendation model to be trained is used to respectively determine multiple types of meta-paths corresponding to the node, and respectively obtain neighbor node sets corresponding to each type of meta-path; Determine, according to the neighbor node set, respectively, an aggregate node embedding representation of the node based on each type of meta-path, wherein the aggregate node embedding representation corresponds one-to-one to the neighbor node set; The aggregated node embedding representation obtained based on different neighbor node sets of the same node is used as a positive sample pair, and the aggregated node embedding representation corresponding to different nodes is used as a negative sample pair. The contrast loss is determined according to the similarity between the positive sample pairs and the similarity between the negative sample pairs.
5. The cross-domain sequence recommendation model training method according to claim 4, characterized in that: Inputting the training samples in the training sample set into the cross-domain sequence recommendation model to be trained to trigger the cross-domain sequence recommendation model to be trained to determine the predicted interaction score of the user for the items in each of the fields according to each of the training samples, and determining the recommendation loss corresponding to each of the fields according to each of the predicted interaction scores, including: Inputting the training samples in the training sample set into the cross-domain sequence recommendation model to be trained; Obtaining, by means of the cross-domain sequence recommendation model, user nodes corresponding to users in the training sample in the heterogeneous graph, performing average pooling processing on aggregated node embedding representations of the user nodes based on various types of meta-paths, and obtaining average node embedding representations corresponding to the user nodes; For each domain, according to the training samples, determining the sequence preference representation of the user in the domain by using the cross-domain sequence recommendation model; Determine the comprehensive preference representation of the user in each of the fields according to the average node embedding representation corresponding to the user node and the sequence preference representation of the user in each field; For each field, the predicted interaction score of the user for the items in the field is determined according to the comprehensive preference expression of the user in the field, and the recommendation loss corresponding to the field is determined according to each predicted interaction score.
6. A cross-domain sequence recommendation model training system, characterized in that: The system comprises: A training data acquisition module, used to acquire historical interaction data and a training sample set, wherein the historical interaction data includes items corresponding to each field, attribute information of the items, and interaction behavior information of each user with respect to the items, and the training sample set includes a plurality of training samples, each of which includes an interaction sequence of a user in each field, and the interaction sequence includes items interacted by the user and attribute information of the items; A contrast loss determination module, used for inputting the historical interaction data into a cross-domain sequence recommendation model to be trained, so as to trigger the cross-domain sequence recommendation model to be trained to construct a heterogeneous graph according to the historical interaction data, and determine the contrast loss according to the heterogeneous graph, wherein the nodes in the heterogeneous graph are determined according to the corresponding users, items and attribute information of the items in the historical interaction data, and the edges in the heterogeneous graph are determined according to the interaction behavior information and the corresponding relationship between the items and the attribute information; a recommendation loss determination module, configured to input the training samples in the training sample set into the cross-domain sequence recommendation model to be trained, so as to trigger the cross-domain sequence recommendation model to be trained to determine the predicted interaction score of the user for the items in each of the fields according to each of the training samples, and to determine the recommendation loss corresponding to each of the fields according to each of the predicted interaction scores; A training control module is used to adjust the parameters of the cross-domain sequence recommendation model to be trained according to the contrast loss and the recommendation loss corresponding to each of the fields, and return to execute the step of inputting the historical interaction data into the cross-domain sequence recommendation model to be trained until a preset training termination condition is met, thereby obtaining a trained cross-domain sequence recommendation model.
7. A cross-domain sequence recommendation method, characterized in that: The method comprises: Acquire the historical interaction sequence of the user to be recommended in each field, wherein the historical interaction sequence includes items interacted by the user to be recommended and attribute information of the items; The historical interaction sequence is input into a trained cross-domain sequence recommendation model to trigger the trained cross-domain sequence recommendation model to determine the predicted interaction score of the to-be-recommended user for the items in each of the fields according to each of the historical interaction sequences, and to determine a target recommended item from the items according to each of the predicted interaction scores, wherein the trained cross-domain sequence recommendation model is trained according to the cross-domain sequence recommendation model training method according to any one of claims 1 to 5.
8. A cross-domain sequence recommendation system, characterized in that: The system comprises: A historical data acquisition module is used to acquire the historical interaction sequence of the user to be recommended in various fields, wherein the historical interaction sequence includes items interacted by the user to be recommended and attribute information of the items; An item recommendation module is used to input the historical interaction sequence into a trained cross-domain sequence recommendation model to trigger the trained cross-domain sequence recommendation model to determine the predicted interaction score of the to-be-recommended user for the items in each of the fields according to each of the historical interaction sequences, and to determine a target recommended item from the items according to each of the predicted interaction scores, wherein the trained cross-domain sequence recommendation model is trained according to the cross-domain sequence recommendation model training method according to any one of claims 1 to 5.
9. An intelligent terminal, characterized in that: The intelligent terminal includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the cross-domain sequence recommendation model training method according to any one of claims 1 to 5 are implemented, or when the computer program is executed by the processor, the steps of the cross-domain sequence recommendation method according to claim 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the cross-domain sequence recommendation model training method according to any one of claims 1 to 5 are implemented, or when the computer program is executed by the processor, the steps of the cross-domain sequence recommendation method according to claim 7 are implemented.