Cross-domain recommendation method and system based on graph prompt

By constructing a knowledge graph in cross-domain recommendation and pre-training and fine-tuning of graph encoder, the problem of insufficient utilization of non-overlapping information in the prior art is solved, and the accuracy and generalization ability of recommendations are significantly improved.

CN120068930AActive Publication Date: 2025-05-30SOUTH CHINA AGRICULTURAL UNIVERSITY

Patent Information

Application Number
CN202510230105.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-05-30
Estimated Expiration
2045-02-28

AI Technical Summary

Technical Problem

Existing cross-domain recommendation methods rely too much on overlapping user or project information in the source and target domains, resulting in insufficient utilization of non-overlapping information, limiting the accuracy and generalization capabilities of recommendations.

Method used

By constructing knowledge graphs for the source domain and target domain, pre-train the graph encoder on the knowledge graph of the source domain, and design soft graph prompts and personalized graph prompts, fine-tuning the graph encoder in the target domain to achieve more accurate scoring prediction.

Benefits of technology

It significantly improves the performance of cross-domain recommendations, and can effectively utilize not only overlapping information, but also non-overlapping information, improving the accuracy and generalization capabilities of recommendations, especially when facing cold start and data sparse problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120068930A_ABST
    Figure CN120068930A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-domain recommendation method and system based on graph prompt, and relates to the technical field of cross-domain recommendation, and the method comprises the steps: respectively constructing knowledge graphs in a source domain and a target domain, and extracting entities and relationships to form structured information; then, knowledge graph embedding is trained through a TransE method, a graph encoder model is pre-trained in a source domain by utilizing a graph attention network, parameters of the graph encoder model are finely adjusted through graph contrast learning, the robustness of entity embedding representation is improved, then graph prompt adjustment is carried out in a target domain, and the graph prompt adjustment comprises soft graph prompt and personalized graph prompt. And the embedding space difference and the training target difference of the source domain and the target domain are reduced. And finally, the personalized prompt vector and the enhanced embedded vector are used for user score prediction so as to more accurately meet personalized requirements and realize a cross-domain recommendation target. According to the method, pre-training and fine tuning are combined, personalized adjustment can be carried out on recommendation in the target domain according to actual requirements, and the recommendation accuracy is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cross - domain recommendation, and more specifically, to a cross - domain recommendation method and system based on graph prompting. Background Art

[0002] Cross - domain recommendation technology is an effective method to improve the accuracy of recommendation systems by integrating information from multiple domains, especially performing well in cold - start and data - sparsity problems. When new users or new items lack sufficient historical data, cross - domain recommendation can use the behavior information of users in other domains to achieve data migration, thus making up for the data deficiency in the target domain. Specifically, cross - domain recommendation utilizes the overlapping information of users in the source domain (such as a music platform) and the target domain (such as a movie platform) to support recommendations in the target domain. However, most existing cross - domain recommendation methods rely too much on the 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 deficiencies, in recent years, graph fast - 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 - structure - based cross - domain recommendation methods usually only focus on the user - item interaction graph and ignore the potential of auxiliary information within 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 recommendation 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 to be solved in this field. Summary of the Invention

[0004] To solve the above - mentioned technical problems, the present invention proposes a cross - domain recommendation method and system based on graph prompting. By constructing knowledge graphs of the source domain and the target domain, pre - training the graph encoder on the knowledge graph of the source domain. At the same time, designing soft graph prompts and personalized graph prompts to fine - tune the graph encoder in the target domain, thereby achieving more accurate score prediction in the target domain and significantly improving the performance of cross - domain recommendation.

[0005] The present invention provides a cross - domain recommendation method based on graph prompting, including the following steps:

[0006] Obtain the interaction data of the source domain and the target domain and perform data pre - processing, construct 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 graphs to generate knowledge - graph embedding vectors;

[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, 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;

[0008] Soft graph prompts and personalized graph prompts are designed to fine-tune the graph encoder model in the target domain. The soft graph prompts add learnable prompt vectors for each entity in the target domain to narrow the embedding space difference between the source domain and the target domain, and a contrastive learning loss function is used for fine-tuning;

[0009] Based on the entity embedding vector of the user neighborhood, a personalized prompt vector is generated through a multi-layer perceptron. The user embedding is constructed by combining the enhanced entity embedding and the personalized graph prompt vector, and combined with the enhanced entity embedding vector of the target item to predict the user's rating of the item. A binary cross-entropy loss function is used for fine-tuning the rating prediction to achieve personalized recommendation.

[0010] In this solution, the interaction data of the source domain and the target domain is obtained and preprocessed. Specifically:

[0011] Collect user, item, interaction, and review data from the source domain and the target domain, extract the basic feature information of users and items, and ensure that the entity identifiers of cross-domain users and items are consistent;

[0012] Based on the interaction data, the feature representations of users and items are constructed, and the embedding alignment technology is used to unify the embedding spaces of the source domain and the target domain;

[0013] The processed data is batch-generated into formatted inputs that meet the preset requirements to achieve data standardization.

[0014] In this solution, the knowledge graphs of the source domain and the target domain are constructed, and TransE is used to train the entity and relationship embedding representations of the knowledge graph to generate knowledge graph embedding vectors. Specifically:

[0015] For a given source domain and target domain Extract the entities in the source domain and the target domain, and extract the interaction relationships from the user-item rating data and review data. Use the interaction relationships to establish connections between entities, and construct the knowledge graph of the source domain according to the entities and the connections between entities and the knowledge graph of the target domain

[0016] Use the TransE algorithm to train the entity and relationship embeddings of two knowledge graphs, initialize the vector representations of entities and relationships, generate negative samples for each triple in the knowledge graph by replacing the head entity or the tail entity, define the distance function using the L2 norm, and perform iterative training with the goal of minimizing the distance function for positive samples and maximizing the distance function for negative samples to generate the corresponding knowledge graph embedding vectors.

[0017] In this solution, during the pre-training of the source domain graph encoder model, the graph attention network is used to encode the source domain knowledge graph, and the multi-layer multi-head attention mechanism is used to enhance the expressiveness of the knowledge graph embedding vectors to generate enhanced entity embedding vectors. Specifically:

[0018] Construct a graph encoder model based on the graph attention network, and use the set of knowledge graph embedding vectors of entities in the source domain and the knowledge graph as the input of the graph encoder model. The graph encoder model consists of multiple graph attention layers. In each attention layer, the attention weights are calculated through the attention heads in the multi-head attention mechanism;

[0019] Aggregate the information of entities and domain nodes based on the attention weights to obtain the hidden vector of each attention head, splice the hidden vectors to generate the output features of the graph attention layer, perform layer-by-layer calculations on the output features, and perform an average operation on the hidden vectors of the multi-head attention in the last graph attention layer to obtain the enhanced entity embedding vectors of entities

[0020] In this solution, use graph contrastive learning to update the parameters of the graph encoder model. Specifically:

[0021] Add random noise to the entity feature vectors in each graph attention layer through the data augmentation method to generate different entity representations. Let the feature vector of entity in the l-th layer be The augmented noise-added representation vector is

[0022]

[0023] where and are random noise vectors with the same dimension.

[0024] For the entity set use the InfoNCE contrastive learning loss function Achieve contrastive learning by maximizing the positive pair consistency and minimizing the negative pair consistency. The InfoNCE contrastive learning loss function is expressed as:

[0025]

[0026] where τ 1 is the temperature hyperparameter, is the batch containing the entity , and is the augmented noise-added representation vector.

[0027] In this solution, the soft graph prompt reduces the difference in the embedding space between the source domain and the target domain by adding a learnable prompt vector for each entity in the target domain, and is fine-tuned using a contrastive learning loss function, specifically:

[0028] Obtain the knowledge graph embedding vector set of the entities in the target domain as Add a corresponding learnable soft graph prompt vector to each entity embedding vector to obtain the enhanced entity embedding vector set

[0029]

[0030] where is the soft graph prompt vector for the entity , is the knowledge graph embedding vector of the entity in the target domain, i = 1, 2…n, and n is the total number of entities;

[0031] Using the enhanced entity embedding vector set and the knowledge graph Obtain the enhanced entity embedding vector set 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, optimize the learnable parameters of the soft graph prompt through the common entity set C in the source domain and the target domain , and use the InfoNCE contrastive learning loss function to maximize the consistency between the enhanced embedding vectors of the same entity in the source domain and the target domain, expressed as:

[0035]

[0036] where τ 2 is the temperature hyperparameter, is a batch containing the target domain entity , is the entity in the source domain.

[0037] In this solution, the difference between the training objectives of the pre-trained graph model task and the downstream recommendation task is narrowed through personalized graph prompts, specifically as follows:

[0038] For a user Extract enhanced entity embedding vectors from the neighborhood nodes in its target domain knowledge graph to form an embedding matrix X i : where represents the set of neighborhood nodes of the user ;

[0039] Using the embedding matrix X i as input, generate the personalized graph prompt vector of the user 1 through a multi-layer perceptron g

[0040]

[0041] where Add represents summing the enhanced 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 prompt vector to construct the final user embedding vector

[0043]

[0044] where g 2 represents the multi-layer perceptron, is the enhanced entity embedding vector of the user [;] represents the concatenation of the enhanced entity embedding vector and the personalized graph prompt vector;

[0045] Calculate the predicted rating between the user and the item

[0046]

[0047] where φ is the Sigmoid activation function, g 3 is the multi-layer perceptron, is the enhanced entity embedding vector of the item ;

[0048] Fine-tune the network parameters g 1 and g 2 and g 3 of the personalized graph prompt and rating prediction through the binary cross-entropy loss function, the binary cross-entropy loss function is expressed as:

[0049]

[0050] where is the training set, represents the user-item pairs that have interacted in the target domain, represents the overlapping user set with target domain ratings of the users in, represents the user in the target domain for the item true rating.

[0051] The second aspect of the present invention provides a graph prompt-based cross-domain recommendation system, which includes: a data collection 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 collection module constructs a unified feature representation by cleaning, feature extraction, and embedding alignment of the users, items, and interaction data in the source domain and the target domain 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 perform embedding training on entities and relationships to generate independent knowledge graph embedding vectors;

[0054] The source domain graph model pre-training module encodes the source domain knowledge graph using a graph attention network, enhances the expressiveness of entity embeddings through a multi-layer multi-head attention mechanism, and generates enhanced entity embedding vectors;

[0055] The parameter adjustment and score prediction module migrates the graph encoder model pre-trained on the source domain to the target domain through a graph prompt mechanism and a fine-tuning strategy for user-item score prediction. In this module, graph prompts and personalized graph prompts are designed to respectively reduce the difference in sample embedding space between the source domain and the target domain and the difference in training objectives between the pre-trained graph model task and the downstream recommendation task;

[0056] The prediction result output module is responsible for outputting the user-item scores predicted by the model, selecting a preset number of items, and displaying them in a preset manner.

[0057] Compared with the prior art, the beneficial effects of the present invention are:

[0058] The present invention constructs knowledge graphs for the source domain and the target domain, and pre-trains a graph encoder on the knowledge graph of the source domain, enabling not only overlapping user and item information to be effectively utilized, but also non-overlapping user or item information to be transferred to the target domain, thus better solving the cold start and data sparsity problems in cross-domain recommendation. This approach expands the knowledge in the source domain and promotes the 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 proposes a strategy of pre-training a graph encoder on the source domain knowledge graph and fine-tuning the graph prompt by combining a graph fast learning algorithm and a knowledge graph. 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 to optimize the results of cross-domain recommendation. Through this method combining pre-training and fine-tuning, the model can perform personalized adjustment of recommendations according to actual needs in the target domain, thus significantly improving the recommendation accuracy, especially in the face of cold start and sparse data. Brief Description of the Drawings

[0060] To more clearly illustrate the technical solutions in the embodiments or examples of the present invention, the following will briefly introduce the drawings required for use in the description of the embodiments or examples. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings according to these drawings shown without creative efforts.

[0061] Figure 1 Shows a flowchart of a cross-domain recommendation method based on graph prompts;

[0062] Figure 2 Shows a flowchart of generating enhanced entity embedding vectors in an embodiment;

[0063] Figure 3 Shows a block diagram of a cross-domain recommendation system based on graph prompts. Detailed Embodiments

[0064] In order to more clearly understand the above objects, features and advantages of the present invention, the following further describes the present invention in detail with reference to the drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments 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 by the specific embodiments disclosed below.

[0066] Figure 1 A flowchart of a graph-based cross-domain recommendation method is shown.

[0067] As Figure 1 shown, this embodiment provides a graph-based cross-domain recommendation method, including:

[0068] S102, obtaining the interaction data of the source domain and the target domain and performing data preprocessing, constructing the knowledge graphs of the source domain and the target domain, and using TransE to train the entity and relationship embedding representations of the knowledge graphs to generate knowledge graph embedding vectors;

[0069] S104, in the pre-training of the source domain graph encoder model, using a graph attention network to encode the source domain knowledge graph, enhancing the expressiveness of the knowledge graph embedding vectors through a multi-layer multi-head attention mechanism to generate enhanced entity embedding vectors;

[0070] S106, designing soft graph prompts and personalized graph prompts to fine-tune the graph encoder model in the target domain. The soft graph prompts add learnable prompt vectors for each entity in the target domain to reduce the embedding space difference between the source domain and the target domain, and use a contrastive learning loss function for fine-tuning;

[0071] S108, based on the entity embedding vectors of the user neighborhood, generating personalized prompt vectors through a multi-layer perceptron, combining the enhanced entity embedding with the personalized graph prompt vectors to construct user embeddings, combining with the enhanced entity embedding vectors of the target item, predicting the user's rating of the item, and using a binary cross-entropy loss function for fine-tuning the rating prediction to achieve personalized recommendation.

[0072] It should be noted that the source domain and the target domain respectively contain different item sets, but share some users. For example, using the overlapping information of users in the source domain (such as a music platform) and the target domain (such as a movie platform) to support the recommendation in the target domain. The user set in the source domain is The user set in the target domain is The item set in the source domain is The item set in the target domain is Selecting the overlapping users with rating information in the target domain to form an overlapping user set, denoted as Overlapping user set The users in it are only a partial set of the 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, item, interaction, and review data from the source domain and the target domain, extract basic feature information of users and items, and ensure the consistency of entity identifiers for cross-domain users and items; construct feature representations of users and items based on interaction data, and use embedding alignment technology to unify the embedding spaces of the source domain and the target domain; batch generate formatted inputs that meet preset requirements from the processed data to achieve data standardization and provide high-quality cleaned data for model training.

[0074] It should be noted that for a given source domain and target domain Extract entities in the source domain and the target domain, and extract interaction relationships from data sources such as user-item rating data and review 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 a knowledge graph of the target domain On a movie platform, for example, the two knowledge graphs contain user entities, actor entities, and movie entities. Following the word entities filtered by the KeyBert method, in the two knowledge graphs, the user entities and item entities respectively correspond to the users and items in the source domain and the target domain The knowledge graph of the source domain is defined as where represents the set of entities, represents the set of relationships between entities. The triple represents that there is a relationship between the head entity and the tail entity The knowledge graph of the target domain can be similarly defined as

[0075] Use the TransE algorithm to train the entity and relationship embeddings of the two knowledge graphs, initialize the vector representations of entities and relationships, generate negative samples for each triple in the knowledge graph by replacing the head entity or the tail entity, define the distance function using the L2 norm, and perform iterative training with the goal of minimizing the distance function for positive samples and maximizing the distance function for negative samples to generate the corresponding knowledge graph embedding vectors. Formally, let represent the set of knowledge graph embedding vectors of the entities in the source domain ; represent the target domain The set of knowledge graph embedding vectors of entities, where m and n respectively represent the number of entities in the source domain and the target domain, denotes an entity in the embedding vector of, denotes an entity in the embedding vector of, d kg denotes the dimension of the knowledge graph, denotes the real number space of size d kg ×1. It should be noted that in the common entity set C in the source domain and the target domain, the embedding vectors of each entity are independent.

[0076] Figure 2 The flowchart shows an example of generating enhanced entity embedding vectors.

[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 vectors is enhanced through a multi-layer multi-head attention mechanism to generate enhanced entity embedding vectors. Specifically:

[0078] S202, constructing a graph encoder model based on the graph attention network, and using the set of knowledge graph embedding vectors of entities in the source domain and the knowledge graph as the input of the graph encoder model. The graph encoder model is composed of multiple graph attention layers. In each attention layer, the attention weights are calculated through the attention heads in the multi-head attention mechanism;

[0079] S204, aggregating the information of entities and domain nodes based on the attention weights to obtain the hidden vector of each attention head, splicing the hidden vectors to generate the output feature of the graph attention layer, calculating the output feature layer by layer, and performing an average operation on the hidden vectors of the multi-head attention in the last graph attention layer to obtain the enhanced entity embedding vector of the entity

[0080] It should be noted that the graph attention network is used as the graph encoder f to encode the knowledge graph of the source domain to improve the expressiveness of the knowledge graph entity embedding. The preferred graph encoder model can also be other graph neural networks such as a graph convolutional neural network. First, the set of knowledge graph embedding vectors of entities in the source domain is and the knowledge graph are used as the input and fed into the graph encoder model f, thereby generating an enhanced set of entity embedding vectors where is the entity The enhanced entity embedding vector.

[0081] The graph attention network consists of multiple layers of graph attention layers. 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 the graph attention layer (when l < L), the entity The output feature 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 the 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 the neighborhood nodes, Both represent the neighborhood nodes of the (l - 1)-th layer, Is the normalized attention weight of the q-th attention head in the l-th layer, and W l,q And Are learnable parameters. In particular, the size of the weight matrix W l,q Varies with different graph attention layers. The weight of the first layer is The weights of the 2nd layer to the (L - 1)-th layer are

[0087] In the last layer (i.e., the L-th layer) of the graph attention layer, the hidden vectors of the multi-head attention use the average operation instead of the concatenation operation to obtain the output feature vector As the enhanced entity embedding vector Of the entity

[0088]

[0089] To further improve the performance of the graph attention network, graph contrastive learning is used to update its parameters. By adding random noise to the entity feature vectors in each layer of the graph attention through the data augmentation method, different entity representations are generated. Let the feature vector of the entity In the l-th layer be The augmented noise-added representation vector is

[0090]

[0091] where and are random noise vectors with the same dimension.

[0092] For the entity set use the InfoNCE contrastive learning loss function To achieve contrastive learning by maximizing the positive pair consistency and minimizing the negative pair consistency, the InfoNCE contrastive learning loss function is expressed as:[[]]END]]

[0093]

[0094] where τ 1 is the temperature hyperparameter,[[]]END]] is the batch containing the entity ,[[]]END]] is the augmented noise-added representation vector.[[]]END]]

[0095] It should be noted that in order to reduce the difference in the sample embedding space between the source domain and the target domain , soft graph prompts are proposed. The set of knowledge graph embedding vectors of the entities in the target domain is Add a corresponding learnable soft graph prompt vector to each entity embedding vector to obtain the enhanced entity embedding vector set

[0096]

[0097] where is the soft graph prompt vector for the entity ,[[]]END]] is the knowledge graph embedding vector of the entity in the target domain, i = 1, 2... n, and n is the total number of entities;

[0098] Using the enhanced entity embedding vector set and the knowledge graph Obtain the enhanced entity embedding vector set 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, through the source domain and the common entity set C in the target domain optimize the learnable parameters of the soft graph prompt, and use the InfoNCE contrastive learning loss function to maximize the consistency between the augmented embedding vectors of the same entity in the source domain and the target domain, expressed as:

[0102]

[0103] where τ 2 is the temperature hyperparameter, is a batch containing target domain entities , and is the entity in the source domain.

[0104] It should be noted that based on the augmented entity embedding vectors, user-oriented personalized graph prompts are proposed. By using the personalized graph prompts, the differences between the training objectives of the pre-trained graph model task and the downstream recommendation task are narrowed. Specifically: for user extract the augmented entity embedding vectors from its neighborhood nodes in the target domain knowledge graph to form the embedding matrix X i : where represents the set of neighborhood nodes of user ;

[0105] Taking the embedding matrix X i as the input, generate the personalized graph prompt vector 1 of user through the multi-layer perceptron g

[0106]

[0107] where Add represents summing the augmented entity embedding vectors in the embedding matrix;

[0108] During the user-item rating prediction process, the augmented entity embedding vectors in the target domain are combined with the personalized graph prompt vectors to construct the final user embedding vector

[0109]

[0110] where g 2 represents the multi-layer perceptron, is the augmented entity embedding vector of user , and [;] represents the concatenation of the augmented entity embedding vector and the personalized graph prompt vector;

[0111] Calculate user and item Prediction score among

[0112]

[0113] where φ is the Sigmoid activation function, and g 3 is a multi-layer perceptron, is the enhanced entity embedding vector of the item;

[0114] Fine-tune the network parameters g of the multi-layer perceptron for personalized graph prompting and score prediction through the binary cross-entropy loss function 1 、g 2 、g 3 , and the binary cross-entropy loss function is expressed as:

[0115]

[0116] where is the training set, represents the user-item pairs that have interacted in the target domain, represents the overlapping user set with target domain scores in the represents the user in the target domain for the item true score.

[0117] Figure 3 Shows a block diagram of a graph-prompting-based cross-domain recommendation system.

[0118] This embodiment provides a graph-prompting-based cross-domain recommendation system 3, 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 acquisition module 301 constructs a unified feature representation by cleaning, feature extraction, and embedding alignment of user, item, and interaction data in the source domain and the target domain 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 perform embedding training on entities and relationships to generate independent knowledge graph embedding vectors;

[0121] In this module, knowledge graphs for the source domain and the target domain are constructed. Given the source domain, by extracting entities and establishing relationships between entities based on information such as user project rating data and user project review data, the knowledge graph of the source domain is constructed. This knowledge graph includes subgraphs of user-item interactions and represents the relationships between entities in the form of triples. Similarly, the corresponding knowledge graph can be constructed for the target domain. The user entities and project entities included in the two knowledge graphs respectively correspond to the users and projects in the source domain and the target domain. After constructing the knowledge graphs, the TransE method is used to train the entity embeddings and relationship embeddings of the source domain and the target domain respectively to generate the corresponding knowledge graph embedding vectors. It should be noted that the knowledge graph embedding vectors of each entity in the common entity set of the source domain and the target domain are different. These embedding vectors provide a rich basic representation for subsequent cross-domain recommendation tasks.

[0122] The source domain graph model pre-training module 303 encodes the source domain knowledge graph using a graph attention network, enhances the expressiveness of entity embeddings through a multi-layer multi-head attention mechanism, and generates enhanced entity embedding vectors;

[0123] This module inputs the knowledge graph and entity embedding vectors of the source domain into the graph attention network, and the entity embedding vectors are enhanced. In the graph attention network, each layer contains multiple attention heads, and each attention head aggregates the information of neighboring entities through self-attention mechanism to generate enhanced entity embedding vectors. To enhance the generalization ability of the model, a graph contrast learning method is also adopted. Different representations of the same entity are generated through data augmentation, and the contrast loss function is used to optimize the parameters of the graph attention network. In this way, the entity embedding vectors of the source domain are effectively enhanced, providing a richer representation for cross-domain recommendation tasks.

[0124] The parameter adjustment and score prediction module 304 migrates the graph encoder model pre-trained on the source domain to the target domain through a graph prompting mechanism and a fine-tuning strategy for user-item score prediction. In this module, graph prompts and personalized graph prompts are designed to respectively narrow the differences in sample embedding spaces between the source domain and the target domain and the differences in training objectives between the pre-trained graph model task and the downstream recommendation task;

[0125] This module adjusts the graph model and predicts the user-item rating soft graph hint through soft graph hint and personalized graph hint. By adding a learnable hint vector for each entity in the target domain, the difference in the embedding space between the source domain and the target domain is reduced. By freezing the graph encoder and utilizing the common entity set of the source domain and the target domain, fine-tuning is performed using a contrastive loss function. Secondly, the personalized graph hint is based on the entity embedding vectors in the user neighborhood. A personalized hint vector is generated through a multi-layer perceptron and fine-tuned according to user needs. Finally, by combining the personalized hint and the enhanced entity embedding vector of the user, the final embedding of the user is calculated and combined with the enhanced entity embedding vector of the target item to predict the user's rating of the item. The entire process uses a binary cross-entropy loss function for fine-tuning the rating prediction, thereby achieving personalized recommendation.

[0126] The prediction result output module is responsible for outputting the user-item ratings predicted by the model 305, selecting a preset number of items, and displaying them in a preset manner.

[0127] The third aspect of the present invention provides a computer-readable storage medium, which includes a program for the cross-domain recommendation method based on graph hint. When the program for the cross-domain recommendation method based on graph hint is executed by a processor, the steps of the cross-domain recommendation method based on graph hint are implemented.

[0128] In several embodiments provided in the present application, it should be understood that the disclosed system can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only 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 various components shown or discussed with each other can be through some interfaces. The indirect coupling or communication connection of devices or units can be electrical, mechanical, or other forms. In addition, in each embodiment of the present invention, the various functional units can all be integrated in one processing unit, or each unit can be separately used as a unit, or two or more units can be integrated in one unit; the above integrated units can be implemented in the form of hardware, or in the form of a combination of hardware and software functional units.

[0129] Those of ordinary skill in the art will understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including those of the above method embodiments; and the foregoing storage medium includes: various media such as removable storage devices, read-only memories, random access memories, magnetic disks, or optical discs that can store program codes. Alternatively, if the above integrated units of the present invention are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the various embodiments of the present invention. And the foregoing storage medium includes: various media such as removable storage devices, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0130] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered within the protection scope of the present invention.

Claims

1. A cross-domain recommendation method based on graph prompts, 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, and 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 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 use a contrastive learning loss function for fine-tuning. Based on the entity embedding vector of the user's neighborhood, a personalized prompt vector is generated through a multi-layer perceptron. The user embedding is constructed by combining the enhanced entity embedding and the personalized graph prompt vector. It 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 recommendation.

2. According to claim 1, a cross-domain recommendation method based on graph prompts is 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 of users and projects, and ensure that entity identifiers of users and projects across domains are consistent; 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 preset requirements to achieve data standardization.

3. According to the cross-domain recommendation method based on graph prompts according to claim 1, it is characterized in that: Construct 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. Specifically: For a given source domain and target domain Extract entities in the source domain and the target domain, 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 The TransE algorithm is used to train the entity and relationship embeddings of the two knowledge graphs, initialize the vector representation of entities and relationships, generate negative samples for each triple in the knowledge graph by replacing the head entity or tail entity, define the distance function using the L2 norm, and perform iterative 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.

4. The cross-domain recommendation method based on graph prompts according to claim 1, characterized in that: In the pre-training of the source domain graph encoder model, the graph attention network is used to encode the source domain knowledge graph, and the multi-layer multi-head attention mechanism is used to enhance the expressiveness of the knowledge graph embedding vector to generate an enhanced entity embedding vector. Specifically: Based on the graph attention network, a graph encoder model is constructed to transform the source domain The knowledge graph embedding vector set of the entity in and the knowledge graph are used as the input of the graph encoder model, and the graph encoder model 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 The enhanced entity embedding vector 5. A cross-domain recommendation method based on graph prompts according to claim 4, characterized in that: Use graph contrast learning to update the parameters of the graph encoder model, specifically: The data augmentation method is used to add random noise 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 in, and is a random noise vector with the same dimension; For entity collection Comparative learning loss functions using InfoNCE Contrastive learning is achieved by maximizing the positive pair consistency and minimizing the negative pair consistency. The InfoNCE contrastive learning loss function It is expressed as: Where τ1 is the temperature hyperparameter, To contain entities batches, is the augmented noise representation vector.

6. The cross-domain recommendation method based on graph prompts according to claim 1, characterized in that: The soft image hint narrows the embedding space difference between the source domain and the target domain 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, For entities Soft image hint vector, Entities in the target domain The knowledge graph embedding vector of , i = 1, 2…n, n is the total number of entities; Using enhanced entity embedding vector sets and knowledge graph Obtaining a set of enhanced entity embedding vectors through the graph encoder model where f * Indicates that the parameters of the graph encoder model f 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 the learning loss function is compared using InfoNCE. Maximize the consistency between the enhanced embedding vectors of the same entity in the source domain and the target domain, expressed as: Among them, τ2 is the temperature hyperparameter, To include the target domain entity A batch of An entity in the source domain.

7. The cross-domain recommendation method based on graph prompts according to claim 1, characterized in that: Through personalized graph hints, the difference between the training objectives of the pre-trained graph model task and the downstream recommendation task is narrowed, specifically: For Users From its Knowledge Graph The neighborhood nodes in extract the enhanced entity embedding vector to form the embedding matrix X i : in Indicates user The set of neighboring nodes; Take the embedding matrix X i As input, the user is generated through the multilayer perceptron g1 Personalized graph hint vector Where Add represents the sum of the augmented entity embedding vectors in the embedding matrix; During user-item rating prediction, the enhanced entity embedding vector in the target domain is combined with the personalized graph hint vector to construct the final user embedding vector. 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; Counting users and Projects Prediction score between Where φ is the Sigmoid activation function, g3 is the multi-layer perceptron, For Project The enhanced entity embedding vector of The network parameters g1, g2, g3 of the multilayer perceptron for personalized graph hints and rating prediction are fine-tuned through a binary cross entropy loss function. It is 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 the user in the target domain About Project The real rating.

8. 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 7, 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 embedding of user, project, and interaction data in 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 relations 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 migrates the graph encoder model pre-trained in the source domain to the target domain through a graph prompt mechanism and a fine-tuning strategy for user-item rating prediction. In this module, graph prompts and personalized graph prompts are designed to respectively reduce the sample embedding space difference between the source domain and the target domain, and the difference between the pre-trained graph model task and the downstream recommendation task training target. 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.

Citation Information

Patent Citations

  • Cross-domain recommendation method and system based on graph learning

    CN116028728A

  • Cross-domain recommendation method and system based on user preference diversity

    CN116910375A

  • Cross-domain recommendation system optimization method based on knowledge graph enhancement

    CN117390272A

  • Personalized cross-domain recommendation method based on network data driving

    CN117556148A

  • Personalized recommendation method based on time sequence and cross-domain collaboration

    CN118069938A

Cited By

  • Multi-domain recommendation method and system based on inter-domain knowledge migration and cross attention

    CN120470160A

  • Multi-domain recommendation method and system based on inter-domain knowledge transfer and cross-attention

    CN120470160B

  • Lightweight cross-domain recommendation method and system based on user alignment Agent drive

    CN121030097A

  • A lightweight cross-domain recommendation method and system based on user alignment agent driving

    CN121030097B