A cross-domain recommendation method and system based on graph prompts
By constructing a knowledge graph and designing graphical prompts, pre-training and fine-tuning the graph encoder, we address the problem of insufficient utilization of non-overlapping information in cross-domain recommendations, and improve the accuracy and generalization ability of the recommendation system, especially in cold start and data sparse conditions.
Patent Information
- Application Number
- CN202510230105.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-02-28
AI Technical Summary
Existing cross-domain recommendation methods rely too much on overlapping user or item information in the source and target domains, ignoring the potential of auxiliary information within the domain, resulting in insufficient recommendation accuracy and generalization ability, especially poor performance in cold start and data sparsity problems.
By constructing knowledge graphs of the source and target domains, pre-training the graph encoder and designing soft graphs and personalized graph prompts, the graph attention network and multi-layer multi-head attention mechanism are used to enhance the knowledge graph embedding vector, and fine-tuning is performed in combination with the contrastive learning loss function and the binary cross entropy loss function to achieve personalized recommendation.
It effectively utilizes non-overlapping information to improve the accuracy and generalization ability of cross-domain recommendations, especially significantly improving the accuracy of recommendations in cold start and data sparse conditions.
Smart Images

Figure CN120068930B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cross-domain recommendation technology, and more specifically, to a cross-domain recommendation method and system based on graph prompts. Background Art
[0002] Cross-domain recommendation technology is an effective method to improve the accuracy of recommendation systems by integrating information from multiple domains. It performs particularly well in cold start and data sparsity problems. When new users or new items lack sufficient historical data, cross-domain recommendation can achieve data migration with the help of user behavior information in other domains, thereby making up for the lack of data in the target domain. Specifically, cross-domain recommendation uses the overlapping information of users in the source domain (such as music platforms) and the target domain (such as movie platforms) to support recommendations in the target domain. However, most existing cross-domain recommendation methods rely too much on overlapping user or item information in the source and target domains, resulting in insufficient utilization of non-overlapping information, thereby limiting the accuracy and generalization ability of recommendations.
[0003] To address the above shortcomings, recent rapid graph learning algorithms have promoted the further development of cross-domain recommendation, enabling recommendation systems to more efficiently use source domain information to narrow the gap between pre-training tasks and downstream recommendation tasks. However, current graph-based cross-domain recommendation methods usually only focus on the user-item interaction graph, while ignoring the potential of auxiliary information in the domain (such as user interests, item categories, etc.). In this context, knowledge graphs, as a form of structured data, can provide more comprehensive auxiliary information for cross-domain recommendations by expressing entities and their relationships. Therefore, how to develop a knowledge-aware graph prompt adjustment method to accurately achieve the goal of cross-domain recommendation has become a technical problem that needs to be solved in this field. Summary of the Invention
[0004] To address the aforementioned technical issues, this paper proposes a cross-domain recommendation method and system based on graph cues. By constructing knowledge graphs for the source and target domains, a graph encoder is pre-trained on the source domain's knowledge graph. Furthermore, soft and personalized graph cues are designed to fine-tune the graph encoder in the target domain, enabling more accurate rating predictions in the target domain and significantly improving cross-domain recommendation performance.
[0005] The present invention provides a cross-domain recommendation method based on graph prompts, comprising the following steps:
[0006] Obtain the interaction data between the source domain and the target domain and perform data preprocessing, build the knowledge graphs of the source domain and the target domain, and use TransE to train the entity and relationship embedding representations of the knowledge graph to generate the knowledge graph embedding vector;
[0007] In the pre-training of the source domain graph encoder model, a graph attention network is used to encode the source domain knowledge graph. The multi-layer multi-head attention mechanism is used to enhance the expressiveness of the knowledge graph embedding vector and generate an enhanced entity embedding vector.
[0008] Design soft image prompts and personalized image prompts to fine-tune the graph encoder model in the target domain. The soft image prompts narrow the embedding space difference between the source and target domains by adding a learnable prompt vector to each entity in the target domain, and use a contrastive learning loss function for fine-tuning.
[0009] Based on the entity embedding vector of the user's neighborhood, a personalized hint vector is generated through a multi-layer perceptron. The user embedding is constructed by combining the enhanced entity embedding with the personalized graph hint vector. This is combined with the enhanced entity embedding vector of the target item to predict the user's rating of the item. The binary cross-entropy loss function is used to fine-tune the rating prediction to achieve personalized recommendations.
[0010] In this solution, we obtain the interaction data between the source domain and the target domain and perform data preprocessing, specifically:
[0011] Collect user, project, interaction, and comment data from the source and target domains, extract basic feature information about users and projects, and ensure consistent entity identification of users and projects across domains;
[0012] Construct feature representations of users and items based on interaction data, and use embedding alignment technology to unify the embedding spaces of the source and target domains;
[0013] The processed data is batch generated into formatted input that meets the preset requirements to achieve data standardization.
[0014] In this solution, we construct knowledge graphs of the source and target domains and use TransE to train the entity and relationship embedding representations of the knowledge graphs to generate knowledge graph embedding vectors. Specifically:
[0015] For a given source domain and target domain Extract entities from the source and target domains, extract interaction relationships from user-item rating data and comment data, use the interaction relationships to establish connections between entities, and construct a knowledge graph of the source domain based on the entities and the connections between them. and the knowledge graph of the target domain
[0016] The TransE algorithm is used to train the entity and relationship embeddings of the two knowledge graphs, initialize the vector representation of the entities and relationships, generate negative samples for each triple in the knowledge graph by replacing the head entity or the tail entity, use the L2 norm to define the distance function, and iterative training is performed with the goal of minimizing the distance function in positive samples and maximizing the distance function in negative samples to generate the corresponding knowledge graph embedding vector.
[0017] In this solution, during the pre-training of the source domain graph encoder model, a graph attention network is used to encode the source domain knowledge graph. The multi-layer multi-head attention mechanism is used to enhance the expressiveness of the knowledge graph embedding vector and generate an enhanced entity embedding vector. Specifically:
[0018] Build a graph encoder model based on the graph attention network, and transform the source domain The knowledge graph embedding vector set of the entities in the graph and the knowledge graph are used as the input of the graph encoder model, which consists of multiple layers of graph attention layers. In each attention layer, the attention weight is calculated by the attention head in the multi-head attention mechanism;
[0019] Based on the information of the attention weight aggregation entity and domain node, the hidden vector of each attention head is obtained, and the hidden vectors are spliced to generate the output features of the graph attention layer. The output features are calculated layer by layer, and the hidden vectors of the multi-head attention are averaged in the last layer of the graph attention layer to obtain the entity Enhanced entity embedding vector
[0020] In this solution, graph contrast learning is used to update the parameters of the graph encoder model. Specifically:
[0021] By using the data augmentation method, random noise is added to the entity feature vector in each layer of the graph attention to generate different entity representations. The eigenvector of The augmented noise representation vector is
[0022]
[0023] in, and is a random noise vector with the same dimension.
[0024] For entity collections Comparative Learning Loss Functions Using InfoNCE Contrastive learning is achieved by maximizing the positive consistency and minimizing the negative consistency. The InfoNCE contrastive learning loss function Expressed as:
[0025]
[0026] Where τ1 is the temperature hyperparameter, To contain entities batches, is the augmented noise representation vector.
[0027] In this solution, the soft image hinting narrows the embedding space difference between the source and target domains by adding a learnable hint vector to each entity in the target domain, and uses a contrastive learning loss function for fine-tuning, specifically:
[0028] Get the knowledge graph embedding vector set of entities in the target domain as Add a corresponding learnable soft image hint vector to each entity embedding vector to obtain the enhanced entity embedding vector set
[0029]
[0030] in, For entities Soft image tips vector, Entities in the target domain The knowledge graph embedding vector of , i = 1, 2…n, n is the total number of entities;
[0031] Leveraging enhanced entity embedding vector sets and knowledge graph Obtaining a set of enhanced entity embedding vectors through the graph encoder model
[0032]
[0033] where f * Indicates that the parameters of the graph encoder model f are frozen;
[0034] In the fine-tuning stage, the source domain and target domain The public entity set C in the soft image prompt is used to optimize the learnable parameters and use InfoNCE to compare the learning loss function. Maximize the consistency between the enhanced embedding vectors of the same entity in the source domain and the target domain, expressed as:
[0035]
[0036] Among them, τ2 is the temperature hyperparameter, To include the target domain entity A batch of An entity in the source domain.
[0037] In this solution, personalized graph hints are used to narrow the gap between the training objectives of the pre-trained graph model task and the downstream recommendation task. Specifically:
[0038] For users From its Knowledge Graph The neighborhood nodes in the extract enhanced entity embedding vector to form the embedding matrix X i : in Represents a user The set of neighboring nodes;
[0039] Take the embedding matrix X i As input, the user is generated through the multi-layer perceptron g1 Personalized graph hint vector
[0040]
[0041] Where Add represents the sum of the augmented entity embedding vectors in the embedding matrix;
[0042] During the user-item rating prediction process, the enhanced entity embedding vector in the target domain is combined with the personalized graph hint vector to construct the final user embedding vector.
[0043]
[0044] Where g2 represents a multi-layer perceptron, For users The enhanced entity embedding vector of [;] represents the concatenation of the enhanced entity embedding vector and the personalized graph hint vector;
[0045] Calculating users and projects Prediction score between
[0046]
[0047] Where φ is the Sigmoid activation function, g3 is the multi-layer perceptron, For the project Enhanced entity embedding vector of ;
[0048] The network parameters g1, g2, and g3 of the multilayer perceptron for personalized graph prompts and rating prediction are fine-tuned through a binary cross entropy loss function. Expressed as:
[0049]
[0050] in is the training set, represents user-item pairs that have interacted in the target domain, represents the set of overlapping users with target domain ratings Users in Indicates users in the target domain About the project The real rating.
[0051] The second aspect of the present invention provides a cross-domain recommendation system based on graph prompts, which includes: a data acquisition module, a knowledge graph construction module, a source domain graph model pre-training module, a parameter adjustment and score prediction module, and a prediction result output module;
[0052] The data acquisition module cleans, extracts features, and aligns embeddings of user, project, and interaction data from the source and target domains to construct a unified feature representation to generate standardized data.
[0053] The knowledge graph construction module constructs the knowledge graphs of the source domain and the target domain and uses TransE to embed the entities and relationships to generate independent knowledge graph embedding vectors;
[0054] The source domain graph model pre-training module uses a graph attention network to encode the source domain knowledge graph, enhances the expressiveness of entity embedding through a multi-layer multi-head attention mechanism, and generates an enhanced entity embedding vector;
[0055] The parameter adjustment and rating prediction module uses a graph hint mechanism and fine-tuning strategy to migrate the graph encoder model pre-trained in the source domain to the target domain for user-item rating prediction. In this module, graph hints and personalized graph hints are designed to respectively narrow the sample embedding space differences between the source and target domains, as well as the differences between the pre-trained graph model task and the downstream recommendation task training objectives.
[0056] The prediction result output module is responsible for outputting the user-item ratings predicted by the model, selecting a preset number of items, and displaying them in a preset manner.
[0057] Compared with the prior art, the present invention has the following beneficial effects:
[0058] By constructing knowledge graphs for the source and target domains and pre-training a graph encoder on the source domain's knowledge graph, this approach not only effectively utilizes overlapping user and item information but also transfers non-overlapping user or item information to the target domain, thereby better addressing the cold start and data sparsity issues in cross-domain recommendations. This approach expands the knowledge in the source domain and improves recommendation accuracy in the target domain.
[0059] Traditional cross-domain recommendation methods usually lack an effective knowledge transfer mechanism between the source domain and the target domain. The present invention, by combining a graph fast learning algorithm with a knowledge graph, proposes a strategy of pre-training a graph encoder on the source domain knowledge graph and fine-tuning the graph prompts. First, the graph encoder is pre-trained on the source domain knowledge graph to obtain rich graph embedding information. Then, two types of graph prompts are designed: soft graph prompts and personalized graph prompts, and the graph prompts are fine-tuned in the target domain. This process not only solves the gap between the pre-training task and the downstream recommendation task, but also better adjusts the graph prompts in the target domain and optimizes the results of cross-domain recommendations. Through this combination of pre-training and fine-tuning, the model can personalize recommendations according to actual needs in the target domain, thereby significantly improving the accuracy of recommendations, especially when facing cold start and sparse data. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions in the embodiments or exemplary embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or exemplary descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained according to these drawings without paying any creative work.
[0061] Figure 1 A flowchart of a cross-domain recommendation method based on graph prompts is shown;
[0062] Figure 2 A flowchart of an embodiment for generating an enhanced entity embedding vector is shown;
[0063] Figure 3 A block diagram of a cross-domain recommendation system based on graph hints is shown. DETAILED DESCRIPTION
[0064] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0065] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.
[0066] Figure 1 A flowchart of a cross-domain recommendation method based on graph hints is shown.
[0067] like Figure 1As shown, this embodiment provides a cross-domain recommendation method based on graph prompts, including:
[0068] S102: Obtain interaction data between the source domain and the target domain and perform data preprocessing, construct knowledge graphs of the source domain and the target domain, and use TransE to train the entity and relationship embedding representations of the knowledge graph to generate a knowledge graph embedding vector.
[0069] S104, in the pre-training of the source domain graph encoder model, a graph attention network is used to encode the source domain knowledge graph, and the expressiveness of the knowledge graph embedding vector is enhanced through a multi-layer multi-head attention mechanism to generate an enhanced entity embedding vector;
[0070] S106, designing soft image prompts and personalized image prompts to fine-tune the image encoder model in the target domain. The soft image prompts narrow the embedding space difference between the source domain and the target domain by adding a learnable prompt vector to each entity in the target domain, and fine-tune using a contrastive learning loss function;
[0071] S108, based on the entity embedding vector of the user's neighborhood, generates a personalized prompt vector through a multi-layer perceptron, combines the enhanced entity embedding with the personalized graph prompt vector to construct a user embedding, combines it with the enhanced entity embedding vector of the target item, predicts the user's rating of the item, and uses the binary cross entropy loss function to fine-tune the rating prediction to achieve personalized recommendations.
[0072] It should be noted that the source domain and target domain They contain different sets of items but share some users. For example, they use the overlapping information of users in the source domain (such as music platform) and the target domain (such as movie platform) to support the recommendation of the target domain. The user set in the source domain is The user set in the target domain is The set of items in the source domain is The set of items in the target domain is Select overlapping users with rating information in the target domain to form an overlapping user set, which is expressed as Overlapping user sets The users in are only a partial set of cold-start users in the target domain. The target domain may also contain other cold-start users who do not have corresponding interaction data in the source domain.
[0073] Collect user, project, interaction, and comment data from the source and target domains, extract basic feature information of users and projects, and ensure consistent entity identification of users and projects across domains; construct feature representations of users and projects based on interaction data, and use embedding alignment technology to unify the embedding spaces of the source and target domains; batch generate formatted inputs that meet preset requirements from the processed data to achieve data standardization and provide cleaned, high-quality data for model training.
[0074] It should be noted that for a given source domain and target domain Extract entities from the source and target domains, extract interaction relationships from data sources such as user-item rating data and comment data, use the interaction relationships to establish connections between entities, and construct a knowledge graph of the source domain based on the entities and the connections between them. and the knowledge graph of the target domain On the movie platform, for example, two knowledge graphs contain user entities, actor entities, and movie entities, along with word entities filtered by the KeyBert method. In the two knowledge graphs, the user entity and the item entity correspond to the source domain respectively. and target domain Users and projects in the source domain Knowledge Graph Defined as in Represents a collection of entities, A set of relationships between entities. Represents the header entity and tail entity There is a relationship between Target domain Knowledge Graph It can also be defined similarly as
[0075] The TransE algorithm is used to train the entity and relationship embeddings of the two knowledge graphs. The vector representations of entities and relationships are initialized. For each triple in the knowledge graph, negative samples are generated by replacing the head entity or the tail entity. The distance function is defined using the L2 norm. It is iteratively trained with the goal of minimizing the distance function in positive samples and maximizing the distance function in negative samples to generate the corresponding knowledge graph embedding vector. Formally, let Indicates the source domain The knowledge graph embedding vector set of entities; Indicates the target domain The knowledge graph embedding vector set of entities, where m and n represent the number of entities in the source domain and target domain respectively. Representing an entity exist The embedding vector in , Representing an entity exist The embedding vector in d kg represents the dimension of the knowledge graph, Indicates size d kg × 1 real number space. It is worth noting that in the common entity set C in the source and target domains, the embedding vector of each entity is independent.
[0076] Figure 2 A flowchart of an embodiment for generating an enhanced entity embedding vector is shown.
[0077] According to an embodiment of the present invention, in the pre-training of the source domain graph encoder model, a graph attention network is used to encode the source domain knowledge graph, and the expressiveness of the knowledge graph embedding vector is enhanced through a multi-layer multi-head attention mechanism to generate an enhanced entity embedding vector, specifically:
[0078] S202, build a graph encoder model based on the graph attention network, and transform the source domain The knowledge graph embedding vector set of the entities in the graph and the knowledge graph are used as the input of the graph encoder model, which consists of multiple layers of graph attention layers. In each attention layer, the attention weight is calculated by the attention head in the multi-head attention mechanism;
[0079] S204, based on the information of the attention weight aggregation entity and domain node, the hidden vector of each attention head is obtained, the hidden vectors are spliced to generate the output features of the graph attention layer, the output features are calculated layer by layer, and the hidden vectors of the multi-head attention are averaged in the last layer of the graph attention layer to obtain the entity Enhanced entity embedding vector
[0080] It should be noted that the graph attention network is used as the graph encoder f to Knowledge Graph To improve the expressiveness of knowledge graph entity embedding, the preferred graph encoder model can also be other graph neural networks such as graph convolutional neural networks. First, the source domain Knowledge graph embedding vector set of entities and knowledge graph As input to the graph encoder model f, it generates an enhanced entity embedding vector set in For Entity The enhanced entity embedding vector of .
[0081] The graph attention network consists of multiple layers of graph attention layers, and each layer enhances the stability of attention through the multi-head attention mechanism. Let L be the number of graph attention layers, and Q be the number of attention heads in each layer. For the l-th layer of graph attention layer (when l < L), the output feature of the entity is obtained by concatenating the hidden vectors of each attention head in this layer, which is expressed as:
[0082]
[0083] where || represents the concatenation operation, and the hidden vector is generated by the q-th attention head of the l-th layer of graph attention layer. d represents the vector dimension. By aggregating the information of the entity and its neighborhood nodes, it is calculated as follows:
[0084]
[0085]
[0086] where σ is a non-linear activation function (using the ELU function), is the set of neighborhood nodes including the entity itself, z is the number of terms of neighborhood nodes, .
[0090]
[0091] in, and is a random noise vector with the same dimension.
[0092] For entity collections Comparative Learning Loss Functions Using InfoNCE Contrastive learning is achieved by maximizing the positive consistency and minimizing the negative consistency. The InfoNCE contrastive learning loss function Expressed as:
[0093]
[0094] Where τ1 is the temperature hyperparameter, To contain entities batches, is the augmented noise representation vector.
[0095] It should be noted that in order to reduce the source domain and target domain The knowledge graph embedding vector set of entities in the target domain is obtained as Add a corresponding learnable soft image hint vector to each entity embedding vector to obtain the enhanced entity embedding vector set
[0096]
[0097] in, For entities Soft image tips vector, Entities in the target domain The knowledge graph embedding vector of , i = 1, 2…n, n is the total number of entities;
[0098] Leveraging enhanced entity embedding vector sets and knowledge graph Obtaining a set of enhanced entity embedding vectors through the graph encoder model
[0099]
[0100] where f * Indicates that the parameters of the graph encoder model f are frozen;
[0101] In the fine-tuning stage, the source domain and target domain The public entity set C in the soft image prompt is used to optimize the learnable parameters and use InfoNCE to compare the learning loss function. Maximize the consistency between the enhanced embedding vectors of the same entity in the source domain and the target domain, expressed as:
[0102]
[0103] Among them, τ2 is the temperature hyperparameter, To include the target domain entity A batch of An entity in the source domain.
[0104] It should be noted that based on the enhanced entity embedding vector, a personalized graph prompt for users is proposed. The personalized graph prompt narrows the gap between the training objectives of the pre-trained graph model task and the downstream recommendation task. Specifically: From its Knowledge Graph The neighborhood nodes in the extract enhanced entity embedding vector to form the embedding matrix X i : in Represents a user The set of neighboring nodes;
[0105] Take the embedding matrix X i As input, the user is generated through the multi-layer perceptron g1 Personalized graph hint vector
[0106]
[0107] Where Add represents the sum of the augmented entity embedding vectors in the embedding matrix;
[0108] During the user-item rating prediction process, the enhanced entity embedding vector in the target domain is combined with the personalized graph hint vector to construct the final user embedding vector.
[0109]
[0110] Where g2 represents a multi-layer perceptron, For users The enhanced entity embedding vector of [;] represents the concatenation of the enhanced entity embedding vector and the personalized graph hint vector;
[0111] Calculating users and projects Prediction score between
[0112]
[0113] Where φ is the Sigmoid activation function, g3 is the multi-layer perceptron, For the project Enhanced entity embedding vector of ;
[0114] The network parameters g1, g2, and g3 of the multilayer perceptron for personalized graph prompts and rating prediction are fine-tuned through a binary cross entropy loss function. Expressed as:
[0115]
[0116] in is the training set, represents user-item pairs that have interacted in the target domain, represents the set of overlapping users with target domain ratings Users in Indicates users in the target domain About the project The real rating.
[0117] Figure 3 A block diagram of a cross-domain recommendation system based on graph hints is shown.
[0118] This embodiment provides a cross-domain recommendation system 3 based on graph prompts, which includes: a data acquisition module 301, a knowledge graph construction module 302, a source domain graph model pre-training module 303, a parameter adjustment and score prediction module 304, and a prediction result output module 305;
[0119] The data collection module 301 cleans, extracts features, and aligns embedding of user, project, and interaction data from the source and target domains to construct a unified feature representation to generate standardized data.
[0120] The knowledge graph construction module 302 constructs the knowledge graphs of the source domain and the target domain and uses TransE to embed the entities and relationships to generate independent knowledge graph embedding vectors;
[0121] In this module, knowledge graphs of the source and target domains are constructed. Given a source domain, the knowledge graph of the source domain is constructed by extracting entities and establishing relationships between entities based on information such as user-item rating data and user-item comment data. This knowledge graph includes a subgraph of user-item interactions and represents the relationships between entities in the form of triples. Similarly, a corresponding knowledge graph can also be constructed for the target domain. The user entities and project entities included in the two knowledge graphs correspond to the users and projects in the source and target domains, respectively. After the knowledge graphs are constructed, the TransE method is used to train the entity embeddings and relationship embeddings of the source and target domains respectively to generate the corresponding knowledge graph embedding vectors. It is worth noting that the knowledge graph embedding vectors of each entity in the common entity set of the source and target domains are different in the two domains. These embedding vectors provide a rich basic representation for subsequent cross-domain recommendation tasks.
[0122] The source domain graph model pre-training module 303 uses a graph attention network to encode the source domain knowledge graph, enhances the expressiveness of entity embedding through a multi-layer multi-head attention mechanism, and generates an enhanced entity embedding vector;
[0123] This module feeds the source domain's knowledge graph and entity embeddings into a graph attention network, enhancing the entity embeddings. In the graph attention network, each layer contains multiple attention heads, each of which aggregates information about neighboring entities through a self-attention mechanism to generate enhanced entity embeddings. To enhance the model's generalization capabilities, a graph contrastive learning approach is employed. This approach generates different representations of the same entity through data augmentation and optimizes the graph attention network's parameters using a contrastive loss function. This effectively enhances the source domain's entity embeddings, providing richer representations for cross-domain recommendation tasks.
[0124] The parameter adjustment and rating prediction module 304 migrates the graph encoder model pre-trained in the source domain to the target domain for user-item rating prediction through a graph hint mechanism and fine-tuning strategy. In this module, graph hints and personalized graph hints are designed to respectively reduce the sample embedding space difference between the source domain and the target domain, and the difference between the training objectives of the pre-trained graph model task and the downstream recommendation task.
[0125] This module uses soft and personalized graphical hints to tune the graphical model and predict user-item ratings. Soft graphical hints narrow the embedding space gap between the source and target domains by adding a learnable hint vector to each entity in the target domain. Fine-tuning is performed using a contrastive loss function by freezing the graphical encoder and leveraging the common entity set of the source and target domains. Secondly, personalized graphical hints are generated using a multi-layer perceptron based on the entity embedding vectors of the user's neighborhood and fine-tuned based on user needs. Finally, the user's final embedding is calculated by combining the personalized hints with the user's enhanced entity embedding vector. This is then combined with the enhanced entity embedding vector of the target item to predict the user's rating for the item. The entire process uses a binary cross-entropy loss function to fine-tune the rating prediction, thereby achieving personalized recommendations.
[0126] The prediction result output module is responsible for outputting a preset number of items of the user-item ratings predicted by the output model 305 and displaying them in a preset manner.
[0127] The third aspect of the present invention provides a computer-readable storage medium, which includes a cross-domain recommendation method program based on graph prompts. When the cross-domain recommendation method program based on graph prompts is executed by a processor, it implements the steps of the cross-domain recommendation method based on graph prompts.
[0128] In the several embodiments provided in this application, it should be understood that the disclosed system can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms. In addition, the functional units in the various embodiments of the present invention can all be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the above-mentioned integrated units can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0129] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented by hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as a mobile storage device, a read-only memory, a random access memory, a magnetic disk, or an optical disk. Alternatively, if the integrated unit of the present invention is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a mobile storage device, a ROM, a RAM, a magnetic disk, or an optical disk.
[0130] The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be covered by the scope of protection of the present invention.
Claims
1. A cross-domain recommendation method based on graph hints, characterized in that: The following steps are involved: Obtain the interaction data between the source domain and the target domain and perform data preprocessing, build the knowledge graphs of the source domain and the target domain, and use TransE to train the entity and relationship embedding representations of the knowledge graph to generate the knowledge graph embedding vector; In the pre-training of the source domain graph encoder model, a graph attention network is used to encode the source domain knowledge graph. The multi-layer multi-head attention mechanism is used to enhance the expressiveness of the knowledge graph embedding vector and generate an enhanced entity embedding vector. Design soft image prompts and personalized image prompts to fine-tune the graph encoder model in the target domain. The soft image prompts narrow the embedding space difference between the source and target domains by adding a learnable prompt vector to each entity in the target domain, and use a contrastive learning loss function for fine-tuning. Based on the entity embedding vector of the user's neighborhood, a personalized hint vector is generated through a multi-layer perceptron. The enhanced entity embedding and the personalized graph hint vector are combined to construct the user embedding. This is combined with the enhanced entity embedding vector of the target item to predict the user's rating for the item. The binary cross-entropy loss function is used to fine-tune the rating prediction to achieve personalized recommendations. Construct the knowledge graphs of the source and target domains and use TransE to train the entity and relationship embedding representations of the knowledge graphs to generate knowledge graph embedding vectors. Specifically: For a given source domain and target domain , extract entities in the source domain and the target domain, and extract interaction relationships from user-item rating data and comment data, use the interaction relationships to establish connections between entities, and build a knowledge graph of the source domain based on the entities and the connections between entities and the knowledge graph of the target domain ; Use the TransE algorithm to train the entity and relationship embeddings of the two knowledge graphs. Initialize the vector representations of the entities and relationships. For each triple in the knowledge graph, generate negative samples by replacing the head entity or the tail entity. Use the L2 norm to define the distance function. Iterate training with the goal of minimizing the distance function in positive samples and maximizing the distance function in negative samples to generate the corresponding knowledge graph embedding vector. In the pre-training of the source domain graph encoder model, a graph attention network is used to encode the source domain knowledge graph. The multi-layer multi-head attention mechanism is used to enhance the expressiveness of the knowledge graph embedding vector and generate an enhanced entity embedding vector. Specifically: Build a graph encoder model based on the graph attention network, and transform the source domain The knowledge graph embedding vector set of the entities in the graph and the knowledge graph are used as the input of the graph encoder model, which consists of multiple layers of graph attention layers. In each attention layer, the attention weight is calculated by the attention head in the multi-head attention mechanism; Based on the information of the attention weight aggregation entity and domain node, the hidden vector of each attention head is obtained, and the hidden vectors are spliced to generate the output features of the graph attention layer. The output features are calculated layer by layer, and the hidden vectors of the multi-head attention are averaged in the last layer of the graph attention layer to obtain the entity Enhanced entity embedding vector .
2. A cross-domain recommendation method based on graph prompts according to claim 1, characterized in that: Obtain the interaction data between the source domain and the target domain and perform data preprocessing, specifically: Collect user, project, interaction, and comment data from the source and target domains, extract basic feature information about users and projects, and ensure consistent entity identification of users and projects across domains; Construct feature representations of users and items based on interaction data, and use embedding alignment technology to unify the embedding spaces of the source and target domains; The processed data is batch generated into formatted input that meets the preset requirements to achieve data standardization.
3. The cross-domain recommendation method based on graph prompts according to claim 1, characterized in that: Use graph contrast learning to update the parameters of the graph encoder model, specifically: By using the data augmentation method, random noise is added to the entity feature vector in each layer of the graph attention to generate different entity representations. Entities in the layer The eigenvector of , the augmented noise representation vector is : , in, and is a random noise vector with the same dimension; For entity collections Comparative Learning Loss Functions Using InfoNCE , contrastive learning is achieved by maximizing the positive consistency and minimizing the negative consistency. The InfoNCE contrastive learning loss function Expressed as: , in is the temperature hyperparameter, To contain entities 、 batches, is the augmented noise representation vector.
4. The cross-domain recommendation method based on graph prompts according to claim 1, characterized in that: The soft image hinting method narrows the embedding space difference between the source and target domains by adding a learnable hint vector to each entity in the target domain, and uses a contrastive learning loss function for fine-tuning, specifically: Get the knowledge graph embedding vector set of entities in the target domain as , add a corresponding learnable soft image hint vector to each entity embedding vector to obtain the enhanced entity embedding vector set : , in, About the entity Soft image prompt vector, Entities in the target domain The knowledge graph embedding vector of , is the total number of entities; Leveraging enhanced entity embedding vector sets and knowledge graph Obtaining a set of enhanced entity embedding vectors through the graph encoder model : , in Representation Graph Encoder Model The parameters are frozen; In the fine-tuning stage, the source domain and target domain The public entity set C in the soft image prompt is used to optimize the learnable parameters and use InfoNCE to compare the learning loss function. , maximizes the consistency between the enhanced embedding vectors of the same entity in the source domain and the target domain, expressed as: , in, is the temperature hyperparameter, To include the target domain entity A batch of An entity in the source domain.
5. The cross-domain recommendation method based on graph prompts according to claim 1, characterized in that: Personalized graph hints narrow the gap between the training objectives of pre-trained graph model tasks and downstream recommendation tasks, specifically: For users , from its Knowledge Graph The neighborhood nodes in the extract enhanced entity embedding vector to form an embedding matrix : ,in Represents a user The set of neighboring nodes; Embedding matrix As input, through a multi-layer perceptron Generate User Personalized graph hint vector : , in represents the sum of the augmented entity embedding vectors in the embedding matrix; During the user-item rating prediction process, the enhanced entity embedding vector in the target domain is combined with the personalized graph hint vector to construct the final user embedding vector. : , in represents a multilayer perceptron, For users The enhanced entity embedding vector of represents the concatenation of the enhanced entity embedding vector and the personalized graph hint vector; Calculating users and projects Prediction score between : , in is the Sigmoid activation function, is a multi-layer perceptron, For the project Enhanced entity embedding vector of ; Fine-tuning the network parameters of the multilayer perceptron for personalized graph hints and rating prediction via binary cross-entropy loss function , the binary cross entropy loss function Expressed as: , in is the training set, represents user-item pairs that have interacted in the target domain, represents the set of overlapping users with target domain ratings Users in Indicates users in the target domain About the project The real rating.
6. A cross-domain recommendation system based on graph prompts, characterized in that: Used to implement the cross-domain recommendation method based on graph prompts as described in any one of claims 1 to 5, the system includes: a data acquisition module, a knowledge graph construction module, a source domain graph model pre-training module, a parameter adjustment and score prediction module, and a prediction result output module; The data acquisition module cleans, extracts features, and aligns embeddings of user, project, and interaction data from the source and target domains to construct a unified feature representation to generate standardized data. The knowledge graph construction module constructs the knowledge graphs of the source domain and the target domain and uses TransE to embed the entities and relationships to generate independent knowledge graph embedding vectors; The source domain graph model pre-training module uses a graph attention network to encode the source domain knowledge graph, enhances the expressiveness of entity embedding through a multi-layer multi-head attention mechanism, and generates an enhanced entity embedding vector; The parameter adjustment and rating prediction module uses a graph hint mechanism and fine-tuning strategy to migrate the graph encoder model pre-trained in the source domain to the target domain for user-item rating prediction. In this module, graph hints and personalized graph hints are designed to respectively narrow the sample embedding space differences between the source and target domains, as well as the differences between the pre-trained graph model task and the downstream recommendation task training objectives. The prediction result output module is responsible for outputting the user-item ratings predicted by the model, selecting a preset number of items, and displaying them in a preset manner.