Generation method and device and recommendation method and device of comparative learning framework
By introducing a comparison learning framework in graph collaborative filtering, combining graph-level and node-level supervision signals, the problem of insufficient recommendation accuracy under data sparsity and noise issues is solved, and a higher quality user and project embedding representation and recommendation effect is achieved.
Patent Information
- Application Number
- CN202311526781.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-16
- Publication Date
- 2025-05-16
AI Technical Summary
The existing graph collaborative filtering method has insufficient recommendation accuracy when facing data sparsity and noise problems.
A method of generating a comparative learning framework is proposed, including L-layer original representation model, enhanced representation model and joint learning model. Through the comparative learning framework, the embedded representation of users and projects is trained to generate high-quality recommendations.
By comparing the learning framework and combining graph-level and node-level supervision signals, more accurate embedded representations of users and projects can be generated, improving the accuracy of recommendations, especially when data sparsity and noise exist, it can still maintain high recommendation accuracy.
Smart Images

Figure CN120011622A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of project recommendation, and in particular to a generation method and a recommendation method of a contrastive learning framework and a device thereof. Background Art
[0002] Recommender Systems (RS) play a vital role in helping users discover items of interest and alleviate the problem of information overload, such as social software (e.g., Facebook, WeChat), online shopping platforms (e.g., JD.com, Taobao), and video recommendation websites (e.g., Youtube, NetFlix). Among various recommendation techniques, collaborative filtering (CF) as a basic method for personalized recommendation ensures effective recommendations by leveraging historical user-item interactions to make accurate predictions.
[0003] Graph collaborative filtering (GCF) is a technique that exploits high-order user-item information in bipartite graph structures. Inspired by graph convolutional networks (GCNs), GCF incorporates multi-hop neighbors into the potential user or item embedding space, resulting in impressive recommendation performance. For example, NGCF initially attempted to exploit graph structure information through a message propagation scheme. Subsequently, LightGCN aims to simplify the design of NGCF to improve its efficiency. In addition, introducing the attention mechanism into the GCF model allows learning weighted neighbors, which enables capturing more informative user-item interactions. Although the above methods achieve promising recommendation results, they still face challenges posed by data sparsity and noise problems. Summary of the invention
[0004] In view of this, the main purpose of the present invention is to provide a generation method and a recommendation method of a contrastive learning framework and a device thereof.
[0005] To achieve the above object, the technical solution of the present invention is implemented as follows: a method for generating a contrastive learning framework for recommendation, comprising the following steps: obtaining a user set U = {u1, u2, ..., u M}, the item set I = {i1,i2,…,i N}, and the interaction matrix R∈{0,1} M×N , where R u,i = 1 means there is interaction between user u and item i, R u,i =0 indicates that there is no interaction between user u and item i, and M and N are both natural numbers; a contrastive learning framework is created, the contrastive learning framework comprising: an L-layer original representation model, a learnable enhanced representation model and a joint learning model; the contrastive learning framework is trained based on the user set U, the item set I and the interaction matrix.
[0006] As an improvement of the embodiment of the present invention, the following steps are also included: based on the interaction matrix R, an adjacency matrix A∈R is generated. (M+N)×(M+N) , Based on the collaborative filtering algorithm in graph convolutional networks, the interaction matrix R is constructed as a bipartite graph G = {V, ε}, where V = {U ∪ I} is the set of all nodes, ε = {(u, i) | | u∈U, i∈I, R u,i = 1} represents the observed edge set; each user u and item i is assigned an initialized embedding vector The set of user and item embeddings is defined as E u ∈R M×d and E i ∈R N×d , d is the embedding dimension; construct the feature map G′={V,ε,X,A}, where X∈R (M+N)×d is the feature matrix, x u ,x i ∈R d is the eigenvector.
[0007] As an improvement of the embodiment of the present invention, in the original representation model, the information of multi-hop neighbors is generated: in, and Respectively represent the aggregation information of adjacent items and users to target node u and target node i at the l′th layer; represents the normalized interaction matrix, Among them, D u ∈R M×M and D i ∈R N×N , the set of users adjacent to user u is N u , the set of items adjacent to item i is N i ; Residual connections are implemented at each layer, and the message propagation process from layer l′-1 to layer l′ is: After L layers of propagation, the summation function is used as the readout function to combine the embeddings of all layers and obtain the final raw representation, i.e. l′ is a natural number, 1≤l′≤L.
[0008] As an improvement of the embodiment of the present invention, the enhanced representation model is used to generate g′={V, ε, X, A}, and generate a multi-head graph attention network with adaptive attention coefficients based on the selection of the multi-head graph attention network. where K is the number of hidden attention heads and the adaptive attention coefficient between users and items in each head is LeakyReLU(.) is a nonlinear activation function. represents the learnable weight vector of the k′th head, || is the association operation, k′ is a natural number, 1≤k′≤K; for each head, the calculated adaptive attention coefficient and adjacent features are aggregated into the following form: in, is the enhanced embedding of user u through the k′th head, and the enhanced embedding of item i through the k′th head is expressed as ELU(.) is a nonlinear activation function; the enhancement embeddings of all layers are summed to achieve the final learnable enhancement representation. in, and
[0009] As an improvement of the embodiment of the present invention, the joint learning model is used to: use inner product operation to predict the preference of user u for item i Use pairwise Bayesian personalized ranking loss as the recommendation loss to optimize model parameters Where σ(·) is the sigmoid function to facilitate the output probability distribution, and the set O = {(u,i,j)|R u,i =1,R u,j =0}, R u,i =1 means item i interacts with user u, R u,j = 0 means there is no interaction between item j and user u; the original representation and enhanced representation of the same user are used as positive samples, and contrastive learning is performed through InfoNCE loss. Among them, τ is the temperature hyperparameter, u′ is the negative sample used to supervise the difference between different nodes; the contrast loss of the project Final loss Where λ1 is the contrastive loss weight and λ2 is the regularization weight applied to the parameter Θ.
[0010] The embodiment of the present invention further provides a device for generating a contrastive learning framework for recommendation, the device comprising the following modules: an information acquisition module for acquiring a user set U = {u1, u2, ..., u M}, the item set I = {i1,i2,…,i N}, and the interaction matrix R∈{0,1} M×N , where R u,i = 1 means there is interaction between user u and item i, R u,i =0 indicates that there is no interaction between user u and item i, and M and N are both natural numbers; a framework creation module is used to create a contrastive learning framework, and the contrastive learning framework includes: an L-layer original representation model, a learnable enhanced representation model and a joint learning model; a training module is used to train the contrastive learning framework based on the user set U, the item set I and the interaction matrix.
[0011] As an improvement of the embodiment of the present invention, the following modules are also included: a preprocessing module for generating an adjacency matrix A∈R based on the interaction matrix R (M+N)×(m+N) , Based on the collaborative filtering algorithm in graph convolutional networks, the interaction matrix R is constructed as a bipartite graph G = {V, ε}, where V = {U ∪ I} is the set of all nodes, ε = {(u, i) | | u∈U, i∈I, R u,i = 1} represents the observed edge set; each user u and item i is assigned an initialized embedding vector The set of user and item embeddings is defined as E u ∈R M×d and E i ∈R N×d , d is the embedding dimension; construct the feature map G′={V,ε,X,A}, where X∈R (M+N)×d is the feature matrix, x u ,x i ∈R d is the eigenvector.
[0012] As an improvement of the embodiment of the present invention, in the original representation model, the information of multi-hop neighbors is generated: in, and Respectively represent the aggregation information of adjacent items and users to target node u and target node i at the l′th layer; represents the normalized interaction matrix, Among them, D u ∈R M×M and D i ∈R N×N , the set of users adjacent to user u is N u , the set of items adjacent to item i is N i ; Residual connections are implemented at each layer, and the message propagation process from layer l′-1 to layer l′ is: After L layers of propagation, the summation function is used as the readout function to combine the embeddings of all layers and obtain the final raw representation, i.e. l′ is a natural number, 1≤l′≤L.
[0013] An embodiment of the present invention also provides a recommendation method, comprising the following steps: executing the above-mentioned generation method to obtain a contrastive learning framework; obtaining a target user, inputting the target user into the contrastive learning framework, and obtaining recommended items.
[0014] An embodiment of the present invention also provides a recommendation device, comprising the following modules: a contrastive learning framework generation module, used to execute the above-mentioned generation method to obtain a contrastive learning framework; a recommendation module, used to obtain a target user, input the target user into the contrastive learning framework, and obtain recommended items.
[0015] The generation method, recommendation method and device of the contrastive learning framework provided by the embodiment of the present invention have the following advantages: The embodiment of the present invention discloses a generation method, recommendation method and device of the contrastive learning framework, the generation method comprises: obtaining a user set U = {u1, u2, ..., u M}, the item set I = {i1,i2,…,i N}, and the interaction matrix R∈{0,1} M×N , where R u,i =1 indicates that there is interaction between user u and item i, R u,i =0 indicates that there is no interaction between user u and item i, and both M and N are natural numbers; a contrastive learning framework is created, the contrastive learning framework includes: an L-layer original representation model, a learnable enhanced representation model and a joint learning model; the contrastive learning framework is trained based on the user set U, the item set I and the interaction matrix. The contrastive learning framework has the advantage of high recommendation accuracy, and still has high recommendation accuracy when facing data sparsity and noise problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A structural diagram of a comparative learning framework provided by an embodiment of the present invention;
[0017] Figure 2 A schematic diagram of a flow chart of a generation method provided in an embodiment of the present invention;
[0018] Figure 3 and Figure 4 This is a diagram of experimental results of the generation method provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0019] The present invention will be described in detail below in conjunction with the embodiments shown in the accompanying drawings. However, the embodiments do not limit the present invention, and any structural, methodological, or functional changes made by a person skilled in the art based on the embodiments are all within the protection scope of the present invention.
[0020] The following description and accompanying drawings fully illustrate the specific embodiments of this article so that those skilled in the art can practice them. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The scope of the embodiments of this article includes the entire scope of the claims, as well as all available equivalents of the claims. Herein, the terms "first", "second", etc. are only used to distinguish one element from another, without requiring or implying any actual relationship or order between these elements. In fact, the first element can also be called the second element, and vice versa. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the structure, device or equipment including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such structure, device or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the structure, device or equipment including the elements. Each embodiment is described in a progressive manner herein, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other.
[0021] The terms "longitudinal", "lateral", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. in this document indicate the orientation or position relationship based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing this document and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In the description of this document, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a mechanical connection or an electrical connection, it can also be the internal communication of two elements, it can be a direct connection, or it can be an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0022] Embodiment 1 of the present invention provides a method for generating a contrastive learning framework for recommendation, such as Figure 1 and Figure 2 As shown, the following steps are included:
[0023] Step 201: Obtain user set U = {u1,u2,…,u M}, the item set I = {i1,i2,…,i N}, and the interaction matrix R∈{0,1} M×N , where R u,i = 1 means there is interaction between user u and item i, Ru,i =0 means there is no interaction between user u and item i, and both M and N are natural numbers;
[0024] Step 202: creating a contrastive learning framework, the contrastive learning framework comprising: an L-layer original representation model, a learnable enhanced representation model and a joint learning model;
[0025] Step 203: Based on the user set U, the item set I and the interaction matrix, the contrastive learning framework is trained.
[0026] This contrastive learning framework can combine graph-level and node-level supervision signals to obtain more accurate embedding representations of users and items, and then accurately mine users' preferences for items and improve the accuracy of recommendations. It also has high recommendation accuracy when facing data sparsity and noise problems.
[0027] In this embodiment, the following steps are also included: based on the interaction matrix R, an adjacency matrix A∈R is generated. (M+N)×(M+N) , Based on the collaborative filtering algorithm in graph convolutional networks, the interaction matrix R is constructed as a bipartite graph G = {V, ε}, where V = {U ∪ I} is the set of all nodes, ε = {(u, i) | | u∈U, i∈I, R u,i = 1} represents the observed edge set; each user u and item i is assigned an initialized embedding vector The set of user and item embeddings is defined as E u ∈R M×d and E i ∈R N×d , d is the embedding dimension; construct the feature map G′={V,ε,X,A}, where X∈R (M+N)×d is the feature matrix, x u ,x i ∈R d is the eigenvector.
[0028] In this embodiment, in the original representation model, the information of multi-hop neighbors is generated: in, and Respectively represent the aggregation information of adjacent items and users to target node u and target node i at the l′th layer; represents the normalized interaction matrix, Among them, D u ∈R M×M and D i ∈R N×N , the set of users adjacent to user u is N u , the set of items adjacent to item i is N i; Residual connections are implemented at each layer, and the message propagation process from layer l′-1 to layer l′ is: After L layers of propagation, the summation function is used as the readout function to combine the embeddings of all layers and obtain the final raw representation, i.e. l′ is a natural number, 1≤l′≤L.
[0029] Here, we can use a graph convolutional network (omitting nonlinear activation and feature transformation) to aggregate the information of multi-hop neighbors. It is understandable that the information of multi-hop neighbors is represented by graph-level nodes. u ∈R M×M and D i ∈R N×N are all diagonal matrices.
[0030] In this embodiment, the enhanced representation model is used to generate g′={V, E, X, A}, and generate a multi-head graph attention network with adaptive attention coefficients where K is the number of hidden attention heads and the adaptive attention coefficient between users and items in each head is LeakyReLU(.) is a nonlinear activation function. represents the learnable weight vector of the k′th head, || is the association operation, k′ is a natural number, 1≤k′≤K; for each head, the calculated adaptive attention coefficient and adjacent features are aggregated into the following form: in, is the enhanced embedding of user u through the k′th head, and the enhanced embedding of item i through the k′th head is expressed as ELU(.) is a nonlinear activation function; the enhancement embeddings of all layers are summed to achieve the final learnable enhancement representation. in, and
[0031] Here, the self-attention mechanism of each head can be regarded as a single-layer feedforward neural network. and can be obtained in the same way. Here, an average operation is performed instead of stacking over multiple heads, because the desired dimension R d , which is calculated using the following formula: Among them, l represents the lth layer relative to the graph convolutional network. In order to reduce the complexity of the model, in this joint learning model, the multi-head graph attention network has only one layer.
[0032] In this embodiment, the joint learning model is used to: use inner product operation to predict user u's preference for item i Use pairwise Bayesian personalized ranking loss as the recommendation loss to optimize model parameters Where σ(·) is the sigmoid function to facilitate the output probability distribution, and the set O = {(u,i,j)|R u,i =1,R u,j =0}, R u,i =1 means item i interacts with user u, R u,j = 0 means there is no interaction between item j and user u;
[0033] Using the original representation and enhanced representation of the same user as positive samples, contrastive learning is performed through InfoNCE loss. Among them, τ is the temperature hyperparameter, u′ is the negative sample used to supervise the difference between different nodes; the contrast loss of the project
[0034] Final loss Where λ1 is the contrastive loss weight and λ2 is the regularization weight applied to the parameter Θ.
[0035] Here, the inner product is also used as a similarity measure to retrieve the top N candidates for recommendation based on the generated scores. The Adam optimizer can be adopted to minimize the loss L. Existing graph collaborative filtering based on contrastive learning realizes the representation of contrasting nodes by constructing two additional views, while the original representation does not directly involve the contrastive loss. This three-view paradigm is not only cumbersome but also may miss important original information. Nowadays, more and more studies suggest contrasting the enhanced representation with the original representation. Here, the original representation and enhanced representation of the same user are used as positive samples, and contrastive learning is performed through the InfoNCE loss.
[0036] Here, the contrastive learning framework is able to adaptively generate enhanced views for different datasets. Specifically, GCN (Graph Convolutional network) is first used as the backbone encoder to generate graph-level node representations for aggregating multi-hop neighbor information in the user-item bipartite graph. Next, unlike existing methods that randomly destroy the topological structure or node features of the original graph, multi-headed graph attention networks (Graph Attention Networks, GAT) are regarded as enhanced view generators to adaptively generate high-quality node-level enhanced views for contrastive learning, which can distinguish the importance differences of neighbor nodes by assigning different weights to them. Finally, the recommendation task and contrastive learning task are jointly trained in an end-to-end framework. In this way, the mutual supervision and synergy of GCN and GAT achieve learnable model enhancement.
[0037] In order to evaluate the performance of the model, the invention conducts experiments on three widely used recommendation datasets. The datasets are Yelp, Gowalla, and Amazon-Book. The detailed data of the datasets are as follows: Figure 3 shown.
[0038] The inventors used two indicators to evaluate the model performance, namely Recall and NDCG, and selected the most advanced collaborative filtering recommendation model as the comparison model. Figure 4 shown.
[0039] Figure 4 The comparison learning framework in this embodiment and other models are included as comparison models. The last line is the percentage improvement of the recommendation performance of the recommended model provided compared with the strongest baseline DCCF. Figure 4 It can be seen that the recommendation performance of the contrastive learning framework is significantly improved compared with the comparison models in all three datasets. The reasons are summarized as follows: (1) The contrastive learning framework processes multi-head GAT to adaptively generate node-level enhanced representations, which retains important original topological structures and compensates for the inability of the GCN model, which relies entirely on the graph-level adjacency matrix, to dynamically learn neighbor weights. (2) Benefiting from the contrastive learning paradigm, this paradigm combines graph-level and node-level supervision signals to achieve learnable model enhancement to achieve better neighbor aggregation, thereby providing more informative user and item representations.
[0040] Embodiment 2 of the present invention provides a device for generating a contrastive learning framework for recommendation, comprising the following modules:
[0041] Information acquisition module, used to obtain the user set U = {u1,u2,…,u M}, the item set I = {i1,i2,…,i n}, and the interaction matrix R∈{0,1} M×N , where R u,i = 1 means there is interaction between user u and item i, R u,i =0 means there is no interaction between user u and item i, and both M and N are natural numbers;
[0042] A framework creation module, used to create a contrastive learning framework, wherein the contrastive learning framework includes: an L-layer original representation model, a learnable enhanced representation model, and a joint learning model;
[0043] The training module is used to train the contrastive learning framework based on the user set U, the item set I and the interaction matrix.
[0044] In this embodiment, the following modules are also included:
[0045] Preprocessing module, used to generate adjacency matrix A∈R based on interaction matrix R (M+N)×(M+N) , Based on the collaborative filtering algorithm in graph convolutional networks, the interaction matrix R is constructed as a bipartite graph G = {V, ε}, where V = {U ∪ I} is the set of all nodes, ε = {(u, i) | | u∈U, i∈I, R u,i = 1} represents the observed edge set; each user u and item i is assigned an initialized embedding vector The set of user and item embeddings is defined as E u ∈R M×d and E i ∈R N×d , d is the embedding dimension; construct the feature map G′={V,ε,X,A}, where X∈R (M+N)×d is the feature matrix, x u ,x i ∈R d is the eigenvector.
[0046] In this embodiment, in the original representation model, the information of multi-hop neighbors is generated: in, and Respectively represent the aggregation information of adjacent items and users to target node u and target node i at the l′th layer; represents the normalized interaction matrix, Among them, D u ∈R M×M and D i ∈R N×N , the set of users adjacent to user u is N u , the set of items adjacent to item i is N i ; Residual connections are implemented at each layer, and the message propagation process from layer l′-1 to layer l′ is: After L layers of propagation, the summation function is used as the readout function to combine the embeddings of all layers and obtain the final raw representation, i.e. l′ is a natural number, 1≤l′≤L.
[0047] Embodiment 3 of the present invention provides a recommendation method, comprising the following steps:
[0048] Step 1: Execute the generation method in Example 1 to obtain a comparative learning framework;
[0049] Step 2: Obtain the target user, input the target user into the contrastive learning framework, and obtain recommended items.
[0050] Embodiment 4 of the present invention provides a recommendation device, including the following modules:
[0051] A contrastive learning framework generation module, used to execute the generation method in the first embodiment to obtain a contrastive learning framework;
[0052] The recommendation module is used to obtain a target user, input the target user into the contrastive learning framework, and obtain recommended items.
[0053] It should be understood that although this specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation mode may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
[0054] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for generating a contrastive learning framework for recommendation, characterized in that: The following steps are involved: Get the user set U = {u1,u2,…,u M }, the item set I = {i1,i2,…,i N }, and the interaction matrix R∈{0,1} M×N , where R u,i =1 indicates that there is interaction between user u and item i, R u,i =0 means there is no interaction between user u and item i, and both M and N are natural numbers; Creating a contrastive learning framework, the contrastive learning framework comprising: an L-layer original representation model, a learnable enhanced representation model, and a joint learning model; The contrastive learning framework is trained based on the user set U, the item set I and the interaction matrix.
2. The generation method according to claim 1, characterized in that: The following steps are also included: Based on the interaction matrix R, generate the adjacency matrix A∈R (M+N)×(M+N) , Based on the collaborative filtering algorithm in graph convolutional networks, the interaction matrix R is constructed as a bipartite graph G = {V, ε}. Where V = {U ∪ I} is the set of all nodes, ε = {(u,i) | | u∈U, i∈I, R u,i = 1} represents the observed edge set; each user u and item i is assigned an initialized embedding vector The set of user and item embeddings is defined as E u ∈R M×d and E i ∈R N×d , d is the embedding dimension; construct the feature map G ′ = {V, ε, X, A}, where X ∈ R (M+N)×d is the feature matrix, x u ,x i ∈R d is the eigenvector.
3. The generation method according to claim 2, characterized in that: In the original representation model, information about multi-hop neighbors is generated: in, and Respectively represent the first ′ Aggregate information of adjacent items and users to target node u and target node i; represents the normalized interaction matrix, Among them, D u ∈R M×M and D i ∈R N×N , the set of users adjacent to user u is N u , the set of items adjacent to item i is N i ; Residual connections are implemented in each layer, starting from the lth ′ -1st floor to lth floor ′ The message propagation process of the layer is: After L layers of propagation, the summation function is used as the readout function to combine the embeddings of all layers and obtain the final raw representation, i.e. l ′ is a natural number, 1≤l ′ ≤L.
4. The generation method according to claim 3, characterized in that: The enhanced representation model is used to generate g ′ = {V,ε,X,A}, based on selecting a multi-head graph attention network to generate an adaptive attention coefficient where K is the number of hidden attention heads and the adaptive attention coefficient between users and items in each head is LeakyReLU(.) is a nonlinear activation function. represents the learnable weight vector of the k′th head, || is the association operation, k′ is a natural number, 1≤k′≤K; for each head, the calculated adaptive attention coefficient and adjacent features are aggregated into the following form: in, is the enhanced embedding of user u through the k′th head, and the enhanced embedding of item i through the k′th head is expressed as ELU(.) is a nonlinear activation function; the enhancement embeddings of all layers are summed to achieve the final learnable enhancement representation. in, and 5. The generation method according to claim 4, characterized in that: The joint learning model is used to predict user u’s preference for item i using inner product operation Use pairwise Bayesian personalized ranking loss as the recommendation loss to optimize model parameters Where σ(·) is the sigmoid function to facilitate the output probability distribution, and the set O = {(u,i,j)|R u,i =1,R u,j =0}, R u,i =1 means item i interacts with user u, R u,j = 0 means there is no interaction between item j and user u; Using the original representation and enhanced representation of the same user as positive samples, contrastive learning is performed through InfoNCE loss. Among them, τ is the temperature hyperparameter, u′ is the negative sample used to supervise the difference between different nodes; the contrast loss of the project Final loss Where λ1 is the contrastive loss weight and λ2 is the regularization weight applied to the parameter Θ.
6. A device for generating a contrastive learning framework for recommendation, characterized in that: Includes the following modules: Information acquisition module, used to obtain the user set U = {u1,u2,…,u M }, the item set I = {i1,i2,…,i N }, and the interaction matrix R∈{0,1} M×N , where R u,i =1 indicates that there is interaction between user u and item i, R u,i =0 means there is no interaction between user u and item i, and both M and N are natural numbers; A framework creation module, used to create a contrastive learning framework, wherein the contrastive learning framework includes: an L-layer original representation model, a learnable enhanced representation model, and a joint learning model; The training module is used to train the contrastive learning framework based on the user set U, the item set I and the interaction matrix.
7. The generating device according to claim 6, characterized in that Also includes the following modules: Preprocessing module, used to generate adjacency matrix A∈R based on interaction matrix R (M+N)×(M+N) , Based on the collaborative filtering algorithm in graph convolutional networks, the interaction matrix R is constructed as a bipartite graph G = {V, ε}. Where V = {U ∪ I} is the set of all nodes, ε = {(u,i) | | u∈U, i∈I, R u,i = 1} represents the observed edge set; each user u and item i is assigned an initialized embedding vector The set of user and item embeddings is defined as E u ∈R M×d and E i ∈R N×d , d is the embedding dimension; construct the feature map G ′ = {V, ε, X, A}, where X ∈ R (M+N)×d is the feature matrix, x u ,x i ∈R d is the eigenvector.
8. The generating device according to claim 7, characterized in that In the original representation model, information about multi-hop neighbors is generated: in, and Respectively represent the first ′ Aggregate information of adjacent items and users to target node u and target node i; represents the normalized interaction matrix, Among them, D u ∈R M×M and D i ∈R N×N , the set of users adjacent to user u is N u , the set of items adjacent to item i is N i ; Residual connections are implemented in each layer, starting from the lth ′ -1st floor to lth floor ′ The message propagation process of the layer is: After L layers of propagation, the summation function is used as the readout function to combine the embeddings of all layers and obtain the final raw representation, i.e. l ′ is a natural number, 1≤l ′ ≤L.
9. A recommendation method, characterized in that: The following steps are involved: Execute the generation method described in any one of claims 1 to 5 to obtain a contrastive learning framework; A target user is obtained, the target user is input into the contrastive learning framework, and recommended items are obtained.
10. A recommendation device, characterized in that: Includes the following modules: A contrastive learning framework generation module, used to execute the generation method described in any one of claims 1 to 5 to obtain a contrastive learning framework; The recommendation module is used to obtain a target user, input the target user into the contrastive learning framework, and obtain recommended items.