Heterogeneous graph contrast learning recommendation method fusing multi-scene information

By introducing scene identification and graph contrast learning mechanisms into the user-item interaction graph, a heterogeneous graph is constructed and combined with a graph neural network. This solves the problem of balancing scene information sharing and difference preservation in multi-scene recommendation, and improves recommendation performance and robustness.

CN121808134APending Publication Date: 2026-04-07SOUTH CHINA UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies struggle to balance scenario information sharing and diversity preservation in multi-scenario recommendations, resulting in problems such as a large number of models, high maintenance costs, inability to share data, and unsatisfactory recommendation performance. In particular, negative transfer or under-transfer issues are prone to occur between popular and unpopular scenarios.

Method used

By introducing scene identifiers into the user-item interaction graph, a heterogeneous graph is constructed, and scene-specific graph neural networks and multi-scene shared graph convolutional networks are adopted. Combined with a graph contrastive learning mechanism, multi-scene information fusion at the edge level and representation level is achieved, and the weights of scene-specific and fused representations are adaptively adjusted to enhance the model's personalized recommendation capabilities across scenes.

Benefits of technology

It effectively improves the personalization and robustness of recommendation results in multiple scenarios, alleviates the problems of negative transfer and under-transfer, and enhances the model's cross-scenario generalization ability and recommendation performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121808134A_ABST
    Figure CN121808134A_ABST
Patent Text Reader

Abstract

The invention discloses a heterogeneous graph contrast learning recommendation method fusing multi-scene information, and the method comprises the following steps: introducing a scene identifier in an interaction relationship between a user and an article, and constructing an interaction heterogeneous graph with various edge types; through a plurality of independent graph neural networks, respectively executing graph convolution for the edge set of the specific scene and the edge set of the multi-scene mixture to obtain scene-specific user article representation and scene-fused user article representation; based on a scene perception gating mechanism, adaptively adjusting a combination weight of the scene specific representation and the scene fusion representation, and generating a final user representation and an article representation with scene perception characteristics; and finally, through a contrast learning mechanism, the scene specific representation and the final representation of the same user or article are regarded as a positive sample pair, and consistency constraint is applied to maximize the correlation between the scene specific representation and the final representation, so that the robustness and the cross-scene generalization ability of the method are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of scene data recommendation, and particularly relates to a heterogeneous graph contrastive learning recommendation method fusing multi-scene information. BACKGROUND

[0002] With the complication of internet platform business, a platform usually contains multiple recommendation scenes, such as short video recommendation, live broadcast recommendation according to content form, or homepage recommendation flow, special column, search result page according to display page. Due to the differences in display mode, exposure mechanism and user intention in different scenes (for example, the homepage scene focuses on exposure and retention, and the search page scene focuses on matching degree and conversion), the interaction intention of users to the same recommended item in different scenes often has significant deviation.

[0003] The traditional method is to train independent models for each recommendation scene, which can optimize the recommendation effect in a specific scene, but also brings problems such as large number of models, high maintenance cost, and data sharing. In addition, the data distribution of different scenes is obviously different, and the interaction data of some unpopular scenes is sparse, which leads to insufficient model training and unsatisfactory recommendation effect.

[0004] In view of the above problems, recent research has begun to explore joint modeling methods based on multi-scene data, that is, by mixing multi-scene data to train a recommendation model that shares parameters among scenes, to improve the overall recommendation performance and model reusability. However, the existing methods still face significant challenges: on the one hand, it is difficult to balance the sharing of scene information and the preservation of scene differences; on the other hand, in the process of multi-scene joint training, the popular scene is easily disturbed by other scenes, resulting in negative transfer problem, or the information transferred to the unpopular scene is insufficient, resulting in under-transfer problem, thereby affecting the final recommendation effect. SUMMARY

[0005] The main purpose of the present application is to overcome the shortcomings and deficiencies of the prior art, and provide a heterogeneous graph contrastive learning recommendation method fusing multi-scene information.

[0006] The application introduces scene identification in the interaction relationship between the user and the item, classifies the interaction edges according to the scene to which the interaction belongs, and thereby constructs a user-item interaction heterogeneous graph with multiple edge types. On this graph structure, first, for the edge set of a specific scene, a scene-specific graph neural network is used to extract scene-specific user and item representations, thereby capturing the behavior differences in different scenes. Subsequently, the application realizes multi-scene information fusion at two levels: (1) multi-scene information fusion at the edge level: a cross-scene graph neural network is introduced to perform graph convolution on the mixed edge set of multiple scenes to obtain scene-fused user and item representations, realizing the modeling of globally shared information; (2) multi-scene information fusion at the representation level: a gating mechanism with scene representation vectors as input is used to adaptively adjust the weight between the aggregation of "scene-specific user and item representations" and "scene-fused user and item representations" for different scenes, thereby obtaining the final user and item representations with both inter-scene sharing and differences.

[0007] In addition, to further enhance the consistency and robustness of the model across scenes, the application introduces a graph contrast learning mechanism: the "scene-specific representation" and "final representation" of the same user or the same item are regarded as positive sample pairs to construct contrast learning, maximize the correlation between them, realize the alignment of multi-scene information, and thereby effectively improve the personalization degree of the recommendation results in each scene.

[0008] To achieve the above purpose, the application adopts the following technical solutions: A multi-scene information fusion heterogeneous graph contrast learning recommendation method, the recommendation method comprising the following steps: S1, obtaining the interaction data between the user and the item in multiple recommendation scenes, and marking the scene identification of each interaction data, each data being represented by a triple , representing the user and the item having an interaction behavior in the scene ; S2, constructing a heterogeneous graph using the "user-item" interaction data in multiple scenes, the heterogeneous graph containing nodes of two types of users and items and multiple types of edges divided according to the interaction scenes; S3, applying random initialization to each node in the heterogeneous graph to obtain the corresponding node representation vector, and applying random initialization to each scene to obtain the corresponding scene representation vector; S4, on the heterogeneous graph, for the interaction edge in the scene , a scene-specific heterogeneous graph neural network is applied to perform multi-layer graph convolution operation to obtain first user representation and first item representation containing only scene-specific information; S5, on the heterogeneous graph, for all interaction edges, a multi-scene shared heterogeneous graph neural network is applied to perform multi-layer graph convolution operation, to obtain second user representation and second item representation fused with multi-scene information; S6, based on a scene-aware gating mechanism, the first user representation and the first item representation containing only scene-specific information are aggregated with the second user representation and the second item representation fused with multi-scene information, to obtain final user representation and final item representation; S7, based on the first user representation and the first item representation containing only scene-specific information and the final user representation and the final item representation, a positive and negative sample pair is constructed, a recommendation loss and a contrast loss are calculated to serve as an optimization objective, and a heterogeneous graph neural network model is trained; S8, based on the final user representation and the final item representation, a matching score of a user and all items in a candidate item set is calculated, and the item with the highest score is selected as a recommendation result.

[0009] Further, the heterogeneous graph in step S2 is represented as , wherein is a node set, including a user node set and an item node set ; represents a node in the node set; it is assumed that there are different scenes , and represents a scene set, and the edge set in the heterogeneous graph is represented as , contains all “user-item” interaction edges under all scenes, and contains only “user-item” interaction edges under scene , and the type of each edge is distinguished by a scene identifier ; represents a node type set; represents an edge type set; represents a mapping relationship from a node to a node type; represents a mapping relationship from an edge to an edge type; different scenes can be distinguished according to recommended content forms, such as short video recommendation, live broadcast recommendation, and article recommendation, or can be distinguished according to display pages, such as a home page recommendation stream, a special column page, a search result page, and a page of “what you like”. By dividing the interaction edges according to scenes, an additional scene identifier is introduced, which avoids mutual confusion and interference of interaction information between different scenes, and helps to distinguish the behavior differences of users in different scenes, thereby improving the fineness of modeling user interest preferences in specific scenes.

[0010] ​​​Furthermore, in step S3, the user is obtained through random initialization. The initial representation vector of the corresponding node in the heterogeneous graph ,thing The initial representation vector of the corresponding node in the heterogeneous graph And each scene Corresponding scene representation vector All the above representation vectors are learnable parameter vectors that are dynamically updated as the heterogeneous graph neural network is trained. Random initialization ensures that each representation vector starts from a state without prior information, providing ample representation space for modeling user, item, and scene information. The scene representation vector... As an input to the attention mechanism involved in the graph convolution operation in steps S4 and S5; simultaneously, the scene representation vector As an input to the gating mechanism applied when aggregating scene-specific representations and scene fusion representations in step S6, this invention introduces an independent scene representation vector for each scene, so that information from different scenes can be abstracted into fixed-dimensional vector representations and participate in the calculation of graph convolution and gating mechanisms. This enables differentiated modeling of the user's interests and preferences in different scenes, thereby achieving personalized recommendations based on scene perception.

[0011] Furthermore, the scene-specific heterogeneous graph neural network in step S4 is represented as follows: , representing heterogeneous graph Mid-scene The edge set contained below Perform graph convolution operation; The user representation and item representation obtained by layer graph convolution are respectively and The calculation formula is:

[0012] in Representative scenarios Next user node The set of first-order neighbor item nodes, Representative scenarios Next item node The set of first-order neighbor user nodes, , The first User representations and item representations obtained from layer graph convolution; User and item interactions are complex across multiple scenarios. By performing graph convolution operations only on edge sets in specific scenarios, the application scope of graph convolution is clearly defined, avoiding confusion and interference of interaction information in different scenarios. This enables more accurate modeling to obtain scenario-specific user and item representations. Weight Representative scenarios The user node in the convolution process shown in the figure below Its neighbor item nodes Attention score, weight Representative scenarios The following image shows the item nodes during the convolution process. Its neighboring user nodes The attention scores are calculated using a scene-aware attention mechanism:

[0013]

[0014] in For the scene Next The learnable parameter vector of the layer. For the scene The representation vector, symbol " " represents vector concatenation operation, This represents the vector transpose operation; by introducing a scene representation vector as the input to the attention mechanism, This enables graph convolution operations to adaptively adjust the weights of neighbor information aggregation based on the current scene, selectively filtering out neighbor information that helps express the user's personalized interests and preferences in the current scene, thus achieving scene-aware neighbor information aggregation. For user nodes In the scene The next first-order neighbor item node set Any item node in, Representative item node In the Item representation obtained from layer graph convolution; For item nodes In the scene The next set of first-order neighbor user nodes Any user node in, Representing user nodes In the User representation obtained from layer graph convolution; It is a non-linear activation function. For input values, Hyperparameters for controlling negative weights; By aggregating the intermediate layer representations obtained from the convolution of each graph layer, a representation containing only the scene is obtained. First user representation of specific information Representation of the first item :

[0015] in The number of stacked graph convolution layers is used. By stacking multiple layers of graph convolution, the range of neighborhood information aggregation is expanded, enabling each central node to aggregate information from neighboring nodes at greater distances layer by layer. This results in the representation obtained from higher-level graph convolutions containing richer neighborhood information. Furthermore, by averaging the intermediate representations obtained from each layer of graph convolution, the neighborhood information captured at different levels is preserved, avoiding the oversmoothing problem that exists when only a single higher-level graph convolution representation is applied.

[0016] Furthermore, the heterogeneous graph neural network shared across multiple scenarios in step S5 is represented as follows: , representing heterogeneous graph The complete set of edges Execution graph convolution; symbol Used to identify parameters or variables associated with the heterogeneous graph neural network shared across multiple scenarios; The user representations and representations obtained from layer graph convolution are respectively and The calculation formula is:

[0017] in Representing user nodes The set of first-order neighbor item nodes under edge sets in a multi-scenario mixed environment. Representative item node A set of first-order neighbor user nodes under a multi-scenario mixed edge set; , The first User representations and item representations obtained from layer graph convolution; weights Represents user nodes in the process of performing graph convolution based on edge sets in multiple scenarios. Its neighbor item nodes Attention score, weight This represents the item nodes in the edge set execution graph convolution process based on multi-scenario hybridization. Its neighboring user nodes Attention score.

[0018] By performing graph convolution on edge sets that mix multiple scenarios, and weighted aggregating neighbor node representations from different scenarios for each node, the commonalities of users' potential interests and preferences can be captured from users' interactive behaviors in multiple scenarios, achieving edge-level multi-scenario information fusion, thereby improving the cross-scenario generalized recommendation capability of this invention.

[0019] The above weights With The attention mechanism calculated by scene perception is:

[0020]

[0021] Wherein, is the learnable parameter vector of the layer, is the representation vector of the scene , and the symbol " " represents the vector splicing operation; represents the vector transposition operation; by introducing the scene representation , the above attention weight is calculated, so that the graph convolution operation can adaptively adjust the contribution degree of neighbor information from different scenes, filter out irrelevant interference information of the current scene, and select neighbor information that can better reflect the personalized interest preferences of the user in the current scene, thereby relieving the confusion and interference of multi-scene interaction information, and realizing scene-aware neighbor information aggregation.

[0022] is any item node in the first-order neighbor item node set of the user node , and represents the item representation obtained by the layer graph convolution; is any user node in the first-order neighbor user node set of the item node , and represents the user representation obtained by the layer graph convolution; is a nonlinear activation function, is an input value, is a hyperparameter for controlling the weight of negative values; Further, in the step S6, the final user representation is obtained by aggregating the first user representation containing only scene-specific information and the second user representation fusing multi-scene information through a scene-aware gating mechanism, and the process is as follows: First, the aggregated user representation of the layer is:

[0023] wherein the​​​ Layer user side weight parameter Through the scene-aware gating mechanism, the following is obtained:

[0024] Wherein And is the scene The learnable parameter vector and bias value of the first Layer, Represents the vector transposition operation; is the scene Representation vector, is the sigmoid function; By introducing the scene representation , the gating mechanism can adaptively identify the relative importance between the first user representation and the second user representation in the current scene, generate the final user representation that is most helpful to express the user's interest preference in the current scene, and thus improve the personalized degree of the recommendation result of the application in the current scene; Finally, the intermediate layer aggregation user representation Weighted calculation obtains the final user representation :

[0025] Wherein is the number of stacked layers of graph convolution; In the step S6, the final item representation Through the scene-aware gating mechanism, the first item representation containing only scene-specific information And the second item representation fusing multi-scene information Obtained, the process is as follows: First, the aggregation item representation of the first Layer is:

[0026] Wherein the weight parameter of the first Layer item side Through the scene-aware gating mechanism, the following is obtained:

[0027] Wherein And is the scene The learnable parameter vector and bias value of the first Layer, Represents the vector transposition operation; is the scene Representation vector, is the sigmoid function; Characterize the intermediate polymer layers The final item representation is obtained through weighted calculation. :

[0028] The above operations achieve fine-grained fusion of multi-scene information at the representation level on both the user and item sides. At each graph convolutional level, the first representation containing only scene-specific information and the second representation fused with multi-scene information are aggregated to obtain intermediate representations, so that the information between the two representations can be fully integrated at different levels. The intermediate representations are then further aggregated equally to obtain the final representation, so that the final representation has both scene-specific information and common information of multiple scenes. Based on end-user representation With final item representation Calculate the user For items Predicted matching score ,in This is a vector transpose operation.

[0029] Furthermore, the contrast loss in step S7 includes two parts: user-side contrast loss and item-side contrast loss. The user-side comparison loss calculation process is as follows: For users end-user representation As an anchor point, the first user representation will contain only scenario-specific information. Treat it as a positive sample, and treat any other user as a positive sample. End-user representation If it is considered a negative sample, then a positive sample pair is obtained. Compared with negative sample pairs To maximize the similarity between positive samples and anchor points to model the common information of the same user across scenarios, and to minimize the similarity between negative samples and anchor points to increase the discriminative power between different user representations, the InfoNCE loss function is used to calculate the user-side contrast loss:

[0030] in The cosine similarity function is used. It is a hyperparameter used to control the steepness of the contrastive loss gradient; The process for calculating the comparative loss on the item side is as follows: For items Representing the final item As an anchor point, the first item representation will contain only scene-specific information. Treat it as a positive sample, and treat any other item as a positive sample. Final item representation If it is considered a negative sample, then a positive sample pair is obtained. Compared with negative sample pairs The item-side contrast loss was calculated using the InfoNCE loss function.

[0031] Comparative loss The calculation formula is:

[0032] The above-mentioned contrast loss applies consistency constraints to the scene-specific representation and the final representation from the perspectives of the user and the item, respectively. By maximizing the similarity between the scene-specific representation and the final representation of the same user or the same item, the common information between scenes is aligned, so that the final representation has both multi-scene fusion information and scene characteristic information, thereby improving the personalization of the recommendation results of this invention in specific scenarios. Meanwhile, based on end-user representation With final item representation The recommendation loss is calculated by applying the Bayesian Personalized Ranking Function (BPR) as the loss function:

[0033] in Represents the training sample set, It is a positive sample set The positive sample pairs in the graph are actual interaction edges that exist on the graph. It is a negative sample set Negative sample pairs in the data, through providing users Randomly sample an item that has not been interacted with. get; for Regularization term, used for all trainable parameters in the model. Constraints are imposed to prevent the inflation of model parameter values; It is control The hyperparameter for the proportion of regularization terms; It is the sigmoid function; Indicates user For items Match score, Indicates user For items The matching score; the purpose of this recommendation loss is to make users rate items they have actually interacted with as high as possible than items they have not interacted with, that is, to make... as large as possible This allows us to model and obtain the degree of user interest and preference for different items; Combined with the aforementioned recommendation loss contrastive loss , the final loss function is obtained:

[0034] wherein is a hyperparameter for controlling the proportion of the contrastive loss; the loss function is taken as the objective function, and the gradient descent method is used for training the heterogeneous graph neural network model.

[0035] Compared with the prior art, the present application has the following advantages and beneficial effects: (1) The present application introduces a scene identifier for each edge in the user-item interaction graph, models multiple scene data into a heterogeneous graph structure, captures personalized information within the scene and common information across scenes by simultaneously applying a "scene-specific heterogeneous graph neural network" and a "scene-shared heterogeneous graph neural network", and further combines a gating mechanism for adaptive weighted fusion, thereby balancing the commonality and difference between scenes in a unified framework and alleviating the negative transfer or under-transfer problem in the multi-scene information fusion process.

[0036] (2) The present application introduces an independent scene representation vector for each scene, which participates in the attention weight of the neighborhood node information aggregation in the graph convolution process and is also used as one of the inputs of the gating mechanism for adaptive adjustment of the combination weight of the "scene-specific representation" and the "scene fusion representation", so that the finally generated user representation and item representation have scene awareness and can more accurately reflect the difference in user interest preferences in different scenes, thereby improving the individualization degree of the recommendation results in different scenes.

[0037] (3) The present application uses a contrastive learning mechanism, takes the "scene-specific representation" and the "final representation" of the same user or item as positive sample pairs, applies consistency constraints to maximize the correlation between the two, thereby enhancing the robustness of the model to the distribution difference of multi-scene data and alleviating the negative transfer phenomenon caused by the distribution difference of multi-scene data. BRIEF DESCRIPTION OF DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0039] Figure 1 is a flowchart of a multi-scene information fusion heterogeneous graph contrastive learning recommendation method disclosed in the present application; Figure 2is a schematic diagram of the process of calculating the final user representation of the present application; Figure 3 is a schematic diagram of the gating mechanism of scene awareness in step S6 of the present application. DETAILED DESCRIPTION

[0040] In order for those skilled in the art to better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0041] In the present application, the phrase "embodiments" means that the specific features, structures or characteristics described in combination with the embodiments can be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor is it an independent or alternative embodiment to other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described in the present application can be combined with other embodiments.

[0042] Embodiment 1 As Figure 1 shown, the present embodiment discloses a heterogeneous graph contrast learning recommendation method fusing multi-scene information, which comprises the following steps: S1, obtaining the interaction data between users and items in three different categories of recommendation scenes of movies, books and music, the three scenes are represented by the set ; To ensure the quality of training data, filtering is performed in a 10-core manner, that is, only users and items with more than 10 interaction data in the three scenes are retained; for each user, all the interaction data is arranged in ascending order according to the timestamp of the interaction and divided into training set, validation set and test set in the ratio of 7:1:2, and each interaction data after preprocessing is represented by a triple , representing the user and the item having interaction behavior in the scene , wherein The specific value of is the remapped user id, The specific value of is 0~2, representing the three scenes of movies, books and music respectively; S2, using the "user-item" interaction data in the three scenes to construct a heterogeneous graph, which contains nodes of two types of users and items and three types of edges divided according to the interaction scene; the heterogeneous graph is represented as The node set in the graph contains the user node set. With item node set edge set It contains "user-item" interaction edges in three scenarios, and Scenes Only The "User-Item" interaction side below The type of each edge is identified by the scene. To distinguish; S3. Apply random initialization to each node in the heterogeneous graph to obtain a representation vector of length 32, where user The initial representation vector of the corresponding node in the heterogeneous graph is denoted as . ,thing The initial representation vector of the corresponding node in the heterogeneous graph is denoted as . At the same time for each scenario A scene representation vector of length 32 is obtained by applying random initialization. ; like Figure 3 As shown, the scene representation vector This will serve as an input to the attention mechanism involved in the graph convolution operation in steps S4 and S5; simultaneously, the scene representation vector This will serve as an input to the gating mechanism applied in step S6 when aggregating scene-specific representations and scene fusion representations.

[0043] S4, such as Figure 2 As shown in the upper part, on the heterogeneous graph, for each scenario The interaction edges below apply a scenario-specific heterogeneous graph neural network. Based on scenario The edge set contained below Perform three stacked graph convolution operations to obtain the first user representation and the first item representation, which contain only scene-specific information. Level 0 Set as the initial representation of the user node , Set as the initial representation of the item node ; from =Starting from 1, the first User representation obtained by layer graph convolution With item representation The calculation formula is:

[0044] in Representative scenarios User Node The set of first-order neighbor item nodes, Representative scenarios Item Node The set of first-order neighbor user nodes, , The first User representations and item representations obtained from layer graph convolution; Weight Representative scenarios The user node in the convolution process shown in the figure below Its neighbor item nodes Attention score, weight Representative scenarios The following image shows the item nodes during the convolution process. Its neighboring user nodes The attention scores are calculated using a scene-aware attention mechanism:

[0045]

[0046] in For the scene Next The learnable parameter vector of the layer has a length of 96; For the scene The representation vector, symbol " " represents vector concatenation operation, This represents the vector transpose operation; For user nodes In the scene The next first-order neighbor item node set Any item node in, Representative item node In the Item representation obtained from layer graph convolution; For item nodes In the scene The next set of first-order neighbor user nodes Any user node in, Representing user nodes In the User representation obtained from layer graph convolution; It is a non-linear activation function. For input values; By aggregating the intermediate layer representations obtained from the convolution of each graph layer, a representation containing only the scene is obtained. First user representation of specific information Representation of the first item :

[0047] in In this embodiment, the number of stacked layers for graph convolution is [number]. .

[0048] S5, such as Figure 2 As shown in the lower part, a heterogeneous graph neural network with multi-scenario sharing is applied to all interaction edges on the heterogeneous graph. Based on the complete edge set Perform multi-layer graph convolution operations to obtain a second user representation and a second item representation that fuse information from multiple scenarios; symbols Parameters or variables used to identify the heterogeneous graph neural network shared across the multiple scenarios; Level 0 Set as the initial representation of the user node , Set as the initial representation of the item node ; from =Starting from 1, the first User representation obtained by layer graph convolution With item representation The calculation formula is:

[0049] in Representing user nodes The set of first-order neighbor item nodes under edge sets in a multi-scenario mixed environment. Representative item node A set of first-order neighbor user nodes under a multi-scenario mixed edge set; , The first User representations and item representations obtained from layer graph convolution; Weight Represents user nodes in the process of performing graph convolution based on edge sets in multiple scenarios. Its neighbor item nodes Attention score, weight This represents the item nodes in the edge set execution graph convolution process based on multi-scenario hybridization. Its neighboring user nodes The attention scores are calculated using a scene-aware attention mechanism:

[0050]

[0051] in For the first The learnable parameter vector of the layer has a length of 96; For the scene The representation vector, symbol " " represents a vector concatenation operation; This represents the vector transpose operation; For user nodes First-order neighbor item node set Any item node in, Representative item node In the Item representation obtained from layer graph convolution; For item nodes First-order neighbor user node set Any user node in, Representing user nodes In the User representation obtained from layer graph convolution; It is a non-linear activation function. For input values.

[0052] S6, such as Figure 3 As shown, based on the scene-aware gating mechanism, the first user representation and the first item representation, which only contain scene-specific information, are aggregated with the second user representation and the second item representation, which integrate multi-scene information, to obtain the final user representation and the final item representation. End-user representation Aggregating first user representations containing only scene-specific information through scene-aware gating mechanisms. Second user representation that integrates information from multiple scenarios The process is as follows: first, This is the initial representation vector for each user node in step S3; from =Starting from 1, the first The aggregated user representation of the layer is as follows:

[0053] Among them, the first Weight parameters on the user side of the layer This is achieved through a scene-aware gating mechanism:

[0054] in and It is a scene Next The learnable parameter vector and bias values ​​of the layer The vector length is 96. It is a scalar; This represents the vector transpose operation; For the scene The representation vector; It is the sigmoid function; Aggregate user representations from the intermediate layers Weighted calculation yields the end-user representation :

[0055] in In this embodiment, the number of stacked layers for graph convolution is [number]. ; Final item representation A first item representation containing only scene-specific information is aggregated through a scene-aware gating mechanism. Second item representation that integrates information from multiple scenarios The process is as follows: first, This is the initial representation vector for each item node in step S3; from =Starting from 1, the first The polymer layer is characterized as follows:

[0056] Among them, the first Weight parameters of the layer item side This is achieved through a scene-aware gating mechanism:

[0057] in and It is a scene Next The learnable parameter vector and bias values ​​of the layer The vector length is 96. It is a scalar; This represents the vector transpose operation; For the scene The representation vector, It is the sigmoid function; Characterize the intermediate polymer layers The final item representation is obtained through weighted calculation. :

[0058] in In this embodiment, the number of stacked layers for graph convolution is [number]. ; Based on end-user representation With final item representation Calculate the user For items Predicted matching score ,in This is a vector transpose operation.

[0059] S7. Based on the first user representation, the first item representation, and the final user representation and the final item representation that only contain scene-specific information, construct positive and negative sample pairs, calculate recommendation loss and contrast loss, and use these as optimization objectives to train the heterogeneous graph neural network model; in this embodiment, the size of each batch of training samples is set to batch_size=512. The contrast loss includes two parts: user-side contrast loss and item-side contrast loss. The user-side comparison loss calculation process is as follows: For users end-user representation As an anchor point, the first user representation will contain only scenario-specific information. Treat them as positive samples, and consider the remaining users in the current batch of training samples as positive samples. End-user representation If it is considered a negative sample, then a positive sample pair is obtained. Compared with negative sample pairs The contrast loss on the user side is calculated using the InfoNCE loss function:

[0060] in The cosine similarity function is used. These are hyperparameters used to control the steepness of the contrastive loss gradient. In this embodiment... ; The process for calculating the comparative loss on the item side is as follows: For items Representing the final item As an anchor point, the first item representation will contain only scene-specific information. Treat them as positive samples, and treat the remaining items in the current batch of training samples as positive samples. Final item representation If it is considered a negative sample, then a positive sample pair is obtained. Compared with negative sample pairs The item-side contrast loss was calculated using the InfoNCE loss function.

[0061] in The cosine similarity function is used. These are hyperparameters used to control the steepness of the contrastive loss gradient. In this embodiment... ; Final comparison loss The calculation formula is:

[0062] Meanwhile, based on end-user representation With final item representation The recommendation loss is calculated by applying the Bayesian Personalized Ranking Function (BPR) as the loss function:

[0063] in Represents the training sample set, It is a positive sample set The positive sample pairs in the graph are actual interaction edges that exist on the graph. It is a negative sample set Negative sample pairs in the data, through providing users Randomly sample an item that has not been interacted with. get; for Regularization term, used for all trainable parameters in the model. Constraints; It is control The hyperparameter for the proportion of regularization terms, in this embodiment ; It is the sigmoid function; Indicates user For items Match score, Indicates user For items Match score; Combined with the aforementioned recommendation loss Compared with loss The final loss function is obtained as follows:

[0064] in To control the hyperparameter of the contrast loss ratio, this embodiment sets... ; the loss function As the objective function, the training learning rate is set to 0.005, and the gradient descent method is applied to train the heterogeneous graph neural network model. S8. Based on the trained heterogeneous graph neural network model, when it is needed in a scene... For users When making recommendations, the first step is to select an item set. Each item in The final item representation is calculated. Then for the user Calculate the end-user representation And then apply The matching scores between the user and each item in the candidate item set are calculated, and the 20 items with the highest scores are selected as the recommendation results.

[0065] Example 2 Based on Example 1, this example specifically demonstrates how to solve the user cold start problem in a specific recommendation scenario based on a trained heterogeneous graph neural network.

[0066] Taking book recommendation as an example, let's select a strictly inactive user in this scenario. The user has 0 interaction records in the book recommendation scenario, 26 interaction records in the movie recommendation scenario, and 15 interaction records in the music recommendation scenario.

[0067] Since this user had zero interactions in the book recommendation scenario, they did not appear in the training set of Example 1 (in Example 1, the training set was filtered using a 10-core strategy, requiring that retained users have more than 10 interactions in all three scenarios). The heterogeneous graph in Example 1 does not have the user node representation obtained from training; therefore, firstly, for this user... Random initialization is applied to obtain an initial node representation of length 32. .

[0068] In order to gain users There are two calculation methods for matching and scoring all books and items to make recommendations: T1. Directly apply randomly initialized user representation vectors. The final item representation of each book Calculate matching score Since the user representation vector of any strictly cold user is obtained through random initialization, the matching scores of different strictly cold users for the same item tend to be the same. Therefore, the matching score does not have a "personalized" recommendation effect for different strictly cold users.

[0069] T2. Apply steps S4-S6 of the present invention, such as... Figure 2As shown; for step S4, since the user has 0 interactions in the book recommendation scenario and does not have book neighbor nodes on the heterogeneous graph, it is impossible to directly apply the scenario-specific heterogeneous graph neural network to obtain the first user representation containing scenario-specific information. Therefore, the user representation vector obtained by random initialization is used instead. The first user representation obtained by replacing the graph convolutions of each layer in S4 is directly set. The remaining steps S5 and S6 are the same as in Example 1. Finally, the user and each book are represented as a final item. Calculate the matching score as ; This approach fully utilizes the user's... Interactive data from movie and music scenes, combined with attention weight calculations for graph convolution operations in step S5 and scene-aware gating mechanisms in step S6, enable users to... The resulting end-user representation in the absence of any interaction data in book-related scenarios It still retains certain characteristics of the book-themed scenario as well as common features across multiple scenarios, compared to user representations obtained through random initialization. It contains richer personalized information.

[0070] Based on the dataset collected in Example 1, the book recommendation scenario was selected as the cold start scenario. Users with non-zero interaction counts in the book scenario and non-zero interaction counts in the movie and music recommendation scenarios were selected from the user set removed by the 10-core preprocessing strategy as the strict cold start user set. All user interaction records in the book scenario were used as test labels. Experiments were conducted to compare the two matching score calculation methods T1 and T2 to verify the effectiveness of the present invention in solving the user cold start problem in a specific recommendation scenario. The 20 books with the highest matching scores were selected as the recommendation results to check whether they hit the books that the user had actually interacted with. The experiment used recall and normalized depreciation cumulative gain (NDCG) as evaluation indicators. The larger the values ​​of the two indicators, the better the recommendation effect.

[0071] Table 1. Experimental results of two scoring calculation methods, T1 and T2.

[0072] Table 1 above shows the results of the comparative experiment. As can be seen, for strictly cold users who have no interaction data in the book recommendation scenario, the recommendation results obtained by matching and scoring the final user representation obtained by the present invention are better than those obtained by randomly initialized user representation. Both test indicators are improved. It can realize personalized recommendations by utilizing the interaction information of strictly cold users in other scenarios, and solves the under-transfer problem in multi-scenario information fusion to a certain extent.

[0073] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0074] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.

Claims

1. A heterogeneous graph comparison learning recommendation method that integrates information from multiple scenarios, characterized in that, The recommendation method includes the following steps: S1. Obtain user interaction data between users and items in multiple recommendation scenarios, and label each interaction data with its corresponding scenario identifier. Each data item is represented by a triplet. This indicates that the user is represented. With items In the scene The following features interactive behavior; S2. Construct a heterogeneous graph using "user-item" interaction data from multiple scenarios. The heterogeneous graph contains nodes of two types: users and items, as well as edges of various types according to the interaction scenarios. S3. Apply random initialization to each node in the heterogeneous graph to obtain the corresponding node representation vector, and apply random initialization to each scene to obtain the corresponding scene representation vector. S4. On the heterogeneous graph, for the scenario The interaction edges below are used to apply a scene-specific heterogeneous graph neural network to perform multi-layer graph convolution operations to obtain the first user representation and the first item representation that contain only scene-specific information. S5. On the heterogeneous graph, for all interaction edges, a multi-scene shared heterogeneous graph neural network is applied to perform multi-layer graph convolution operations to obtain a second user representation and a second item representation that integrate multi-scene information. S6. Based on a scene-aware gating mechanism, the first user representation and the first item representation, which only contain scene-specific information, are aggregated with the second user representation and the second item representation, which integrate multi-scene information, to obtain the final user representation and the final item representation. S7. Based on the first user representation, the first item representation, and the final user representation and the final item representation that only contain scene-specific information, construct positive and negative sample pairs, calculate recommendation loss and contrast loss, and use these as optimization objectives to train a heterogeneous graph neural network model. S8. Based on the final user representation and the final item representation, calculate the matching score between the user and all items in the candidate item set, and select the highest score among them. The items are used as recommendations.

2. The heterogeneous graph comparison learning recommendation method integrating multi-scene information according to claim 1, characterized in that, The heterogeneous graph in step S2 is represented as follows: ,in A set of nodes, containing user nodes. With item node set ; Represents the first node in the node set. There are nodes; assuming there are a total of A different scenario ,by Let the set of scenes be represented as the edge set in the heterogeneous graph. , It includes "user-item" interaction edges in all scenarios, and Scenes Only The "User-Item" interaction side below The type of each edge is identified by the scene. To distinguish; Represents a set of node types; Represents a set of edge types; This represents the mapping relationship from nodes to node types; This represents the mapping relationship from edge to edge type.

3. The heterogeneous graph comparison learning recommendation method integrating multi-scene information according to claim 1, characterized in that, In step S3, the user is obtained through random initialization. The initial representation vector of the corresponding node in the heterogeneous graph ,thing The initial representation vector of the corresponding node in the heterogeneous graph And each scene Corresponding scene representation vector All of the above representation vectors are learnable parameter vectors that are dynamically updated as the heterogeneous graph network is trained; wherein, the scene representation vector... As an input to the attention mechanism involved in the graph convolution operation in steps S4 and S5; simultaneously, the scene representation vector This serves as an input to the gating mechanism applied in step S6 when aggregating scene-specific representations and scene fusion representations.

4. The heterogeneous graph comparison learning recommendation method integrating multi-scene information according to claim 1, characterized in that, The scene-specific heterogeneous graph neural network in step S4 is represented as follows: , representing heterogeneous graph Mid-scene The edge set contained below Perform graph convolution operation; The user representation and item representation obtained by layer graph convolution are respectively and The calculation formula is: in Representative scenarios Next user node The set of first-order neighbor item nodes, Representative scenarios Next item node The set of first-order neighbor user nodes, , The first User representations and item representations obtained from layer graph convolution; Weight Representative scenarios The user node in the convolution process shown in the figure below Its neighbor item nodes Attention score, weight Representative scenarios The following image shows the item nodes during the convolution process. Its neighboring user nodes The attention scores are calculated using a scene-aware attention mechanism: , , in For the scene Next The learnable parameter vector of the layer. For the scene The representation vector, symbol " " represents vector concatenation operation, This represents the vector transpose operation; For user nodes In the scene The next first-order neighbor item node set Any item node in, Representative item node In the Item representation obtained from layer graph convolution; For item nodes In the scene The next set of first-order neighbor user nodes Any user node in, Representing user nodes In the User representation obtained from layer graph convolution; It is a non-linear activation function. For input values, Hyperparameters for controlling negative weights; By aggregating the intermediate layer representations obtained from the convolution of each graph layer, a representation containing only the scene is obtained. First user representation of specific information Representation of the first item : , in denoted as the number of stacked layers in the graph convolution.

5. The heterogeneous graph comparison learning recommendation method integrating multi-scene information according to claim 1, characterized in that, The heterogeneous graph neural network shared across multiple scenarios in step S5 is represented as follows: , representing heterogeneous graph The complete set of edges Execution graph convolution; symbol Used to identify parameters or variables associated with the heterogeneous graph neural network shared across multiple scenarios; The user representations and representations obtained from layer graph convolution are respectively and The calculation formula is: in Representing user nodes The set of first-order neighbor item nodes under edge sets in a multi-scenario mixed environment. Representative item node A set of first-order neighbor user nodes under a multi-scenario mixed edge set; , The first User representations and item representations obtained from layer graph convolution; Weight Represents user nodes in the process of performing graph convolution based on edge sets in multiple scenarios. Its neighbor item nodes Attention score, weight This represents the item nodes in the edge set execution graph convolution process based on multi-scenario hybridization. Its neighboring user nodes The attention scores are calculated using a scene-aware attention mechanism: in For the first The learnable parameter vector of the layer. For the scene The representation vector, symbol " " represents a vector concatenation operation; This represents the vector transpose operation; For user nodes First-order neighbor item node set Any item node in, Representative item node In the Item representation obtained from layer graph convolution; For item nodes First-order neighbor user node set Any user node in, Representing user nodes In the User representation obtained from layer graph convolution.

6. The heterogeneous graph comparison learning recommendation method integrating multi-scene information according to claim 1, characterized in that, In step S6, the end user representation A first user representation containing only scene-specific information is aggregated through a scene-aware gating mechanism. Second user representation that integrates information from multiple scenarios The process is as follows: First of all, the The aggregated user representation of the layer is as follows: , Among them, the first Weight parameters on the user side of the layer This is achieved through a scene-aware gating mechanism: , in and It is a scene Next The learnable parameter vector and bias values ​​of the layer This represents the vector transpose operation; For the scene The representation vector, It is the sigmoid function; Aggregate user representations from the intermediate layers Weighted calculation yields the end-user representation : , in The number of stacked layers in the graph convolution; In step S6, the final item representation A first item representation containing only scene-specific information is aggregated through a scene-aware gating mechanism. Second item representation that integrates information from multiple scenarios The process is as follows: First of all, the The polymer layer is characterized as follows: , Among them, the first Weight parameters of the layer item side This is achieved through a scene-aware gating mechanism: , in and It is a scene Next The learnable parameter vector and bias values ​​of the layer This represents the vector transpose operation; For the scene The representation vector, It is the sigmoid function; Characterize the intermediate polymer layers The final item representation is obtained through weighted calculation. : , Based on end-user representation With final item representation Calculate the user For items Predicted matching score ,in This is a vector transpose operation.

7. The heterogeneous graph comparison learning recommendation method integrating multi-scene information according to claim 1, characterized in that, The contrast loss in step S7 includes two parts: user-side contrast loss and item-side contrast loss. The user-side comparison loss calculation process is as follows: For users end-user representation As an anchor point, the first user representation will contain only scenario-specific information. Treat it as a positive sample, and treat any other user as a positive sample. End-user representation If it is considered a negative sample, then a positive sample pair is obtained. Compared with negative sample pairs The contrast loss on the user side is calculated using the InfoNCE loss function: , in The cosine similarity function is used. It is a hyperparameter used to control the steepness of the contrastive loss gradient; The process for calculating the comparative loss on the item side is as follows: For items Representing the final item As an anchor point, the first item representation will contain only scene-specific information. Treat it as a positive sample, and treat any of the other items as positive samples. Final item representation If it is considered a negative sample, then a positive sample pair is obtained. Compared with negative sample pairs The item-side contrast loss was calculated using the InfoNCE loss function. , Comparative loss The calculation formula is: , Meanwhile, based on end-user representation With final item representation The recommendation loss is calculated by applying the Bayesian Personalized Ranking Function (BPR) as the loss function: , in Represents the training sample set, It is a positive sample set The positive sample pairs in the graph are actual interaction edges that exist on the graph. It is a negative sample set Negative sample pairs in the data, through providing users Randomly sample an item that has not been interacted with. get; for Regularization term, used for all trainable parameters in the model. Constraints; It is control The hyperparameter for the proportion of regularization terms; It is the sigmoid function; Indicates user For items Match score, Indicates user For items Match score; Combined with the aforementioned recommendation loss Compared with loss The final loss function is obtained as follows: , in To control the proportion of contrast loss hyperparameters; the loss function Gradient descent is used as the objective function to train the heterogeneous graph neural network model.