Recommendation method and system enhanced by node and meta-path contrastive learning

Through the node and meta-path comparative learning enhancement method, BPR loss and contrast loss are used to train the recommendation model, which solves the performance bottleneck and information loss problem of the recommendation system based on graph neural network on sparse data, and achieves more accurate user demand matching. and route information utilization.

CN114117232BActive Publication Date: 2024-10-15张军
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202111462320.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-02
Publication Date
2024-10-15
Estimated Expiration
2041-12-02

AI Technical Summary

Technical Problem

Recommendation systems based on graph neural networks have difficulty learning useful node representations on sparse user-item bipartite graphs, leading to performance bottlenecks and insufficient utilization of path information. Information loss and views generated by dropout may damage model performance.

Method used

The node and meta-path contrastive learning enhancement method is used to train the recommendation model through BPR loss, user-side and item-side contrastive losses, the meta-path view is used to capture path-level information, and a multi-positive sample mechanism is introduced to improve the adaptability of contrastive learning.

Benefits of technology

Effectively learn node representations containing node-level and path-level information to improve the robustness and performance of the recommendation model. The output recommendation items are more in line with user needs, avoiding information loss and improving the utilization of path information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114117232B_ABST
    Figure CN114117232B_ABST
Patent Text Reader

Abstract

The present invention discloses a recommendation method enhanced by node and meta-path contrast learning, including: obtaining a user identifier to be recommended; inputting the user identifier to be recommended into a trained recommendation model to obtain the user embedding of the user to be recommended and the project embedding associated with the user to be recommended; multiplying the user embedding with the project embedding to obtain the score of the corresponding project, and sorting the scores according to the scores to generate a project recommendation list corresponding to the sorting; wherein the trained recommendation model is obtained by training the recommendation model with BPR loss, user-side contrast loss based on meta-path, and project-side contrast loss based on meta-path; and a recommendation system, electronic device, and storage medium enhanced by node and meta-path contrast learning. The recommendation method and system of the present invention can use node-level information and path-level information to guide the recommendation model to learn the representation of nodes, so that the output recommended projects are more in line with user needs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning, and more specifically, to a recommendation method and system for node and meta-path contrast learning enhancement. Background Art

[0002] In recent years, recommender systems have achieved great success on online platforms such as YouTube and Amazon. The principle of recommender systems is to use historical records to calculate representations of users and items. With the development of graph neural networks (GNNs), which is a technique for learning node representations on graphs, it can extract user-item bipartite graphs from historical interaction records. Many GNN-based recommender systems have emerged, but they still face the problem of data sparsity. In the recommendation scenario, the user-item bipartite graph is very sparse. It is difficult for GNN to learn useful node representations on sparse user-item bipartite graphs, which leads to performance bottlenecks in GNN-based models. Contrastive learning, as a kind of self-supervised learning, can maximize the similarity between positive samples and minimize the similarity between positive samples and negative samples by defining positive samples and negative samples. Because contrastive learning can further mine information from unlabeled data, it is considered to be an effective way to alleviate data sparsity. Therefore, many GNN-based recommender systems have adopted contrastive learning. Specifically, S3-Rec, as a session recommender system, generates multiple session views through dropout, and then uses contrastive learning on these session views. SGL obtains an auxiliary view by dropout of the user-item bipartite graph, and then enhances the robustness of the model through multi-view contrastive learning. Through contrastive learning, these works have made remarkable progress. However, they still have the following limitations: (1) Information loss. The views generated by dropout may discard useful information, which will harm the performance of the model. (2) Insufficient utilization of path information. Summary of the invention

[0003] An object of the present invention is to provide a recommendation method and system for enhanced node and meta-path contrast learning, which can utilize node-level information and path-level information to guide the recommendation model to learn the representation of nodes.

[0004] In order to achieve the purpose and other advantages of the present invention, a node and meta-path contrast learning enhanced recommendation method is provided, comprising:

[0005] Get the ID of the user to be recommended;

[0006] Inputting the to-be-recommended user identifier into the trained recommendation model to obtain the user embedding of the to-be-recommended user and the item embedding associated with the to-be-recommended user;

[0007] The user embedding is multiplied by the item embedding to obtain the score of the corresponding item, and the items are sorted according to the scores to generate a list of recommended items corresponding to the sorting; wherein,

[0008] The trained recommendation model is obtained by training the recommendation model with BPR loss, meta-path-based user-side contrast loss, and meta-path-based item-side contrast loss.

[0009] Preferably, in the recommendation method enhanced by node and meta-path contrast learning, the trained recommendation model is obtained by the following steps:

[0010] Obtain the historical interaction records of all users and projects and generate a user-project bipartite graph And calculate User node embedding in and project node embed according to and Calculate the BPR loss of the recommendation model

[0011] For the user-item bipartite graph Perform meta-path extraction and generate user meta-path view and the project meta path view

[0012] Embed the user node and the user meta path view Input the meta path view encoder to obtain the user meta path view Node embedding on Will and Project into the same vector space and calculate the user-side contrast loss

[0013] Embed the project node into and the project meta path view Input the meta path view encoder to obtain the meta path view of the project Node embedding on Will and Project into the same vector space and calculate the item-side contrast loss

[0014] Losses according to the BPR User side contrast loss Comparison loss with project side Calculate the overall loss of the recommendation model use Train the recommendation model until If it is less than the preset threshold, the trained recommendation model is obtained.

[0015] Preferably, the node and meta-path contrast learning enhanced recommendation method embeds the user node into and the user meta path view Input the meta path view encoder to obtain the user meta path view Node embedding on Will and The shadow is transferred to the same vector space to calculate the user-side contrast loss Specifically:

[0016] definition:

[0017]

[0018] In the formula, is the node i in A set of adjacent nodes on d i and d i′ are the degrees of nodes i and i′ respectively, is the user node embedding of node i’s neighbor node i′

[0019] According to the user meta path view Generate list Su, In the formula, Represents node i and The number of common interaction items of the nth neighboring node i′ in ;

[0020] Sort the list Su in descending order, generate the list Su′, and set a hyperparameter T posu , if |Su′|>T posu , we select the first T from Su′ posu Node is regarded as a positive sample of node i, otherwise all nodes in Su′ are regarded as positive samples, and the positive sample node set of node i is marked as The negative sample node set of node i is marked as

[0021] Using the same nonlinear transformation and Projected into the same vector space, where

[0022]

[0023]

[0024] Where W is the weight matrix, b is a constant, yes The node embedding after projection, yes Node embedding after projection;

[0025] User-item bipartite graph Compute contrast loss for the subject View with user meta path Compute contrast loss for the subject in,

[0026]

[0027]

[0028] Where τ is the temperature parameter;

[0029] Calculate the user-side contrast loss

[0030]

[0031] Where λ is the coefficient, I is the user set, and |I| is the number of users.

[0032] Preferably, the node and meta-path contrast learning enhanced recommendation method embeds the project node into and the project meta path view Input the meta path view encoder to obtain the meta path view of the project Node embedding on Will and Project into the same vector space and calculate the item-side contrast loss Specifically:

[0033] definition:

[0034]

[0035] In the formula, is the node j in A set of adjacent nodes on d j and d j′ are the degrees of nodes j and j′ respectively, is the item node embedding of node j’s neighbor node;

[0036] According to the user meta path view Generate a list Sv, In the formula, Represents node j and The number of common interacting users of the nth neighboring node j′ in ;

[0037] Sort the list Sv in descending order, generate the list Sv′, and set a hyperparameter T posv , if |Sv′|>T posv , we select the first T from Sv′ posv Node is regarded as a positive sample of node j, otherwise all nodes in Sv′ are regarded as positive samples, and the positive sample node set of node j is marked as The negative sample node set of node i is marked as

[0038] Using the same nonlinear transformation and Projected into the same vector space, where

[0039]

[0040]

[0041] Where W is the weight matrix, b is a constant, yes The node embedding after projection, yes Node embedding after projection;

[0042] User-item bipartite graph Compute contrast loss for the subject View by project meta path Compute contrast loss for the subject in,

[0043]

[0044]

[0045] Where τ is the temperature parameter;

[0046] Calculate item-side contrast loss

[0047]

[0048] Where λ is the coefficient, J is the set of items, and |J| is the number of items.

[0049] Preferably, the node and meta-path contrast learning enhanced recommendation method is based on the BPR loss User side contrast loss Comparison loss with project side Calculate the overall loss of the recommendation model Specifically:

[0050] Calculate the overall contrast loss of the recommendation model

[0051]

[0052] In the formula, w user and w item are hyperparameters that control the impact on the user-side contrast loss and the item-side contrast loss respectively;

[0053] Calculate the overall loss of the recommendation model

[0054] Preferably, in the node and meta-path contrast learning enhanced recommendation method, the recommendation model includes one of LightGCN, NGCF, and NeuMF.

[0055] Preferably, in the node and meta-path contrast learning enhanced recommendation method and device, the meta-path view encoder includes one of GNN, GCN, and GAT.

[0056] The present invention also provides a node and meta-path contrast learning enhanced recommendation system, comprising:

[0057] An acquisition module, which is used to acquire historical interaction records between the user to be recommended and the item;

[0058] A recommendation module is used to input the historical interaction record into a trained recommendation model to obtain recommended items for the user to be recommended; wherein,

[0059] The trained recommendation model is obtained by training the recommendation model with BPR loss, meta-path-based user-side contrast loss, and meta-path-based item-side contrast loss.

[0060] The present invention also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the above-mentioned method.

[0061] The present invention also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above method is implemented.

[0062] The present invention has at least the following beneficial effects:

[0063] The present invention provides a recommendation method and system for node and meta-path contrast learning enhancement, which can use node-level information and path-level information to guide the recommendation model to learn the representation of nodes, so that the trained recommendation model can learn the node representation containing node-level information and path-level information, and then make the recommended items output by the trained recommendation model more in line with user needs. Specifically, firstly, by using meta-path instead of random dropout, a meta-path view is generated for the user-item bipartite graph, so that the meta-path view will not lose information when storing a large amount of path-level information, and the meta-path view and the user-item bipartite graph can describe the node representation from different perspectives. Secondly, GNNs are used to capture node-level information and path-level information, and the node representation on the interaction view and meta-path view is learned. Thirdly, a multi-positive sample mechanism is introduced to make contrastive learning more suitable for recommendation tasks. The method can define multiple positive samples for the current node instead of only one positive sample. Finally, the contrast loss between the positive sample and the negative sample is calculated as an auxiliary task to guide the model to learn the node representation with more path-level information.

[0064] Other advantages, objectives and features of the present invention will be embodied in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 It is a structural schematic diagram of the NPCRS model of the present invention;

[0066] Figure 2 It is a schematic diagram of extracting a meta-path view from an interactive view according to the present invention. DETAILED DESCRIPTION

[0067] The present invention is further described in detail below in conjunction with embodiments and drawings so that those skilled in the art can implement the invention with reference to the description.

[0068] It should be understood that the terms such as “having”, “including” and “comprising” used herein do not exclude the existence or addition of one or more other elements or combinations thereof.

[0069] Terminology explanation:

[0070] LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation, a lightweight graph convolutional neural network for recommendation;

[0071] NGCF: Neural Graph Collaborative Filtering, graph neural collaborative filtering;

[0072] NeuMF: Neural Collaborative Filtering, collaborative filtering based on neural network;

[0073] GCN: Graph Convolutional Network;

[0074] GAT: Graph Attention Networks.

[0075] The present invention provides a recommendation method for node and meta-path contrast learning enhancement, comprising:

[0076] S101, obtaining a user identifier to be recommended, such as a user ID and a user name;

[0077] S102, inputting the to-be-recommended user identifier into the trained recommendation model to obtain the user embedding (here, embedding can be understood as vector representation, the same below) of the to-be-recommended user and the item embedding associated with the to-be-recommended user;

[0078] The user embedding is multiplied by the item embedding to obtain the score of the corresponding item. The higher the score, the higher the user's interest in the item. The items are sorted according to the scores to generate a project recommendation list corresponding to the ranking. Furthermore, the scores of the top preset digits, such as the top 10 scores, are taken to generate a project recommendation list corresponding to the scores according to the scores.

[0079] The trained recommendation model is obtained by training the recommendation model with BPR loss, meta-path-based user-side contrast loss, and meta-path-based item-side contrast loss.

[0080] The present invention trains the recommendation model through BPR loss, meta-path-based user-side contrast loss and meta-path-based item-side contrast loss, so that the trained recommendation model can learn node representation containing node-level information and path-level information, thereby making the recommended items output by the trained recommendation model more in line with user needs.

[0081] In another embodiment, Figure 1 As shown, the trained recommendation model (named as NPCRS model) is obtained by the following steps:

[0082] S201. Obtain historical interaction records of all users and projects and generate a user-project bipartite graph And calculate User node embedding in and project node embed according to and Calculate the BPR loss of the recommendation model The recommendation model includes one of LightGCN, NGCF, and NeuMF; specifically:

[0083] Let user be represented by I = {i1, i2, ..., i n}(|I|=N), the items are represented by J={j1,j2,...,j m}(|J|=M). The interaction history between users and items can be represented as a matrix r ij =1 indicates that there is an interaction record between user i and item j, otherwise it is represented by r ij =0. Let O+ = {r ij |i∈I, j∈J} is the observed interaction. Using the matrix We can get a user-item bipartite graph in is the set of all nodes, ε r =O + represents the observed interaction. and is the set of neighbor nodes. Includes all project nodes that user i has interacted with. Includes all user nodes that have interacted with item j.

[0084] For simplicity, here, LightGCN is used as the recommendation model for example:

[0085] Compute representations of users and items: The computation of embedding in LightGCN is defined as follows:

[0086]

[0087]

[0088] Here, e i and e j are user embedding and item embedding respectively. k is the number of layers of GCN. is a symmetric normalization term that avoids the increase of embedding size during graph convolution operations. It is worth noting that LightGCN does not use nonlinear activation functions and feature transformations. After passing through k layers of GCN, the final embedding is obtained by the following method:

[0089]

[0090] α k ≥0 measures the importance of k-layer embedding. In practical applications, setting α k =1 / (K+1).

[0091] Training and prediction: After obtaining the final embeddings of users and items, the prediction scores are obtained by multiplying the embeddings of users and items:

[0092]

[0093] It is a score that reflects the user's interest in the project. The higher the score, the more interested the user is in the project.

[0094] LightGCN adopts Bayesian Personalized Ranking (BPR) loss to learn parameters. BPR loss is a pairwise loss that encourages observed entries to be ranked higher than their unobserved counterparts:

[0095]

[0096] Among them, λ is the L2 regularization coefficient and Θ is the parameter of the model

[0097] S202: the user-project bipartite graph Perform meta-path extraction and generate user meta-path view and the project meta path view Specific:

[0098] The meta-path P is defined as (Abbreviated as A1A2...A l+1 ) form, describing nodes A1 and A l+1 Combination relationship in Represents a combination operator on a relation. Figure 2 As shown in Figure 1, the user-item interaction graph has two meta-paths, IJI and JIJ. IJI represents two users who have interacted with the same item. JIJ represents two items that a user interacted with. Through meta-paths, path-level information can be easily captured.

[0099] S203: embedding the user node into and the user meta path view Input the meta path view encoder to obtain the user meta path view Node embedding on Will and Project into the same vector space and calculate the user-side contrast loss The meta-path view encoder includes one of GNN, GCN, and GAT. Here, GNN is used as an example for illustration; specifically:

[0100] definition:

[0101]

[0102] In the formula, is the node i in A set of adjacent nodes on d i and d i′ are the degrees of nodes i and i′ respectively, is the user node embedding of node i’s neighbor node i′. Aggregation on the meta-path view gives the node embedding Ability to understand information about the path level. Therefore, Compare Capture more high-level information.

[0103] According to the user meta path view Generate list Su, In the formula, Represents node i and The number of common interaction items of the nth neighboring node i′ in ;

[0104] Sort the list Su in descending order, generate the list Su′, and set a hyperparameter T posu , if |Su′|>T posu , we select the first T from Su′ posu Node is regarded as a positive sample of node i, otherwise all nodes in Su′ are regarded as positive samples, and the positive sample node set of node i is marked as The negative sample node set of node i is marked as Here, each node has multiple positive samples instead of one, but in previous contrastive learning work, only one pair of positive samples was considered. For example, SimCLR only takes the original image and the cropped image as positive samples. In the recommendation system scenario, there may be many users with similar interests. If only one pair of positive values ​​is used, it will be difficult for the model to learn useful information, resulting in poor model performance. Therefore, using multiple pairs of positive values ​​is more in line with the context of recommendation tasks.

[0105] Using the same nonlinear transformation and Projected into the same vector space, where

[0106]

[0107]

[0108] Where W is the weight matrix, b is a constant, yes The node embedding after projection, yes Node embedding after projection; here, a two-layer MLP implementation is used, where the activation function is ELU.

[0109] User-item bipartite graph Compute contrast loss for the subject View with user meta path Compute contrast loss for the subject in,

[0110]

[0111]

[0112] Where τ is the temperature parameter;

[0113] Calculate the user-side contrast loss

[0114]

[0115] Where λ is the coefficient, I is the user set, and |I| is the number of users.

[0116] S204: embed the project node into and the project meta path view Input the meta path view encoder to obtain the meta path view of the project Node embedding on Will and Project into the same vector space and calculate the item-side contrast loss Here, GNN is still used as an example, specifically:

[0117] definition:

[0118]

[0119] In the formula, is the node j in A set of adjacent nodes on d j and d j′ are the degrees of nodes j and j′ respectively, is the item node embedding of node j’s neighbor node;

[0120] According to the user meta path view Generate a list Sv, In the formula, Represents node j and The number of common interacting users of the nth neighboring node j′ in ;

[0121] Sort the list Sv in descending order, generate the list Sv′, and set a hyperparameter T posv , if |Sv′|>T posv, we select the first T from Sv′ posv Node is regarded as a positive sample of node j, otherwise all nodes in Sv′ are regarded as positive samples, and the positive sample node set of node j is marked as The negative sample node set of node i is marked as

[0122] Using the same nonlinear transformation and Projected into the same vector space, where

[0123]

[0124]

[0125] Where W is the weight matrix, b is a constant, yes The node embedding after projection, yes Node embedding after projection;

[0126] User-item bipartite graph Compute contrast loss for the subject View by project meta path Compute contrast loss for the subject in,

[0127]

[0128]

[0129] Where τ is the temperature parameter;

[0130] Calculate item-side contrast loss

[0131]

[0132] Where λ is the coefficient, J is the set of items, and |J| is the number of items.

[0133] S205: According to the BPR loss User side contrast loss Comparison loss with project side Calculate the overall loss of the recommendation model use Train the recommendation model until If the value is less than the preset threshold, the trained recommendation model is obtained; specifically:

[0134] Calculate the overall contrast loss of the recommendation model

[0135]

[0136] In the formula, w user and w item are hyperparameters that control the impact on the user-side contrast loss and the item-side contrast loss respectively;

[0137] Calculate the overall loss of the recommendation model

[0138] use Replace the To learn the parameters of LightGCN until If it is less than the preset threshold, the trained recommendation model is obtained.

[0139] The present invention also provides a node and meta-path contrast learning enhanced recommendation system, comprising:

[0140] An acquisition module, which is used to acquire historical interaction records between the user to be recommended and the item;

[0141] A recommendation module is used to input the historical interaction record into a trained recommendation model to obtain recommended items for the user to be recommended; wherein,

[0142] The trained recommendation model is obtained by training the recommendation model with BPR loss, meta-path-based user-side contrast loss, and meta-path-based item-side contrast loss.

[0143] This technical solution is based on the same inventive concept as the recommendation method for node and meta-path contrast learning enhancement. For understanding this technical solution, please refer to the description of the recommendation method part.

[0144] The present invention also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the above-mentioned method.

[0145] This technical solution is based on the same inventive concept as the recommendation method for node and meta-path contrast learning enhancement, and reference may be made to the description of the recommendation method section. The electronic device of this technical solution is not limited to PCs, terminals, and servers.

[0146] The present invention also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above method is implemented.

[0147] The technical solution is based on the same inventive concept as the recommendation method for node and meta-path contrast learning enhancement, and reference may be made to the description of the recommendation method part so that the recommendation method of the present invention can be embodied in the form of a software product.

[0148] Below, three real-world data sets, as shown in Table 1, are used to evaluate the beneficial effects of the NPCRS model of the present invention, and the results are shown in Table 2. As can be seen from Table 2, the model of the present invention is significantly better than the existing model.

[0149] Table 1

[0150]

[0151] Table 2

[0152]

[0153] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.

Claims

1. A recommendation method enhanced by contrastive learning of nodes and meta-paths, characterized in that: include: Get the ID of the user to be recommended; Inputting the to-be-recommended user identifier into the trained recommendation model to obtain the user embedding of the to-be-recommended user and the item embedding associated with the to-be-recommended user; The user embedding is multiplied by the item embedding to obtain the score of the corresponding item, and the items are sorted according to the scores to generate a list of recommended items corresponding to the sorting; wherein, The trained recommendation model is obtained by the following steps: Obtain the historical interaction records of all users and projects and generate a user-project bipartite graph And calculate User node embedding in and project node embed according to and Calculate the BPR loss of the recommendation model For the user-item bipartite graph Perform meta-path extraction and generate user meta-path view and the project meta path view Embed the user node and the user meta path view Input the meta path view encoder to obtain the user meta path view Node embedding on Will and Project into the same vector space and calculate the user-side contrast loss Embed the project node into and the project meta path view Input the meta path view encoder to obtain the meta path view of the project Node embedding on Will and Project into the same vector space and calculate the item-side contrast loss Losses according to the BPR User side contrast loss Comparison loss with project side Calculate the overall loss of the recommendation model use Train the recommendation model until If the value is less than the preset threshold, the trained recommendation model is obtained; Embed the user node and the user meta path view Input the meta path view encoder to obtain the user meta path view Node embedding on Will and Project into the same vector space and calculate the user-side contrast loss Specifically: definition: In the formula, is the node i in A set of adjacent nodes on d i and d i′ are the degrees of nodes i and i′ respectively, is the user node embedding of the neighboring node i′ of node i; According to the user meta path view Generate list Su, In the formula, Represents node i and The number of common interaction items of the nth neighboring node i′ in ; Sort the list Su in descending order, generate the list Su′, and set a hyperparameter T posu , if |Su′|>T posu , we select the first T from Su′ posu Node is regarded as a positive sample of node i, otherwise all nodes in Su′ are regarded as positive samples, and the positive sample node set of node i is marked as The negative sample node set of node i is marked as Using the same nonlinear transformation and Projected into the same vector space, where Where W is the weight matrix, W (1) and W (2) are two different weight matrices, σ is a two-layer MLP, b is a constant, b (1) and b (2) are two constants of different values, yes The node embedding after projection, yes Node embedding after projection; User-item bipartite graph Compute contrast loss for the subject View with user meta path Compute contrast loss for the subject in, Where τ is the temperature parameter; Calculate the user-side contrast loss Where λ is the coefficient, I is the user set, and |I| is the number of users; Embed the project node into and the project meta path view Input the meta path view encoder to obtain the meta path view of the project Node embedding on Will and Project into the same vector space and calculate the item-side contrast loss Specifically: definition: In the formula, is the node j in A set of adjacent nodes on d j and d j′ are the degrees of nodes j and j′ respectively, is the item node embedding of node j’s neighbor node; According to the user meta path view Generate a list Sv, In the formula, Represents node j and The number of common interacting users of the nth neighboring node j′ in ; Sort the list Sv in descending order, generate the list Sv′, and set a hyperparameter T posv , if |Sv′|>T posv , we select the first T from Sv′ posv Node is regarded as a positive sample of node j, otherwise all nodes in Sv′ are regarded as positive samples, and the positive sample node set of node j is marked as The negative sample node set of node i is marked as Using the same nonlinear transformation and Projected into the same vector space, where Where W is the weight matrix, W (1) and W (2) are two different weight matrices, σ is a two-layer MLP, b is a constant, b (1) and b (2) are two constants of different values, yes The node embedding after projection, yes Node embedding after projection; User-item bipartite graph Compute contrast loss for the subject View by project meta path Compute contrast loss for the subject in, Where τ is the temperature parameter; Calculate item-side contrast loss In the formula, λ is the coefficient, J is the set of items, and |J| is the number of items; Losses according to the BPR User side contrast loss Comparison loss with project side Calculate the overall loss of the recommendation model Specifically: Calculate the overall contrast loss of the recommendation model In the formula, w user and w item are hyperparameters that control the impact on the user-side contrast loss and the item-side contrast loss respectively; Calculate the overall loss of the recommendation model 2. The node and meta-path contrast learning enhanced recommendation method according to claim 1, characterized in that: The recommendation model includes one of LightGCN, NGCF, and NeuMF.

3. The method and device for recommending nodes and meta-paths by contrastive learning enhancement according to claim 1, characterized in that: The meta-path view encoder includes one of GNN, GCN, and GAT.

4. A recommender system enhanced by node and meta-path contrastive learning, characterized in that include: An acquisition module, which is used to acquire historical interaction records between the user to be recommended and the item; A recommendation module is used to input the historical interaction record into a trained recommendation model to obtain recommended items for the user to be recommended; wherein, The trained recommendation model is obtained by the following steps: Obtain the historical interaction records of all users and projects and generate a user-project bipartite graph And calculate User node embedding in and project node embed according to and Calculate the BPR loss of the recommendation model For the user-item bipartite graph Perform meta-path extraction and generate user meta-path view and the project meta path view Embed the user node and the user meta path view Input the meta path view encoder to obtain the user meta path view Node embedding on Will and Project into the same vector space and calculate the user-side contrast loss Embed the project node into and the project meta path view Input the meta path view encoder to obtain the meta path view of the project Node embedding on Will and Project into the same vector space and calculate the item-side contrast loss Losses according to the BPR User side contrast loss Comparison loss with project side Calculate the overall loss of the recommendation model use Train the recommendation model until If the value is less than the preset threshold, the trained recommendation model is obtained; Embed the user node and the user meta path view Input the meta path view encoder to obtain the user meta path view Node embedding on Will and Project into the same vector space and calculate the user-side contrast loss Specifically: definition: In the formula, is the node i in A set of adjacent nodes on d i and d i′ are the degrees of nodes i and i′ respectively, is the user node embedding of the neighboring node i′ of node i; According to the user meta path view Generate list Su, In the formula, Represents node i and The number of common interaction items of the nth neighboring node i′ in ; Sort the list Su in descending order, generate the list Su′, and set a hyperparameter T posu , if |Su′|>T posu , we select the first T from Su′ posu Node is regarded as a positive sample of node i, otherwise all nodes in Su′ are regarded as positive samples, and the positive sample node set of node i is marked as The negative sample node set of node i is marked as Using the same nonlinear transformation and Projected into the same vector space, where Where W is the weight matrix, W (1) and W (2) are two different weight matrices, σ is a two-layer MLP, b is a constant, b (1) and b (2) are two constants of different values, yes The node embedding after projection, yes Node embedding after projection; User-item bipartite graph Compute contrast loss for the subject View with user meta path Compute contrast loss for the subject in, Where τ is the temperature parameter; Calculate the user-side contrast loss Where λ is the coefficient, I is the user set, and |I| is the number of users; Embed the project node into and the project meta path view Input the meta path view encoder to obtain the meta path view of the project Node embedding on Will and Project into the same vector space and calculate the item-side contrast loss Specifically: definition: In the formula, is the node j in A set of adjacent nodes on d j and d j′ are the degrees of nodes j and j′ respectively, is the item node embedding of node j’s neighbor node; According to the user meta path view Generate a list Sv, In the formula, Represents node j and The number of common interacting users of the nth neighboring node j′ in ; Sort the list Sv in descending order, generate the list Sv′, and set a hyperparameter T posv , if |Sv′|>T posv , we select the first T from Sv′ posv Node is regarded as a positive sample of node j, otherwise all nodes in Sv′ are regarded as positive samples, and the positive sample node set of node j is marked as The negative sample node set of node i is marked as Using the same nonlinear transformation and Projected into the same vector space, where Where W is the weight matrix, W (1) and W (2) are two different weight matrices, σ is a two-layer MLP, b is a constant, b (1) and b (2) are two constants of different values, yes The node embedding after projection, yes Node embedding after projection; User-item bipartite graph Compute contrast loss for the subject View by project meta path Compute contrast loss for the subject in, Where τ is the temperature parameter; Calculate item-side contrast loss In the formula, λ is the coefficient, J is the set of items, and |J| is the number of items; Losses according to the BPR User side contrast loss Comparison loss with project side Calculate the overall loss of the recommendation model Specifically: Calculate the overall contrast loss of the recommendation model Where, w user and w item are hyperparameters that control the impact on the user-side contrast loss and the item-side contrast loss respectively; Calculate the overall loss of the recommendation model 5. An electronic device, characterized in that include: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the method according to any one of claims 1 to 3.

6. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Recommendation method based on heterogeneous information network representation learning

    CN113190754A

  • Metapath-fused heterogeneous network representation recommendation algorithm

    CN113505294A

  • Neural contextual bandit based computational recommendation method and apparatus

    US11113745B1

  • Graph-based recommendations service systems and methods

    US20150149484A1

  • Graph framework using heterogeneous social networks

    US20170244778A1