Contrast learning based cross-domain recommendation method, system, device and storage medium

By employing contrastive learning and graph data augmentation techniques, a cross-domain recommendation model was constructed, which solved the problems of data noise and feature adaptation in cross-domain recommendation, and achieved the optimization of user preference features and the improvement of recommendation performance.

CN121051306BActive Publication Date: 2026-04-28ANHUI INVERNESS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ANHUI INVERNESS TECH CO LTD
Filing Date
2025-10-31
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Cross-domain recommendation suffers from problems such as data noise interfering with users' true preferences, ignoring potential collaborative relationships between users and items, and source domain features being difficult to adapt to the target domain, leading to negative transfer and affecting recommendation performance.

Method used

We employ a contrastive learning-based approach, constructing a user-item collaboration graph to perform graph data augmentation and denoising, extracting common features of user behavior patterns, filtering noise using positive and negative prototypes, optimizing user preference feature representation, and combining knowledge graphs and contrastive learning mechanisms to build a cross-domain user preference model.

Benefits of technology

It effectively filters noise, optimizes the representation of user preference features, improves recommendation accuracy and generalization ability, mitigates cross-domain negative transfer, enhances the characterization of interaction patterns, and improves recommendation performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121051306B_ABST
    Figure CN121051306B_ABST
Patent Text Reader

Abstract

The application provides a cross-domain recommendation method, system, device and storage medium based on contrast learning, wherein the method comprises: constructing a user-item collaborative graph; then performing enhancement and denoising processing on the collaborative graph to generate enhanced and denoised views; then dividing positive and negative prototypes; finally, fusing the multiple views and the positive and negative prototypes through contrast learning, filtering noise and optimizing user preference feature representation, and finally constructing a cross-domain user preference model. The application proposes a noise elimination mechanism based on graph enhancement and graph denoising: globally, the graph structure core information is reserved by Gaussian resampling, locally, low-quality edges are dynamically filtered by random mask, and double denoising is realized in combination with edge quality evaluation. The application first introduces a user-prototype similarity division mechanism: the user preference is mapped to positive / negative prototypes, and the prototype guided feature selection of contrast learning is combined to make the preference aggregate to the positive prototype and away from the negative prototype, accurately model the real preference of the user, and improve the quality of the basic data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of negative transfer in cross-domain recommendation, and specifically relates to cross-domain recommendation methods, systems, devices, and storage media based on contrastive learning. Background Technology

[0002] In the field of recommender systems, the sufficiency of user behavior data directly determines the recommendation effect. When the target domain (such as emerging niche sports equipment recommendations) suffers from a small user base and sparse interaction records, making it difficult to accurately characterize user preferences, cross-domain recommendation becomes a key approach to overcome data bottlenecks. Its core logic is to transfer the rich user-item interaction data and preference features from the source domain (such as mature mass-market clothing recommendations) to the target domain. This "data sharing" compensates for the scarcity of data in the target domain, thereby improving the accuracy and generalization ability of recommendations in the target domain.

[0003] Currently, cross-domain recommendation faces three core constraints in practical applications, which directly affect recommendation performance and are prone to negative transfer: First, data noise interferes with the effective extraction of users' true preferences, resulting in insufficient basic data quality; second, the neglect of potential collaborative relationships between users and items leads to missing feature dimensions, making it difficult to fully characterize interaction patterns; third, the feature distributions of the source domain and the target domain differ significantly, making it difficult for source domain features to be effectively adapted to the target domain, thus generating transfer bias. Summary of the Invention

[0004] To address the problems in the background art, this invention proposes a cross-domain recommendation method, system, device, and storage medium based on contrastive learning.

[0005] To achieve the above objectives, the present invention adopts the following technical solution:

[0006] A cross-domain recommendation method based on contrastive learning includes the following steps:

[0007] Obtain user-item interaction information from at least two domains. Based on overlapping user information between domains, treat the interactions between overlapping users and items as shared information and the interactions between non-overlapping users and items as domain-specific information, and construct a user-item collaboration graph.

[0008] Perform graph data augmentation and denoising on the user-item collaboration graph to generate augmented and denoised views;

[0009] Based on the user-item collaboration graph, an enhanced view on the user side and an enhanced view on the item side are generated;

[0010] The shared information and domain-specific information are clustered to extract common features of user behavior patterns. Based on the similarity between users and common features, they are divided into positive and negative prototypes, where positive prototypes represent features that are highly correlated with user preferences and negative prototypes represent features that deviate from user preferences.

[0011] By employing a contrastive learning mechanism, the enhanced view, denoised view, user-side enhanced view, item-side enhanced view, positive prototype, and negative prototype are integrated to filter noise and optimize user preference feature representation, thereby constructing a cross-domain user preference model.

[0012] Furthermore, user-item interaction information from multiple domains is acquired. Based on overlapping user information between domains, interactions between overlapping users and items are treated as shared information, while interactions between non-overlapping users and items are treated as domain-specific information. A user-item collaboration graph is constructed, including the following steps:

[0013] Based on the interaction information of users and items in the source and target domains, construct the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain respectively; based on the user sets of the source and target domains, identify overlapping users and non-overlapping users, treat the interaction information of overlapping users and items as shared information, and treat the interaction information of non-overlapping users and items as specific information of their respective domains.

[0014] Extracting item information from interactions with overlapping users into shared item embeddings, and extracting item information from interactions with non-overlapping users into domain-specific item embeddings.

[0015] Based on the interaction information between users and items, construct user-side collaboration graphs and item-side collaboration graphs.

[0016] Furthermore, data augmentation and denoising are performed on the user-item collaboration graph to generate augmented and denoised views, including the following steps:

[0017] Based on the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain, the potential distribution of each user is modeled as a Gaussian distribution, and the potential embedding of each user is sampled from the Gaussian distribution;

[0018] Based on the potential embeddings of each user, the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain are reconstructed;

[0019] Define a reconstruction loss and introduce cross-entropy to measure the initial adjacency matrix. Similarity to the reconstructed adjacency matrix, and the addition of a regularization term L. KL To limit the difference between the latent distribution and the standard normal distribution;

[0020] The reconstructed adjacency matrix is ​​treated as an augmented view, and cross-entropy and KL divergence regularization terms are used to constrain the augmented view;

[0021] Calculate the binary edge mask and apply it to the initial adjacency matrix to obtain the denoised adjacency matrix;

[0022] The denoised adjacency matrix is ​​used as the denoised view.

[0023] Further, based on the user-item collaboration graph, user-side enhanced views and item-side enhanced views are generated, including the following steps:

[0024] Acquire user behavior data from the user-item collaboration graph, design prompts for each user based on their historical interactions, and generate user interest text.

[0025] Cluster interest-based texts to form reusable interest units;

[0026] Construct a user interest graph based on interest units, and turn abstract interest nodes;

[0027] Obtain a knowledge graph containing item categories, information, and relationships between items from a public knowledge base, and query the item sets in the source and target domains. Based on the item entity projection set, align the entities of the item-side collaboration graph to the recommended items to obtain a knowledge view consistent with the item space.

[0028] A training view is constructed to introduce user-side and item-side knowledge with minimal structural perturbation, and directional alignment is achieved using the user-side collaboration graph and the item-side collaboration graph as anchors.

[0029] By merging the user-side collaboration graph and the user interest graph, an enhanced user-side view is obtained.

[0030] The item-side collaboration graph and knowledge view are merged to obtain the item-side enhanced view.

[0031] Furthermore, the shared information and domain-specific information are clustered to extract common features of user behavior patterns. Based on the similarity between users and these common features, they are divided into positive and negative prototypes, including the following steps:

[0032] Define several prototype sets, each prototype set representing the corresponding preference;

[0033] Calculate the similarity between the user and the prototype, and consider those with a similarity greater than or equal to a set value as positive prototypes and those with a similarity less than a set value as negative prototypes;

[0034] The similarity between the set of users and the set of positive prototypes and the set of negative prototypes is calculated as a weight for introducing contrastive learning of positive prototype preferences.

[0035] Furthermore, through a contrastive learning mechanism, the enhanced view, denoised view, generated user-side enhanced view, item-side enhanced view, positive prototype, and negative prototype are fused to filter noise and optimize user preference feature representation, thereby constructing a cross-domain user preference model, including the following steps:

[0036] Positive samples are formed by selecting the embeddings of the same user node in the enhanced view and the denoised view, and negative samples are formed by selecting the embeddings of different user nodes. Based on the positive and negative samples, comparative learning between views is carried out.

[0037] On the user side, the representation of the same user in the user collaboration graph and the enhanced user collaboration graph is defined as a positive sample; on the item side, the representation of the same item in the item collaboration graph and the enhanced item collaboration graph is defined as a positive sample; negative samples on the user side and the item side are generated by randomly sampling the representations of other users or items in the collaboration graph and the enhanced collaboration graph; then comparative learning is performed on the user side and the item side.

[0038] The selected positive prototype is used as the positive sample for contrastive learning, and the selected negative prototype is used as the negative sample for contrastive learning, and contrastive learning is carried out between the positive and negative prototypes.

[0039] By combining the comparative learning results between views, between the user-side augmented view and the item-side augmented view, and between the positive and negative prototypes, noise is filtered and the user preference feature representation is optimized to build a cross-domain user preference model.

[0040] A cross-domain recommendation system based on prototype contrastive learning to mitigate negative transfer includes:

[0041] The collaboration graph construction unit is used to obtain user-item interaction information in at least two domains. Based on the overlapping user information between domains, the interaction between overlapping users and items is used as shared information, and the interaction between non-overlapping users and items is used as domain-specific information to construct a user-item collaboration graph.

[0042] The enhancement and denoising unit performs data enhancement and denoising on the user-item collaboration graph, generating enhanced and denoised views;

[0043] The view processing unit is used to generate a user-side enhanced view and an item-side enhanced view based on the user-item collaboration graph.

[0044] The prototype partitioning unit is used to cluster the shared information and domain-specific information, extract common features of user behavior patterns, and divide users into positive prototypes and negative prototypes based on the similarity between users and common features. Positive prototypes represent features that are highly related to user preferences, while negative prototypes represent features that deviate from user preferences.

[0045] The contrastive modeling unit is used to fuse the enhanced view, denoised view, generated user-side enhanced view, item-side enhanced view, positive prototype and negative prototype through a contrastive learning mechanism, filter noise and optimize user preference feature representation to build a cross-domain user preference model.

[0046] Furthermore, the collaborative graph construction unit includes:

[0047] The identification module is used to construct the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain based on the interaction information of users and items in the source domain and the target domain, respectively; and to identify overlapping users and non-overlapping users based on the user sets of the source domain and the target domain, taking the interaction information of overlapping users and items as shared information and the interaction information of non-overlapping users and items as specific information of their respective domains.

[0048] The extraction module is used to extract item information that is interacted with by overlapping users into shared item embeddings, and to extract item information that is interacted with by non-overlapping users into domain-specific item embeddings.

[0049] The collaboration graph construction module is used to build user-side collaboration graphs and item-side collaboration graphs based on the interaction information between users and items.

[0050] Furthermore, the enhanced noise reduction unit includes:

[0051] A module is used to model the latent distribution of each user as a Gaussian distribution based on the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain, and to sample the latent embedding of each user from the Gaussian distribution;

[0052] The reconstruction module is used to reconstruct the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain based on the potential embeddings for each user.

[0053] The enhancement unit is used to define a reconstruction loss, introducing cross-entropy to measure the initial adjacency matrix. Similarity to the reconstructed adjacency matrix, and the addition of the regularization term L. KL To limit the difference between the latent distribution and the standard normal distribution; and to treat the reconstructed adjacency matrix as an augmented view, and to limit the augmented view with cross-entropy and KL divergence regularization terms;

[0054] The denoising module is used to calculate the binary edge mask and apply it to the initial adjacency matrix to obtain the denoised adjacency matrix; and to treat the denoised adjacency matrix as a denoised view.

[0055] Furthermore, the view processing unit includes:

[0056] The interest graph construction module is used to acquire user behavior data of the user-item collaboration graph, design prompt words based on the user's historical interactions for each user, generate user interest text, cluster interest text to form reusable interest units, and construct user interest graph based on interest units, thus turning abstract interest nodes.

[0057] The knowledge view construction module is used to obtain a knowledge graph containing item categories, information and relationships between items from a public knowledge base and query the item sets in the source and target domains. Based on the item entity projection set, the entities of the item-side collaboration graph are aligned to the recommended items to obtain a knowledge view consistent with the item space.

[0058] The training view construction module is used to build training views, introduce user-side and item-side knowledge with minimal structural perturbation, and achieve orientation alignment using user-side collaboration graph and item-side collaboration graph as anchors.

[0059] The merging module is used to merge the user-side collaboration graph and the user interest graph to obtain the user-side enhanced view; and to merge the item-side collaboration graph and the knowledge view to obtain the item-side enhanced view.

[0060] Furthermore, the prototype partitioning unit includes:

[0061] The definition module is used to define several prototype sets, each of which represents a corresponding preference.

[0062] The calculation module is used to calculate the similarity between users and prototypes, and to regard those with similarity greater than or equal to a set value as positive prototypes and those with similarity less than a set value as negative prototypes; and to calculate the similarity between users and the set of positive prototypes and the set of negative prototypes, as a weight for introducing contrastive learning of positive prototype preferences.

[0063] Furthermore, the comparison modeling unit includes:

[0064] The comparison module is used to select the embeddings of the same user node in the enhanced view and the denoised view to form positive samples, and to select the embeddings of different user nodes to form negative samples. Based on the positive and negative samples, comparison learning is performed between views. It is also used to define the representation of the same user in the user collaboration graph and the enhanced user collaboration graph as positive samples on the user side, and the representation of the same item in the item collaboration graph and the enhanced item collaboration graph as positive samples on the item side. Negative samples on the user side and the item side are generated by randomly sampling the representations of other users or items in the collaboration graph and the enhanced collaboration graph. Then, comparison learning is performed on the user side and the item side. Finally, it is used to use the selected positive prototypes as positive samples for comparison learning, and the selected negative prototypes as negative samples for comparison learning, to perform comparison learning between positive and negative prototypes.

[0065] The modeling module is used to combine the comparative learning results between views, between the user-side augmented view and the item-side augmented view, and between the positive and negative prototypes to filter noise and optimize the user preference feature representation, thereby building a cross-domain user preference model.

[0066] An electronic device, comprising:

[0067] Memory, used to store computer programs;

[0068] When a processor executes a computer program stored in memory, it implements the aforementioned cross-domain recommendation method based on contrastive learning.

[0069] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned cross-domain recommendation method based on contrastive learning.

[0070] The beneficial effects of this invention are:

[0071] 1. This invention proposes a noise elimination mechanism based on graph enhancement and graph denoising: global Gaussian resampling is used to preserve the core information of the graph structure, local random masking is used to dynamically filter low-quality edges, and edge quality evaluation is combined to achieve dual denoising.

[0072] 2. This invention infers and clusters user interests, structuring them into user-side knowledge; it then merges this knowledge with the object entity projection in the knowledge graph to construct a collaborative interest knowledge graph covering both the user and object sides, enhancing interaction representation and fully depicting interaction patterns.

[0073] 3. This invention introduces a user-prototype similarity partitioning mechanism for the first time: it maps user preferences to positive / negative prototypes, and combines prototype-guided feature selection with contrastive learning to make preferences aggregate toward positive prototypes and move away from negative prototypes, accurately modeling users' real preferences and improving the quality of basic data.

[0074] 4. This invention integrates denoised multi-view comparison (enhanced view and denoised view), collaborative enhanced view (user side and item side) and prototype comparison (positive / negative prototype), effectively learning collaborative relationships while suppressing noise, improving user representation and cross-domain alignment, and mitigating cross-domain negative transfer.

[0075] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures pointed out in the description and the drawings. Attached Figure Description

[0076] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0077] Figure 1 A flowchart of a cross-domain recommendation method based on contrastive learning according to the present invention is shown;

[0078] Figure 2 A flowchart of the enhanced view generation of the present invention is shown;

[0079] Figure 3 A flowchart of the denoised view generation method of the present invention is shown;

[0080] Figure 4 A flowchart illustrating the generation of a collaborative enhanced view between the user side and the item side according to the present invention is shown;

[0081] Figure 5 A clustering diagram of the present invention is shown;

[0082] Figure 6 A framework diagram of a cross-domain recommendation system based on contrastive learning according to the present invention is shown. Detailed Implementation

[0083] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0084] like Figure 1 The diagram illustrates a cross-domain recommendation method based on contrastive learning, comprising the following steps:

[0085] S1: Obtain user-item interaction information and user-item feedback in at least two domains (such as source domain and target domain). Based on overlapping user information between domains, treat overlapping user-item interactions as shared information and non-overlapping user-item interactions as domain-specific information. Construct user-item collaboration graphs for the source and target domains based on the interaction information in each domain. Further subdivide these graphs into user collaboration graphs and item collaboration graphs according to user ratings and item attributes, providing foundational data for subsequent feature extraction and comparative learning.

[0086] S2: Perform graph data augmentation and denoising on the user-item collaboration graph to generate augmented and denoised views. For example, a variational graph autoencoder is used to Gaussianize the node distribution, resampling user and item interactions to generate diverse and information-rich augmented views, improving data expressiveness without compromising the core structure. Then, node quality is evaluated based on interactions, low-quality nodes are treated as noise and randomly masked and discarded, generating denoised views to filter irrelevant information and enhance data purity.

[0087] S3: Based on the user-item collaboration graph, it uses a large language model to abstract and cluster user interests and a knowledge graph to project items as entities, generating augmented views on the user side and the item side. It also learns the collaboration relationship between the user side and the item side through comparison, which facilitates the enrichment of feature representation.

[0088] S4: Cluster shared information and domain-specific information to extract common features of user behavior patterns. Based on the similarity between users and these common features, they are divided into positive and negative prototypes. Positive prototypes represent features highly correlated with user preferences, while negative prototypes represent features deviating from user preferences. It should be noted that in cross-domain scenarios, user behavior across different domains may exhibit heterogeneity. Specific enhancements on the user or item side of a single domain cannot capture common user preferences across domains. Therefore, a prototype enhancement mechanism is introduced to cluster shared and domain-specific information to extract common features of user behavior patterns. Based on the similarity between users and these common features, they are divided into positive and negative prototypes. Positive prototypes represent features highly correlated with user preferences, while negative prototypes represent features deviating from user preferences. Based on the shared information mentioned above, common features of user behavior patterns across multiple domains can be extracted through clustering. Based on domain-specific information, the characteristics of user behavior patterns within a single domain can be extracted through clustering. Finally, based on the similarity between users and the cluster centers of the extracted commonalities and characteristics, a positive prototype that conforms to the user's behavior pattern and a negative prototype that deviates from the behavior pattern can be generated for each user.

[0089] S5: Through a contrastive learning mechanism, enhanced views, denoised views, user-side enhanced views, item-side enhanced views, positive prototypes, and negative prototypes are integrated to filter noise and optimize user preference feature representation, constructing a cross-domain user preference model. Specifically, the denoised enhanced view generated in step S2 is compared with the denoised view to filter noise interference and enhance the expressive power of user features. The user and item enhancements in S3 are then compared collaboratively to enrich feature representation. Combined with the positive and negative prototype division in step S4, the user is compared with the positive and negative prototypes, guiding user preference features to converge towards the positive prototype and move away from the negative prototype, thereby achieving noise filtering and accurate modeling of preference features.

[0090] For example, S1 specifically includes the following steps:

[0091] S101: Based on the user and item interaction information in the source and target domains, construct the initial adjacency matrix A for the source domain. s The initial adjacency matrix A of the target domain t If user U i And item V j If there is interaction, then A i,j =1, otherwise A i,j =0. The initial adjacency matrix above is used to represent the interaction structure between users and items, providing a foundation for subsequent modeling. Then, based on the user sets of the source and target domains, overlapping and non-overlapping users are identified. The interaction information between overlapping users and items is taken as shared information, while the interaction information between non-overlapping users and items is taken as domain-specific information.

[0092] S102: Extract item information from overlapping user interactions and embed it into shared items in V. g This represents common preferences across domains; for non-overlapping users, the item information they interact with is extracted as item embeddings for specific domains. s Capturing domain-specific behavioral patterns and separating shared item embeddings from domain-specific item embeddings helps in the subsequent accurate modeling and optimization of user preferences.

[0093] S103: Based on the interaction information between users and items, construct user-side collaboration graphs and item-side collaboration graphs. Specifically, based on the interaction information between users and items and user feedback on items, construct user-side collaboration graph G. u =(VR,E+), where VR=U∪V, U represents the set of users, V represents the set of items, and E+ is the set of historical positive feedback interactions between users and items; simultaneously, an item-side collaboration graph Gv={(h,r,t)} is constructed, along with a projection set V that summarizes the entity attributes of items. p ={(V,e)}, the entity projection set of this item is used to align item V in the recommendation domain with entity e in the knowledge graph. This provides external knowledge and alignment basis for subsequent fusion.

[0094] For example, S2 specifically includes the following steps:

[0095] S201: Based on the initial adjacency matrices of the source and target domains in S101, the latent distribution of each user is modeled as a Gaussian distribution, with its mean and standard deviation vectors parameterized. Then, using a reparameterization technique, the latent embeddings of each user are sampled from the Gaussian distribution to introduce diversity.

[0096]

[0097] (3)

[0098] in, User The initial embedding of (the i-th user u), and It is a learnable weight matrix. It is random noise sampled from a standard normal distribution. Represents element-wise multiplication; Indicates user u i The standard deviation vector of the Gaussian distribution to which the latent embedding follows measures the degree of dispersion of the Gaussian distribution, determines the "range of fluctuation" when sampling from the distribution, and reflects the degree of uncertainty of the user's latent embedding. Indicates user u i The mean vector of the Gaussian distribution that the latent embedding follows is the center of the Gaussian distribution, which represents the "core" or "typical" value direction of the user's latent embedding. This represents a standard normal distribution. Through this sampling method, structurally consistent but controlled randomness in the node latent embeddings are generated, thereby enhancing the diversity of the augmented view.

[0099] S202: Calculate the two user u using formulas (1)-(3) i and u j The latent embedding z of (the j-th user u) i and z j Verify user u through decoder i and u j The probability of an edge exists between them is determined, and the initial adjacency matrix of the reconstruction is constructed, as detailed in formula (4).

[0100] (4)

[0101] In the formula, σ is the Sigmoid activation function; A represents the initial adjacency matrix; This represents the reconstructed adjacency matrix. The structural relationships of the original graph are preserved during this process, allowing for the generation of new, enhanced views.

[0102] S203: To ensure that the augmented view retains the structural information of the original graph, a reconstruction loss is defined, and cross-entropy is introduced to measure the similarity between the initial adjacency matrix A and the reconstructed adjacency matrix:

[0103] (5)

[0104] In the formula, L re For reconstruction loss; A i,j This represents the element in the i-th row and j-th column of the initial adjacency matrix A; Represents the reconstructed adjacency matrix The element in the i-th row and j-th column.

[0105] Meanwhile, to prevent overfitting of the model and ensure the smoothness of the latent space, a regularization term L is added. KL To limit the difference between the latent distribution and the standard normal distribution:

[0106] (6)

[0107] In the formula, These are the standard deviation vector and mean vector generated from S201 using a Gaussian distribution, respectively. denoted by , and d denotes the dimension of the latent distribution. This regularization term is used to limit the complexity of the augmented view, prevent the generated augmented view from deviating excessively from the original graph structure, and ensure that the generated latent embeddings have reasonable diversity and structural consistency.

[0108] S204: As Figure 2 As shown, the reconstructed adjacency matrix is ​​viewed To enhance View1, the enhanced View1 is constrained based on reconstruction loss and KL divergence regularization to ensure consistency with the original structure and capture more global information. Finally, the adjacency matrices of the source and target domains created in S101 are used... Repeat steps S201 to S203 to generate enhanced views of the source and target domains respectively. and This also provides diverse view inputs for subsequent comparative learning.

[0109] S205: Calculate the binary edge mask and apply it to the initial adjacency matrix to obtain the denoised adjacency matrix. Specifically, perform edge quality evaluation calculations, identify locally noisy edges, and then evaluate the quality of edge (i,j) in each layer of the graph neural network (GCN), and calculate the quality based on the edge's evaluation score. Generate binary edge masks using the Gumbel-Softmax technique. :

[0110] (7)

[0111] (8)

[0112] in, User The embedded splicing result in the previous layer; User The embedded splicing result in the previous layer; It is the learnable weight matrix of the current layer. It is the Sigmoid activation function. It is random noise sampled from the Gumbel distribution. Temperature parameters control the smoothness of the sampling. This represents the binary edge mask of the adjacency matrix generated by the evaluation scores of the edges in the last layer, with low-quality edges represented by 0 and high-quality edges represented by 1.

[0113] Next, the binary edge mask in S205 Applying this to the initial adjacency matrix A yields the denoised adjacency matrix. :

[0114] (9)

[0115] In the formula, This indicates an element-wise multiplication operation, which dynamically filters noisy edges using a mask while preserving information about key edges.

[0116] S206: To encourage the retention of valuable edges while avoiding excessive deletion of important edges, the following regularization term is introduced. L de :

[0117] (10)

[0118] In the formula, Indicates in the parameter Below, given hour, The probability that E = 0; J Represents the set of edges.

[0119] This regularization term ensures that the denoised graph structure retains necessary information by minimizing the probability that an edge is identified as noise, while avoiding excessive denoising that could damage the integrity of the graph structure.

[0120] S207: Treat the denoised adjacency matrix as a denoised view. Specifically, as follows: Figure 3 As shown, the denoised adjacency matrix obtained in S206 View2 is treated as a denoised view, and the regularization term in S206 is optimized. This process preserves key edges while removing noisy ones, resulting in a denoised view that is structurally clean and retains complete information. Then, based on the adjacency matrix of the source domain created in S1... Adjacency matrix of the target domain Repeat steps S201 to S206 respectively to generate denoised views of the source and target domains. and .

[0121] For example, S3 includes the following steps:

[0122] S301: As Figure 4 The process shown first involves designing a unique prompt word PU based on each user u's historical interaction records E+. An example prompt word template is as follows: "Based on the user's historical interaction data below, summarize their stable interests from the provided information only; output 3-8 noun phrases, ensuring semantic deduplication and medium granularity. Mark the confidence level of each interest in parentheses within the range of 0-1, and list 1-2 sample item titles to support each interest."

[0123] Subsequently, the Large Language Model (LLM) is invoked and the prompt word Pu is input to generate the user's interest text description Au; the interest texts of all users are then aggregated to obtain the interest text set A'={A'1,A'2,...,A'...} |U| Its form can be represented as Au=LLM(Pu,E+).

[0124] This process can fully utilize LLM's ability to abstract and generalize user behavior, generating interest descriptions that are readable, interpretable, and strongly correlated with actual user behavior from sparse user interaction data, effectively making up for the lack of user-side knowledge structure.

[0125] S302: Cluster the interest texts to form reusable interest units. Specifically, represent Au in S301 as text and cluster it into K interest clusters, resulting in J={j1,j2,...,jk}, denoted as J=fC(Au,k). Clustering merges semantic neighbors to form reusable interest units. k represents the control strength to balance expressive power and generalization ability, eliminate redundancy caused by synonymous different expressions and illusions, and avoid the subsequent graph structure being fragmented by synonyms.

[0126] S303: Construct a user interest graph based on interest units, and abstract interest nodes. Specifically, construct the user interest graph G. i First, abstract user interests are transformed into nodes in a graph, thereby introducing higher-order collaborative association pathways on the user side; the set of nodes Q in the graph is defined. J =U∪J, where U represents the user and J represents the set of interest nodes.

[0127] Next, by calculating the similarity between user U's interest text and the centers of each interest cluster, it is determined whether the user possesses a certain interest j. If the determination result is "possess", then an edge (u,j) is added, ultimately forming the user interest graph G. i =(V J E J ), where E J It is the set of edges in the graph.

[0128] This graph uses interest nodes as "bridges" to connect users with the same interests within the graph structure. Even in scenarios where user interaction data is sparse, this pathway can effectively spread information about the similarity between users.

[0129] S304: Obtain a knowledge graph containing item categories, information, and relationships between items from a public knowledge base, and query the item sets in the source and target domains. Based on the entity projection set of the items, align the entities in the item-side collaboration graph to the recommended items, obtaining a knowledge view consistent with the item space. Specifically, map the entities of the knowledge graph KG to the item domain, unify the node space, and avoid negative transfer caused by semantic misalignment. Define a mapping function M(·) using the projection set P to align the entity e in the item-side collaboration graph to the recommended item V, obtaining a knowledge view M(·) consistent with the item space. Once aligned, relationships in the knowledge graph can propagate directly in the item node space and interact with collaborative signals.

[0130] S305: Construct three training views. The idea is to introduce user-side and item-side knowledge respectively while minimizing graph structure perturbation, and use the collaborative view as an anchor point to achieve directional alignment. The specific implementation is as follows:

[0131] Using a unified graph encoder LightGCN and an initial embedding vector Z, a collaborative view is first constructed, which contains only the user-side collaborative graph G. u The representation-level perturbation γ can be selectively added for regularization as needed, and its embedding calculation process is denoted as:

[0132] = (11)

[0133] In the formula, Z represents the initial embedding vector generated from the user-item collaboration graph, used to represent the original user interaction information; G u For the user collaboration graph, γ is used as a perturbation term to enhance robustness during regularization while maintaining the integrity of the graph structure. The reconstructed node embeddings can be obtained using an encoder called LightGCN.

[0134] This process uses the pure collaborative view as the anchor point of the recommendation domain, which ensures that the subsequent view alignment target always serves the recommendation task itself. At the same time, by introducing the representation-level perturbation γ, the robustness of the model to noisy data can be further enhanced without destroying the integrity of the original graph structure.

[0135] S306: Merge the user-side collaboration graph and the user interest graph to obtain the user-side enhanced view. :

[0136] (12)

[0137] Encoding results in:

[0138] (13)

[0139] In the formula, G u For user collaboration graph, For a graph representing the set of users contained in a user interest node, an enhanced user collaboration graph is generated by merging the user collaboration graph with the user interest graph. Simultaneously, the initial embedding vector Z is combined with the enhanced user collaboration graph. The embedding process is performed, and finally the reconstructed node embeddings are obtained through an encoder. .

[0140] The user-side structural knowledge is introduced by "edge merging" to maximize the preservation of the real structure, and random deletion or modification of the structure is avoided to prevent the loss of useful information.

[0141] S307: Item-side Collaboration Map and knowledge view M ( V P Merge to obtain an enhanced view of the item side. :

[0142] (14)

[0143] Encoding results in:

[0144] (15)

[0145] In the above formula, the item collaboration graph is used. A knowledge view M (which is supplemented by information on items in the domain searched through an external knowledge graph) V p Merge the items to generate an enhanced item collaboration graph. Subsequently, the initial embedding vector Z is combined with the enhanced item co-graph. The input is fed into the encoder to generate enhanced embedding vectors on the item side. .

[0146] By integrating KG relationships and collaborative relationships in the same node space, the true relationships are preserved and useless perturbations are reduced through "merging rather than perturbation", which facilitates stable alignment of comparative learning.

[0147] S308: The overall generation process is as follows Figure 4 As shown, simultaneously on the user-item collaboration graph G, the model generates the final user and item embeddings through forward propagation. Optimize the recommendation loss using BPR:

[0148] (16)

[0149] In the formula, Let u represent user, i represent positive sample, and i represent negative sample. σ(•): represents the activation function (usually Sigmoid), used to measure the difference in scores between positive and negative samples. It is the difference between the positive sample score and the negative sample score of user u.

[0150] For example, S4 includes the following steps:

[0151] S401: Define several sets of prototypes Each prototype This represents a type of preference, where K is the number of prototypes. Furthermore, based on their similarity to the user, the 2K prototypes are divided into K positive prototypes and K negative prototypes. Positive prototypes represent features that align with the user's preferences, while negative prototypes represent features that contradict the user's preferences.

[0152] (17)

[0153] In the formula, Representing the i-th prototype, K positive prototypes and K negative prototypes are selected from the model; p i Data types and dimensions.

[0154] S402: Local features of user-item interactions are extracted through convolution operations to capture high-order dependencies between users and items, and these dependencies are flattened into a one-dimensional vector for subsequent global information extraction. Then, linear transformations are applied to combine user embeddings, local features, and the user set. Interaction score between items To extract global features. The calculation formula is as follows:

[0155] (18)

[0156] In the formula, W c [u, v] represents the weight matrix of the convolution kernel; [u, v] represents the concatenation of user and item embeddings. W l The weight matrix is ​​linearly variable.

[0157] S403: Transfer the local information from S402 and global information The data is then fused to generate the final user feature representation:

[0158] (19)

[0159] In the formula, W represents the trainable weight matrix, and u represents the user. It is the Sigmoid activation function, which can introduce more complex nonlinearity, enabling neural networks to learn and express more complex patterns and features.

[0160] S404: Obtain representations of domain-specific information and shared information. Specifically, input the user embedding and the domain-specific item embedding extracted in S103. and embedded shared items Together with the interaction score B, the user's domain-specific feature representation is extracted through a feature fusion process. F s Shared feature representation F g :

[0161] (20)

[0162] In the formula, This represents a set of items within a domain-specific set of information, along with their corresponding item ratings (based on the number of interactions). This represents a set of items in the shared information of a domain, along with their corresponding item ratings (based on the number of interactions). and It is the set of all trainable parameters in a hybrid network of domain-shared information and domain-specific information; f It is a fusion network in S403 used to generate the final feature representation; u represents the user.

[0163] Furthermore, by using a multilayer perceptron (MLP) to perform linear transformation and mapping on domain-specific features and domain-shared features, the distributions of the two types of features are aligned, eliminating distribution differences between features and improving the generality of features.

[0164] ;(twenty one)

[0165] In the formula, F s and F g It is a feature representation obtained by fusing domain-shared information and domain-specific information through a hybrid network, and then further fusing the two through a multilayer perceptron (MLP).

[0166] S405: As Figure 5 As shown, the K-Means clustering algorithm is used to analyze the features. F s and F gClustering is performed, where each cluster center is represented as a prototype, indicating that a commonality of a class of user behaviors has been captured.

[0167] S406: Calculate the similarity between the user and the prototype, based on user u i Specific fields and prototype set Perform the calculation:

[0168] ;(twenty two)

[0169] In the formula, sim() is the cosine similarity, and p i To obtain the i-th prototype, F i To represent user i, a parameter is introduced to prevent the denominator from being too small. Perform smoothing; Represents a constant.

[0170] Based on the similarity calculation between each user and the prototype, those with high similarity are considered positive prototypes, and those with low similarity are considered negative prototypes. For user i, 2k prototypes are classified into K positive prototypes. and K negative prototypes .in, It is a small constant used for numerical stability.

[0171] S407: Calculate the similarity between the set of users and positive prototypes and the set of negative prototypes, as a weight for introducing contrastive learning of positive prototype preferences:

[0172] ;(twenty three)

[0173] In the formula, It is to calculate a user s The distance between the representation and the set of prototypes of the partition. , It is a computing user s Distance to the partitioned negative prototype set .

[0174] S408: Prototype Optimization Based on Clustering, Separation, and Diversity Constraints. Specifically, to achieve accurate modeling of user preferences, we jointly optimize three types of prototype objectives: clustering constraints encourage user features to closely approximate their corresponding prototypes, ensuring each prototype accurately represents a class of user preferences; separation constraints increase the similarity between user features and their positive prototypes while weakening the similarity with negative prototypes (prototypes not belonging to the same type), strengthening category discriminative power; diversity constraints maintain the differences between different prototypes, preventing multiple prototypes from becoming too similar and reducing expressive power. The synergistic effect of these three constraints enables the prototype set to comprehensively and efficiently express user preferences.

[0175] ;(twenty four)

[0176] (25)

[0177] Finally, the weights are used. , , The formula for balancing clustering, segregation, and diversity is as follows:

[0178] (26)

[0179] In the formula, For clustering constraints, N is the total number of users. For the i-th user, Let be the prototype to which user i belongs, which is also the i-th prototype. This term ensures that the user embedding is close to the prototype of its category by minimizing the Euclidean distance between the user embedding and its closest prototype, thereby achieving the clustering effect. To separate constraints, This represents the set of prototypes other than the prototype of the category to which user i belongs. f i For the initial embedding of user i, the class distinction is enhanced by maximizing the distance between user features and negative prototypes (prototypes that do not belong to the same class), thus avoiding user features from different classes being too similar. For diversity constraints, C is the total number of prototype partitions; p j For the j-th prototype, the cosine similarity between prototypes is limited to a threshold. The representations between prototypes are more dispersed, which improves the model's representational power and thus avoids different prototypes from being too similar.

[0180] For example, S5 includes the following steps:

[0181] S501: Select embeddings of the same user node from both the enhanced view and the denoised view to form positive samples, and select embeddings of different user nodes to form negative samples. Based on the positive and negative samples, perform inter-view comparison learning. Specifically, select the enhanced view... and denoised view Embeddings of the same user node constitute positive samples. By maximizing the similarity of positive sample pairs, the model is encouraged to capture key information, making the representation of the same user more consistent across different views. and In this process, embeddings of different user nodes are selected to form negative sample pairs. By minimizing the similarity of negative sample pairs, noise interference is prevented, ensuring that the representations of different nodes can be effectively distinguished. Based on positive and negative sample pairs, inter-view comparative learning is performed. The optimization objective is to ensure that the embeddings of the same user node in the enhanced view and the denoised view are as close as possible, while being far away from the embeddings of other user nodes.

[0182] (27)

[0183] In the formula, where represent , represent This ensures that noise is removed through contrastive learning in each domain, resulting in consistent user embedding representations across views. Similarly, for... and The operation is the same. Temperature is a parameter used to adjust the smoothness of the similarity distribution in contrastive learning. Smaller temperature values ​​result in a sharper distribution, amplifying the weight of similar samples; larger temperature values ​​result in a smoother distribution, enhancing sensitivity to distant samples.

[0184] S502: On the user side, the representation of the same user in the user collaboration graph and the enhanced user collaboration graph is defined as a positive sample; on the item side, the representation of the same item in the item collaboration graph and the enhanced item collaboration graph is defined as a positive sample; negative samples on the user side and the item side are generated by randomly sampling the representations of other users or items in the collaboration graph and the enhanced collaboration graph; then, contrastive learning is performed on the user side and the item side. Specifically, contrastive learning is used to align the collaboration domains, pushing useful information from the auxiliary domains into the collaboration space required for the recommendation task, while suppressing noise. Using the collaboration view as the anchor, cosine similarity s(a, b) and temperature τ are defined, and the representations of the same user in V1 generated in S201 and V2 generated in S202 are considered as positive pairs, and the representations of the same item in V1 generated in S201 and V3 generated in S203 are considered as positive pairs, establishing the InfoNCE target.

[0185] (28)

[0186] In the formula, on the user side, User u i The representations in the user collaboration graph and the user-enhanced collaboration graph are used as positive sample pairs. Indicates user u i and user u j The representations in the user collaboration graph and the user-enhanced collaboration graph are used as negative sample pairs. Similarly... For each positive sample pair of item i, For item i, there are negative sample pairs.

[0187] This loss forced Z vi Absorb from user interest view With KG view The effective signal is used to differentiate the data from other nodes, thereby enabling targeted knowledge transfer between the user side and the collaborative domain, as well as between the item side and the collaborative domain.

[0188] S503: The selected positive prototype is used as the positive sample for contrastive learning, and the selected negative prototype is used as the negative sample for contrastive learning; contrastive learning is then performed between the positive and negative prototypes. Specifically, the selected positive prototype... As positive samples for contrastive learning, user features are used. Closer to the original This encourages the model to capture the user's points of interest. The selected negative prototype... As negative samples for contrastive learning, user features are made... Further away from the negative prototype This ensures the model is not influenced by user rejection factors. The similarity between the acquired user and the positive / negative prototype sets represents the directionality of user preferences, introducing user preference weights into the contrastive learning process. This allows the contrastive learning objective to be dynamically adjusted, focusing on the user's true interests.

[0189] (29)

[0190] In the formula, and In S407, the distances between the user and the positive and negative prototype sets are calculated, where... and These are used as contribution weights to control the positive and negative prototypes, respectively. The positive and negative samples selected through prototype learning are compared and learned, and combined with dynamic weights, the user's preference representation is optimized so that user features are closer to the positive prototype and farther away from the negative prototype, ensuring accurate alignment of preferences.

[0191] in and These are used as contribution weights to control the positive and negative prototypes, respectively. The positive and negative samples selected through prototype learning are compared and learned, and combined with dynamic weights, the user's preference representation is optimized so that user features are closer to the positive prototype and farther away from the negative prototype, ensuring accurate alignment of preferences.

[0192] (30)

[0193] S504: Combining the contrast learning results between views, between user-side and item-side augmented views, and between positive and negative prototypes, noise is filtered and user preference feature representations are optimized to construct a cross-domain user preference model. Specifically, by jointly optimizing the contrast loss between denoised views, the contrast loss between user-side and item-side augmented views, and the contrast loss between prototypes, the synergistic effect of three contrast learning methods is achieved. This effectively suppresses noise in the denoised views while mining deep collaborative information from the augmented views of users and items, and dynamically calibrates the preference direction through inter-prototype comparison. Based on a prototype set constructed from the commonalities of user behavior, combined with denoising measures, the behavior of users in the target domain is predicted, ultimately generating accurate recommendation results.

[0194] like Figure 6 As shown, this is a cross-domain recommendation system based on prototype contrastive learning to mitigate negative transfer, including:

[0195] The collaboration graph construction unit is used to obtain user-item interaction information in at least two domains. Based on the overlapping user information between domains, the interaction between overlapping users and items is used as shared information, and the interaction between non-overlapping users and items is used as domain-specific information to construct a user-item collaboration graph.

[0196] The enhancement and denoising unit performs data enhancement and denoising on the user-item collaboration graph, generating enhanced and denoised views;

[0197] The view processing unit is used to generate a user-side enhanced view and an item-side enhanced view based on the user-item collaboration graph.

[0198] The prototype partitioning unit is used to cluster the shared information and domain-specific information, extract common features of user behavior patterns, and divide users into positive prototypes and negative prototypes based on the similarity between users and common features. Positive prototypes represent features that are highly related to user preferences, while negative prototypes represent features that deviate from user preferences.

[0199] The contrastive modeling unit is used to fuse the enhanced view, denoised view, generated user-side enhanced view, item-side enhanced view, positive prototype and negative prototype through a contrastive learning mechanism, filter noise and optimize user preference feature representation to build a cross-domain user preference model.

[0200] The collaborative graph construction unit includes:

[0201] The identification module is used to construct the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain based on the interaction information of users and items in the source domain and the target domain, respectively; and to identify overlapping users and non-overlapping users based on the user sets of the source domain and the target domain, taking the interaction information of overlapping users and items as shared information and the interaction information of non-overlapping users and items as specific information of their respective domains.

[0202] The extraction module is used to extract item information that is interacted with by overlapping users into shared item embeddings, and to extract item information that is interacted with by non-overlapping users into domain-specific item embeddings.

[0203] The collaboration graph construction module is used to build user-side collaboration graphs and item-side collaboration graphs based on the interaction information between users and items.

[0204] The enhanced noise reduction unit includes:

[0205] A module is used to model the latent distribution of each user as a Gaussian distribution based on the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain, and to sample the latent embedding of each user from the Gaussian distribution;

[0206] The reconstruction module is used to reconstruct the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain based on the potential embeddings for each user.

[0207] The enhancement unit is used to define a reconstruction loss, introducing cross-entropy to measure the initial adjacency matrix. Similarity to the reconstructed adjacency matrix, and the addition of the regularization term L. KL To limit the difference between the latent distribution and the standard normal distribution; and to treat the reconstructed adjacency matrix as an augmented view, and to limit the augmented view with cross-entropy and KL divergence regularization terms;

[0208] The denoising module is used to calculate the binary edge mask and apply it to the initial adjacency matrix to obtain the denoised adjacency matrix; and to treat the denoised adjacency matrix as a denoised view.

[0209] The view processing unit includes:

[0210] The interest graph construction module is used to acquire user behavior data of the user-item collaboration graph, design prompt words based on the user's historical interactions for each user, generate user interest text, cluster interest text to form reusable interest units, and construct user interest graph based on interest units, thus turning abstract interest nodes.

[0211] The knowledge view construction module is used to obtain a knowledge graph containing item categories, information and relationships between items from a public knowledge base and query the item sets in the source and target domains. Based on the item entity projection set, the entities of the item-side collaboration graph are aligned to the recommended items to obtain a knowledge view consistent with the item space.

[0212] The training view construction module is used to build training views, introduce user-side and item-side knowledge with minimal structural perturbation, and achieve orientation alignment using user-side collaboration graph and item-side collaboration graph as anchors.

[0213] The merging module is used to merge the user-side collaboration graph and the user interest graph to obtain the user-side enhanced view; and to merge the item-side collaboration graph and the knowledge view to obtain the item-side enhanced view.

[0214] The prototype partitioning unit includes:

[0215] The definition module is used to define several prototype sets, each of which represents a corresponding preference.

[0216] The calculation module is used to calculate the similarity between users and prototypes, and to regard those with similarity greater than or equal to a set value as positive prototypes and those with similarity less than a set value as negative prototypes; and to calculate the similarity between users and the set of positive prototypes and the set of negative prototypes, as a weight for introducing contrastive learning of positive prototype preferences.

[0217] The comparison modeling unit includes:

[0218] The comparison module is used to select the embeddings of the same user node in the enhanced view and the denoised view to form positive samples, and to select the embeddings of different user nodes to form negative samples. Based on the positive and negative samples, comparison learning is performed between views. It is also used to define the representation of the same user in the user collaboration graph and the enhanced user collaboration graph as positive samples on the user side, and the representation of the same item in the item collaboration graph and the enhanced item collaboration graph as positive samples on the item side. Negative samples on the user side and the item side are generated by randomly sampling the representations of other users or items in the collaboration graph and the enhanced collaboration graph. Then, comparison learning is performed on the user side and the item side. Finally, it is used to use the selected positive prototypes as positive samples for comparison learning, and the selected negative prototypes as negative samples for comparison learning, to perform comparison learning between positive and negative prototypes.

[0219] The modeling module is used to combine the comparative learning results between views, between the user-side augmented view and the item-side augmented view, and between the positive and negative prototypes to filter noise and optimize the user preference feature representation, thereby building a cross-domain user preference model.

[0220] An electronic device, comprising:

[0221] Memory, used to store computer programs;

[0222] When a processor executes a computer program stored in memory, it implements the aforementioned cross-domain recommendation method based on contrastive learning.

[0223] It should be noted that the memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device.

[0224] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0225] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the aforementioned cross-domain recommendation method based on contrastive learning.

[0226] It should be noted that the computer-readable storage medium may be included in the device / apparatus described in the above embodiments; or it may exist independently and not assembled into the device / apparatus. The computer-readable storage medium carries one or more programs, which, when executed, implement a cross-domain recommendation method based on contrastive learning according to an embodiment of the present invention.

[0227] According to embodiments of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as: a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0228] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A cross-domain recommendation method based on contrastive learning, characterized in that, Includes the following steps: Obtain user-item interaction information from at least two domains. Based on overlapping user information between domains, treat the interactions between overlapping users and items as shared information and the interactions between non-overlapping users and items as domain-specific information, and construct a user-item collaboration graph. Perform graph data augmentation and denoising on the user-item collaboration graph to generate augmented and denoised views; Based on the user-item collaboration graph, user-side enhanced views and item-side enhanced views are generated, including: Acquire user behavior data from the user-item collaboration graph, design prompts for each user based on their historical interactions, and generate user interest text. Cluster interest-based texts to form reusable interest units; Construct a user interest graph based on interest units, and turn abstract interest nodes; Obtain a knowledge graph containing item categories, information, and relationships between items from a public knowledge base, and query the item sets in the source and target domains. Based on the item entity projection set, align the entities of the item-side collaboration graph to the recommended items to obtain a knowledge view consistent with the item space. A training view is constructed to introduce user-side and item-side knowledge with minimal structural perturbation, and directional alignment is achieved using the user-side collaboration graph and the item-side collaboration graph as anchors. By merging the user-side collaboration graph and the user interest graph, an enhanced user-side view is obtained. The item-side collaboration graph and knowledge view are merged to obtain the item-side enhanced view; The shared information and domain-specific information are clustered to extract common features of user behavior patterns. Based on the similarity between users and common features, they are divided into positive and negative prototypes, where positive prototypes represent features that are highly correlated with user preferences and negative prototypes represent features that deviate from user preferences. By using a contrastive learning mechanism, the enhanced view, denoised view, user-side enhanced view, item-side enhanced view, positive prototype, and negative prototype are integrated to filter noise and optimize user preference feature representation, thereby constructing a cross-domain user preference model.

2. The cross-domain recommendation method based on contrastive learning according to claim 1, characterized in that, To acquire user-item interaction information across multiple domains, and based on overlapping user information between domains, treat overlapping user-item interactions as shared information and non-overlapping user-item interactions as domain-specific information, construct a user-item collaboration graph, including the following steps: Based on the interaction information of users and items in the source and target domains, construct the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain respectively; based on the user sets of the source and target domains, identify overlapping users and non-overlapping users, treat the interaction information of overlapping users and items as shared information, and treat the interaction information of non-overlapping users and items as specific information of their respective domains. Extracting item information from interactions with overlapping users into shared item embeddings, and extracting item information from interactions with non-overlapping users into domain-specific item embeddings. Based on the interaction information between users and items, construct user-side collaboration graphs and item-side collaboration graphs.

3. The cross-domain recommendation method based on contrastive learning according to claim 2, characterized in that, Perform data augmentation and denoising on the user-item collaboration graph to generate augmented and denoised views, including the following steps: Based on the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain, the potential distribution of each user is modeled as a Gaussian distribution, and the potential embedding of each user is sampled from the Gaussian distribution; Based on the potential embeddings of each user, the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain are reconstructed; Define a reconstruction loss and introduce cross-entropy to measure the initial adjacency matrix. Similarity to the reconstructed adjacency matrix, and the addition of a regularization term L. KL To limit the difference between the latent distribution and the standard normal distribution; The reconstructed adjacency matrix is ​​treated as an augmented view, and cross-entropy and KL divergence regularization terms are used to constrain the augmented view; Calculate the binary edge mask and apply it to the initial adjacency matrix to obtain the denoised adjacency matrix; The denoised adjacency matrix is ​​used as the denoised view.

4. The cross-domain recommendation method based on contrastive learning according to claim 1, characterized in that, Clustering the shared information and domain-specific information, extracting common features of user behavior patterns, and classifying users into positive and negative prototypes based on the similarity between users and these common features includes the following steps: Define several prototype sets, each prototype set representing the corresponding preference; Calculate the similarity between the user and the prototype, and consider those with a similarity greater than or equal to a set value as positive prototypes and those with a similarity less than a set value as negative prototypes; The similarity between the set of users and the set of positive prototypes and the set of negative prototypes is calculated as a weight for introducing contrastive learning of positive prototype preferences.

5. A cross-domain recommendation method based on contrastive learning according to any one of claims 1-4, characterized in that, By employing a contrastive learning mechanism, the enhanced view, denoised view, generated user-side enhanced view, item-side enhanced view, positive prototype, and negative prototype are fused together to filter noise and optimize user preference feature representation, thereby constructing a cross-domain user preference model, including the following steps: Positive samples are formed by selecting the embeddings of the same user node in the enhanced view and the denoised view, and negative samples are formed by selecting the embeddings of different user nodes. Based on the positive and negative samples, comparative learning between views is carried out. On the user side, the representation of the same user in the user collaboration graph and the enhanced user collaboration graph is defined as a positive sample; on the item side, the representation of the same item in the item collaboration graph and the enhanced item collaboration graph is defined as a positive sample; negative samples on the user side and the item side are generated by randomly sampling the representations of other users or items in the collaboration graph and the enhanced collaboration graph; then comparative learning is performed on the user side and the item side. The selected positive prototype is used as the positive sample for contrastive learning, and the selected negative prototype is used as the negative sample for contrastive learning, and contrastive learning is carried out between the positive and negative prototypes. By combining the comparative learning results between views, between the user-side augmented view and the item-side augmented view, and between the positive and negative prototypes, noise is filtered and the user preference feature representation is optimized to build a cross-domain user preference model.

6. A cross-domain recommendation system based on prototype contrastive learning to mitigate negative transfer, characterized in that, include: The collaboration graph construction unit is used to obtain user-item interaction information in at least two domains. Based on the overlapping user information between domains, the interaction between overlapping users and items is used as shared information, and the interaction between non-overlapping users and items is used as domain-specific information to construct a user-item collaboration graph. The enhancement and denoising unit performs data enhancement and denoising on the user-item collaboration graph, generating enhanced and denoised views; A view processing unit, configured to generate user-side enhanced views and item-side enhanced views based on the user-item collaboration graph, includes: The interest graph construction module is used to acquire user behavior data of the user-item collaboration graph, design prompt words based on the user's historical interactions for each user, generate user interest text, cluster interest text to form reusable interest units, and construct user interest graph based on interest units, thus turning abstract interest nodes. The knowledge view construction module is used to obtain a knowledge graph containing item categories, information and relationships between items from a public knowledge base and query the item sets in the source and target domains. Based on the item entity projection set, the entities of the item-side collaboration graph are aligned to the recommended items to obtain a knowledge view consistent with the item space. The training view construction module is used to build training views, introduce user-side and item-side knowledge with minimal structural perturbation, and achieve orientation alignment using user-side collaboration graph and item-side collaboration graph as anchors. The merging module is used to merge the user-side collaboration graph and the user interest graph to obtain the user-side enhanced view; and to merge the item-side collaboration graph and the knowledge view to obtain the item-side enhanced view. The prototype partitioning unit is used to cluster the shared information and domain-specific information, extract common features of user behavior patterns, and divide users into positive prototypes and negative prototypes based on the similarity between users and common features. Positive prototypes represent features that are highly related to user preferences, while negative prototypes represent features that deviate from user preferences. The contrastive modeling unit is used to fuse the enhanced view, denoised view, generated user-side enhanced view, item-side enhanced view, positive prototype and negative prototype through a contrastive learning mechanism, filter noise and optimize user preference feature representation to build a cross-domain user preference model.

7. A cross-domain recommendation system based on prototype contrastive learning to mitigate negative transfer, as described in claim 6, is characterized in that, The collaboration graph construction unit includes: The identification module is used to construct the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain based on the interaction information of users and items in the source domain and the target domain, respectively; and to identify overlapping users and non-overlapping users based on the user sets of the source domain and the target domain, taking the interaction information of overlapping users and items as shared information and the interaction information of non-overlapping users and items as specific information of their respective domains. The extraction module is used to extract item information that is interacted with by overlapping users into shared item embeddings, and to extract item information that is interacted with by non-overlapping users into domain-specific item embeddings. The collaboration graph construction module is used to build user-side collaboration graphs and item-side collaboration graphs based on the interaction information between users and items.

8. A cross-domain recommendation system based on prototype contrastive learning to mitigate negative transfer, as described in claim 7, is characterized in that... The enhanced noise reduction unit includes: A module is used to model the latent distribution of each user as a Gaussian distribution based on the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain, and to sample the latent embedding of each user from the Gaussian distribution; The reconstruction module is used to reconstruct the initial adjacency matrix of the source domain and the initial adjacency matrix of the target domain based on the potential embeddings for each user. The enhancement unit is used to define a reconstruction loss, introducing cross-entropy to measure the initial adjacency matrix. Similarity to the reconstructed adjacency matrix, and the addition of a regularization term L. KL To limit the difference between the latent distribution and the standard normal distribution; and to treat the reconstructed adjacency matrix as an augmented view, and to limit the augmented view with cross-entropy and KL divergence regularization terms; The denoising module is used to calculate the binary edge mask and apply it to the initial adjacency matrix to obtain the denoised adjacency matrix; and to treat the denoised adjacency matrix as a denoised view.

9. A cross-domain recommendation system based on prototype contrastive learning to mitigate negative transfer, as described in claim 6, is characterized in that... The prototype partitioning unit includes: The definition module is used to define several prototype sets, each of which represents a corresponding preference. The calculation module is used to calculate the similarity between users and prototypes, and to regard those with similarity greater than or equal to a set value as positive prototypes and those with similarity less than a set value as negative prototypes; and to calculate the similarity between users and the set of positive prototypes and the set of negative prototypes, as a weight for introducing contrastive learning of positive prototype preferences.

10. A cross-domain recommendation system based on prototype contrastive learning to mitigate negative transfer, as described in any one of claims 6-9, characterized in that, The comparison modeling unit includes: The comparison module is used to select the embeddings of the same user node in the enhanced view and the denoised view to form positive samples, and to select the embeddings of different user nodes to form negative samples. Based on the positive and negative samples, comparison learning is performed between views. It is also used to define the representation of the same user in the user collaboration graph and the enhanced user collaboration graph as positive samples on the user side, and the representation of the same item in the item collaboration graph and the enhanced item collaboration graph as positive samples on the item side. Negative samples on the user side and the item side are generated by randomly sampling the representations of other users or items in the collaboration graph and the enhanced collaboration graph. Then, comparison learning is performed on the user side and the item side. Finally, it is used to use the selected positive prototypes as positive samples for comparison learning, and the selected negative prototypes as negative samples for comparison learning, to perform comparison learning between positive and negative prototypes. The modeling module is used to combine the comparative learning results between views, between the user-side augmented view and the item-side augmented view, and between the positive and negative prototypes to filter noise and optimize the user preference feature representation, thereby building a cross-domain user preference model.

11. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a computer program stored in memory, implements a cross-domain recommendation method based on contrastive learning as described in any one of claims 1-5.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a cross-domain recommendation method based on contrastive learning as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Cross-domain group intelligent recommendation method based on hypergraph neural network

    CN116204729A

  • Knowledge graph recommendation method based on generative denoising and multistage contrast learning

    CN120832952A