A contrast learning recommendation method based on adaptive view optimization

By employing an adaptive view optimization module and a multi-level contrastive learning strategy, the shortcomings of graph neural network recommendation methods in handling redundant information and capturing fine-grained features are addressed, thereby improving the expressive power and accuracy of the recommendation system.

CN121092786BActive Publication Date: 2026-02-27NANCHANG NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511640975.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-02-27
Estimated Expiration
2045-11-11

AI Technical Summary

Technical Problem

Existing recommendation methods based on graph neural networks (GNNs) are insufficient in handling redundant information in graph structures, struggle to capture high-order interactions, and are poor at capturing fine-grained features of continuous data, especially when distinguishing samples with small feature differences.

Method used

An adaptive view optimization module is adopted, which combines the Gumbel-softmax method and multilayer perceptron (MLP). Through a multi-level contrastive learning strategy, an enhanced interaction graph is generated and node features are fused. The model is optimized using Bayesian personalized ranking loss and multi-level contrastive learning loss.

Benefits of technology

It significantly improves the expressive power of graph structures and the effect of feature learning, enhances the model's ability to perceive subtle differences, and improves the accuracy and robustness of the recommendation system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121092786B_ABST
    Figure CN121092786B_ABST
Patent Text Reader

Abstract

The application discloses a contrast learning recommendation method based on adaptive view optimization, which comprises the following steps: an adaptive view enhancement module generates an enhanced interaction graph from an original user-item interaction graph and calculates an adaptive enhanced loss; the original user-item interaction graph and the enhanced interaction graph are input into a graph message passing encoder module to perform neighborhood information propagation and node feature fusion to generate node representation; a view alignment task is performed by a view alignment module, the node representation is fused, and an aligned node feature matrix is output; the final optimization of a recommendation model is performed; a Bayesian personalized ranking loss and a multi-level contrast learning loss are calculated synchronously, and continuous iteration is performed until the recommendation model converges. With the aid of the contrast learning strategy based on the multi-level contrast learning loss, the feature distance is used to screen local negative samples and dynamically adjust the weight, difficult negative samples similar to anchor samples are optimized, and the overall sample quality is improved, so that the accuracy of the recommendation result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of neural networks, in particular to a contrast learning recommendation method based on adaptive view optimization. BACKGROUND

[0002] In today's Internet era, interactive data is growing explosively, and the problem of information overload is becoming increasingly prominent. As an effective tool to solve this problem, the core task of the recommendation system is to achieve accurate recommendation by mining the potential association between users and items. In recent years, recommendation methods based on graph neural networks (GNN) have become the mainstream paradigm due to their excellent graph structure modeling capabilities. This method recursively transmits messages along user-item interaction edges and conducts multi-round feature aggregation among neighbor nodes, thereby learning effective embedding representations, which not only capture high-order association relationships but also to some extent alleviate the cold start problem.

[0003] However, the graph neural network (GNN) model faces serious challenges in data sparsity and noise interference in practice. To overcome these inherent defects, researchers have introduced contrast learning (CL) as a key improvement technology into the graph neural network (GNN) framework, forming a graph neural network recommendation model based on contrast learning. This type of model aims to improve the robustness and generalization ability of the main recommendation task by introducing self-supervised signals.

[0004] Despite the continuous evolution of technology, existing methods still have obvious shortcomings:

[0005] In terms of core graph neural network recommendation models, the GC-MC model is difficult to capture high-order interaction relationships; the PinSage model has high computational complexity and is sensitive to hyperparameters; the NGCF model is prone to overfitting on sparse data due to redundant nonlinear transformations; and the LightGCN model may lose valuable nonlinear interaction patterns due to oversimplification.

[0006] In terms of contrast learning technology as an improvement strategy, existing enhancement methods also have some limitations. The random enhancement strategy of the SGL model may destroy important interaction structures; the negative sample sampling strategy of the SLRec model is too simple; the HCCF model has a complex structure and lacks adaptability in its enhancement strategy; the GraphAug model lacks personalized processing of user behavior with different sparsity; and the enhancement strategy of the CLSRec model is still in a fixed mode, lacking dynamic adjustment capability.

[0007] In summary, existing recommendation methods based on graph neural networks (GNN), whether or not they introduce contrast learning as an auxiliary technology, generally have shortcomings. First, they lack the ability to handle redundant information in the graph structure; second, they do not capture fine-grained features of continuous data well, and their discrimination ability is limited when faced with samples with small feature differences. SUMMARY

[0008] In view of the deficiencies of the prior art, the present application proposes a contrast learning recommendation method based on adaptive view optimization, which reduces the interference of redundant information by introducing a Gumbel-softmax method and a multi-layer perceptron (MLP) to form an adaptive view optimization module, and adopts a contrast learning strategy based on a multi-level contrast learning RNC to capture the continuity features of the data and accurately distinguish the subtle differences between samples, so as to solve the problems mentioned in the background art.

[0009] To achieve the above-mentioned purpose, the present application provides the following technical scheme: a contrast learning recommendation method based on adaptive view optimization, comprising the following steps:

[0010] Step S1: constructing a recommendation dataset, formalizing the recommendation dataset task;

[0011] Step S2: constructing a recommendation model, the recommendation model adopting a multi-module structure combined in series, composed of an adaptive view enhancement module, a graph message passing encoder module, a view alignment module and a model optimization module;

[0012] Step S3: the adaptive view enhancement module generates an enhanced interaction graph from the original user-item interaction graph; the original user-item interaction graph is subjected to differentiable edge sampling through a multi-layer perceptron and a Gumbel-softmax method to generate an enhanced interaction graph; the cosine similarity constraint of the node features of the original user-item interaction graph and the enhanced interaction graph is performed, and the adaptive enhancement loss is calculated;

[0013] Step S4: inputting the original user-item interaction graph and the enhanced interaction graph obtained in step S3 into the graph message passing encoder module, and performing neighborhood information propagation and node feature fusion on the original user-item interaction graph and the enhanced interaction graph through a lightweight multi-layer graph convolutional network, to generate more expressive original user-item interaction graph node representations and enhanced interaction graph node representations;

[0014] Step S5: based on the original user-item interaction graph node representations and the enhanced interaction graph node representations generated in step S4, performing a view alignment task through the view alignment module, and adopting an average pooling strategy to fuse the node representations of the original user-item interaction graph and the enhanced interaction graph, and outputting an aligned node feature matrix;

[0015] Step S6: final optimization of the recommendation model; based on the recommendation dataset of step S1 and the aligned node feature matrix output in step S5, the Bayesian personalized ranking loss and the multi-level contrast learning loss are calculated synchronously, and the Bayesian personalized ranking loss, the multi-level contrast learning loss and the adaptive enhancement loss calculated in step S3 are jointly optimized, and the iteration is continued until the recommendation model converges.

[0016] Furthermore, in step S1, the recommendation dataset task is formalized, specifically as follows:

[0017] Step S11: Use a graph structure to represent the interaction between the user and the item. This is the original user-item interaction graph, containing a set of nodes. From user set and item collection Composition, the set of edges between nodes If user node With item nodes If there is interaction, then ;

[0018] Step S12, Construct the adjacency matrix: Define the adjacency matrix for:

[0019] (1);

[0020] in, Let A represent the set of real numbers, where the adjacency matrix A is a set of real numbers with dimensions of (m+n)×(m+n), and m and n represent the number of users and the number of items, respectively. R is the user interaction matrix, with a value of 1 indicating an interaction between two nodes, and T represents the transpose of the matrix;

[0021] Step S13, for the adjacency matrix Normalization is performed to obtain a symmetric normalized adjacency matrix. .

[0022] Furthermore, in step S3, the adaptive view enhancement module generates an enhanced interaction graph from the original user-item interaction graph; specifically:

[0023] Step S31: For two nodes connected by an edge in the original user-item interaction graph, the node features of the two nodes after linear transformation are concatenated and input into a multilayer perceptron to calculate the original log probability of an edge being preserved or enhanced, as shown in formula (2):

[0024] (2);

[0025] in, Represents the edges in view k The original logarithmic odds, i and j represent the user nodes connected by the edge, respectively. and item nodes , and This represents the feature representation of the corresponding node after a linear transformation. It is a multilayer perceptron. For splicing operations;

[0026] Step S32, the original log-likelihood obtained in S31 is injected with Kimble random noise and adjusted by a Sigmoid function with a temperature parameter to convert the original log-likelihood into an approximate binary continuous differentiable edge weight, as shown in equation (3):

[0027] (3);

[0028] wherein, represents an edge The calculated differentiable edge weight, and represents two independent Kimble random noises, is a temperature parameter, and the temperature parameter controls the randomness of the enhancement strategy;

[0029] Step S33, the symmetric normalized adjacency matrix of step S13 is enhanced to obtain an enhanced interaction graph adjacency matrix , that is, the calculated differentiable edge weight of step S32 is assembled into an edge weight matrix , and a Hadamard product calculation is performed, and the calculation formula is as follows:

[0030] (4);

[0031] wherein, is the calculated enhanced interaction graph adjacency matrix, is the symmetric normalized adjacency matrix, is the Hadamard product, is the edge weight matrix assembled by the calculated differentiable edge weight ;

[0032] Step S34, the cosine similarity of the constraint original user-item interaction graph and the enhanced interaction graph node features is calculated to calculate an adaptive enhancement loss;

[0033] The calculation of the adaptive enhancement loss is shown in equation (5):

[0034] (5);

[0035] wherein, represents the calculated adaptive enhancement loss, m and n represent the number of users and the number of items respectively, and p and q represent the loop indexes of traversing all user-item pairs, and ​respectively represent the joint feature vectors of the user and item features in the original user-item interaction graph and the enhanced interaction graph, denotes the length of the vector.

[0036] Further, in step S4, the original user-item interaction graph and the enhanced interaction graph obtained in step S3 are input into a graph message passing encoder module, and the original user-item interaction graph and the enhanced interaction graph are subjected to neighborhood information propagation and node feature fusion through a lightweight multi-layer graph convolutional network, specifically:

[0037] In step S41, the user nodes and item nodes in the recommendation dataset are respectively initialized to obtain an initial embedding representation, and the initial embedding representation is simultaneously used as the input of the graph convolutional network of the original user-item interaction graph and the enhanced interaction graph;

[0038] In step S42, consistent local neighborhood information aggregation is performed on the original user-item interaction graph and the enhanced interaction graph, as shown in formula (6); wherein the original user-item interaction graph uses the symmetric normalized adjacency matrix obtained after the normalization processing in step S13 as input, and the enhanced interaction graph uses the enhanced interaction graph adjacency matrix enhanced in step S33 as input;

[0039] The local neighborhood aggregation is represented as:

[0040] (6);

[0041] wherein, and respectively represent the aggregation of item neighborhood information to the user and the aggregation of user neighborhood information to the item, denotes the i-th row of the symmetric normalized adjacency matrix encoding the connection strength of the user node with all items, denotes the j-th column of the symmetric normalized adjacency matrix encoding the connection strength of the item node with all users, is the user node initialization embedding representation, is the item node initialization embedding representation; the user node embedding representation of the 0th layer of the convolutional layer of the graph convolutional network and the item node embedding representation of the 0th layer ;

[0042] In step S43, the local neighborhood information aggregation result of step S42 and the node embedding of the previous layer of the convolutional layer of the graph convolutional network are fused through a residual connection to update the node embedding of the current layer of the convolutional layer of the graph convolutional network; the embedding update is shown in formula (7):

[0043] , (7);

[0044] in, The graph convolutional network represents the first... User node embedding in the layer, Indicates the first Layer user node Information aggregated from domain item nodes The graph convolutional network represents the first... User nodes in the layer Embedded representation;

[0045] The graph convolutional network represents the first... Layer item node embedding, Indicates the first Layer Item Node Information aggregated from domain user nodes The graph convolutional network represents the first... Layer of item knots Embedded representation;

[0046] Step S43 involves stacking L layers of convolutional layers to gradually fuse higher-order neighborhood information, performing this process in parallel and completely consistent across the original user-item interaction graph and the enhanced interaction graph.

[0047] Step S44: Sum the output embeddings of all convolutional layers in the graph convolutional network, including the initial node embedding representation of layer 0, to obtain the final embedding representations of user nodes and item nodes respectively. and The embeddings of all layers in the graph convolutional network are summed to generate the final node embedding representations of the original user-item interaction graph and the enhanced interaction graph, as shown in Equation (8):

[0048] (8);

[0049] in, For user nodes The final embedding representation, For item nodes The final embedding representation; L represents the total number of layers in the graph convolutional network. Indicates the index of the current layer. and Represents user node and item nodes In the Layer embedding representation;

[0050] Step S45, the final embedding representation of the user nodes and the final embedding of the item nodes obtained on the original user-item interaction graph constitute the final embedding representation of the original user-item interaction graph The final embedding representation of the user nodes and the final embedding of the item nodes obtained on the enhanced interaction graph constitute the final embedding representation of the enhanced interaction graph .

[0051] Further, the view alignment task in step S5 is performed by the view alignment module, specifically:

[0052] Based on the final embedding representation of the original user-item interaction graph generated in step S45 and the final embedding representation of the enhanced interaction graph For each node, the average pooling strategy is adopted to average the double-view node features to obtain the aligned node feature matrix The aligned feature of each node in the matrix is calculated as shown in formula (9):

[0053] (9);

[0054] Wherein, represents the aligned feature of each node calculated, each constitutes the aligned node feature matrix , represents the final embedding representation of each node in the original user-item interaction graph, represents the final embedding representation of each node in the enhanced interaction graph.

[0055] Further, in step S6, the Bayesian personalized ranking loss is calculated to optimize the main task of the recommendation model; the specific steps are as follows:

[0056] Step S611, according to the original interaction data in the recommendation data set, each observed user-item interaction pair is constructed as a positive sample, and a randomly sampled item from the set of never-interacted items is constructed as a negative sample for the user, to form a set of training triplets , and a training batch is constructed;

[0057] Step S612, based on the user node features and item node features of the aligned node feature matrix , the inner product of the user-item pair is calculated to predict the interaction score; the interaction score calculation is shown in formula (10):

[0058] (10);

[0059] Wherein,​ denotes the computed user-item pair interaction score, denotes each user node feature, denotes each item node feature, denotes the transpose;

[0060] Step S613, for each training triple in the training batch , compute the Bayesian personalized ranking loss; as shown in equation (11):

[0061] (11);

[0062] wherein, denotes the Bayesian personalized ranking loss, denotes the set of training triples, denotes the positive sample, denotes the negative sample, denotes the sigmoid function, denotes the positive sample interaction score, denotes the negative sample interaction score.

[0063] Further, in step S6, the multi-level contrastive learning loss is computed, and the specific steps are as follows:

[0064] Step S614, according to the final embedding representation of the original user-item interaction graph generated in step S44 and the final embedding representation of the enhanced interaction graph , for node , the embedding representation of the original user-item interaction graph and the embedding representation of the enhanced interaction graph constitute a positive sample pair; all other nodes of the same type as node in the current training batch constitute the negative sample set of node , and the same type node means the same user or the same item;

[0065] Step S615, for node and node in the negative sample set, compute the norm distance; as shown in equation (12):

[0066] (12);

[0067] wherein, denotes the computed norm distance between node and node in the negative sample set, denotes the embedding representation of node in the original user-item interaction graph, representing nodes in the negative sample set in the embedding representation of the original user-item interaction graph;

[0068] Step S616, setting a dynamic threshold , retaining negative samples satisfying ;

[0069] Step S617, calculating user-side and item-side multi-level contrastive learning losses based on the user set and the item set;

[0070] The user-side multi-level contrastive learning loss is calculated as shown in equation (13):

[0071] (13)

[0072] wherein, represents the calculated user-side multi-level contrastive learning loss, a is the user index, and m is the number of users, represents a logarithmic function, represents an exponential function, represents a temperature coefficient, represents the embedding representation of the user node in the original user-item interaction graph, represents the embedding representation of the user node in the enhanced interaction graph, represents the negative sample set, represents a cosine similarity function;

[0073] The item-side multi-level contrastive learning loss is calculated as shown in equation (14):

[0074] (14)

[0075] wherein, represents the calculated item-side multi-level contrastive loss, b is the item index, and n is the number of items, represents the embedding representation of the item node in the original user-item interaction graph, represents the embedding representation of the item node in the enhanced interaction graph;

[0076] Step S618, calculating the total multi-level contrastive learning loss; as shown in equation (15):

[0077] (15)

[0078] wherein, represents the total multi-level contrastive learning loss.

[0079] Further, in step S6, the final optimization of the recommendation model is performed, specifically:

[0080] Step S619, jointly optimize the Bayesian personalized ranking loss, the multi-level contrastive learning loss and the adaptive enhancement loss calculated in step S3 to calculate the overall training loss; as shown in formula (16):

[0081] (16);

[0082] wherein, is the overall training loss, indicates the adaptive enhancement loss weight, indicates the Bayesian personalized ranking loss weight;

[0083] Step S620, in the training phase, the overall training loss is optimized by dynamically adjusting the weight, and the adaptive view enhancement loss weight is adjusted using an exponential decay strategy, the initial value of the adaptive view enhancement loss weight =0.3, the decay coefficient , the adaptive view enhancement loss weight is gradually reduced as the training proceeds, so that the recommendation model gradually shifts from focusing on view construction to other goals;

[0084] Step S621, the multi-level contrastive learning loss weight is kept as a fixed value =0.2, and the contrastive learning task maintains a stable contribution throughout the training process.

[0085] Compared with the prior art, the present application has the following beneficial effects:

[0086] (1) The present application proposes an innovative adaptive view optimization module from a new perspective, by introducing a technical solution combining the Gumbel-softmax method and the multi-layer perceptron (MLP); the adaptive view optimization module uses the multi-layer perceptron (MLP) for feature modeling, and uses the Gumbel-softmax method to realize differentiable optimization of feature weights, so that the weight adjustment process can be synchronized with the model training; through the error minimization strategy, the feature reconstruction of the enhanced view and the original view is effectively realized, ensuring that the enhanced view always retains the key information of the task, and significantly improving the expression ability of the graph structure and the feature learning effect of the model.

[0087] (2) The present application innovatively introduces a contrastive learning strategy based on the Rank-N-Contrast multi-level contrastive learning loss, which realizes dynamic weighting processing of features by maximizing the relative ranking correlation between samples; this technology can effectively adjust the relative distance between anchor samples and other samples in the embedding space, making it more consistent with the ranking logic in the real world, so as to better capture the continuity features of the data and improve the learning ability of the model for implicit features.

[0088] (3) This invention addresses the technical challenge of distinguishing samples with small feature differences by proposing an innovative method that enhances the learning of relative relationships between samples. This technique is particularly suitable for scenarios where the feature differences between samples are small. By enhancing the model's ability to perceive subtle differences, it significantly improves the model's fine-grained distinguishing ability and solves the problem of insufficient accuracy of traditional methods in recommending similar users or items.

[0089] (4) This invention constructs a complete end-to-end dynamic optimization training architecture, which organically combines the adaptive view optimization module with the contrastive learning strategy. This architecture supports dynamic optimization and adjustment during training, which not only improves the expressive power of the model, but also ensures the stability and reliability of the enhancement process, providing a more robust and accurate solution for recommendation systems. Attached Figure Description

[0090] Figure 1 This is a schematic diagram of the overall model framework of the present invention. Detailed Implementation

[0091] like Figure 1 As shown, the present invention provides the following technical solution: A contrastive learning recommendation method based on adaptive view optimization, comprising the following steps:

[0092] Step S1: Construct the recommendation dataset and formalize the recommendation dataset task;

[0093] Step S2: Construct the recommendation model. The recommendation model adopts a serially combined multi-module structure, consisting of an adaptive view enhancement module, a graph message passing encoder module, a view alignment module, and a model optimization module.

[0094] Step S3: The adaptive view enhancement module generates an enhanced interaction graph from the original user-item interaction graph; it performs differentiable edge sampling on the original user-item interaction graph using a multilayer perceptron and the Kimber-soft maximum method to generate the enhanced interaction graph; it performs cosine similarity constraints on the node features of the original user-item interaction graph and the enhanced interaction graph, and calculates the adaptive enhancement loss.

[0095] Step S4: Input the original user item interaction graph and the enhanced interaction graph obtained in step S3 into the graph message passing encoder module. Then, through a lightweight multi-layer graph convolutional network, perform neighborhood information propagation and node feature fusion on the original user item interaction graph and the enhanced interaction graph to generate more expressive node representations of the original user item interaction graph and the enhanced interaction graph.

[0096] Step S5: Based on the original user-item interaction graph node representation generated in step S4 and the enhanced interaction graph node representation, a view alignment task is performed by a view alignment module, the node representations of the original user-item interaction graph and the enhanced interaction graph are fused by using an average pooling strategy, and an aligned node feature matrix is output.

[0097] Step S6: Final optimization of the recommendation model; based on the recommendation dataset in step S1 and the aligned node feature matrix output in step S5, the Bayesian personalized ranking loss and the multi-level contrastive learning loss are calculated synchronously, the Bayesian personalized ranking loss, the multi-level contrastive learning loss and the adaptive enhancement loss calculated in step S3 are jointly optimized, and the iteration is continued until the recommendation model converges.

[0098] Further, in step S1, the recommendation dataset task is formalized, specifically:

[0099] Step S11, a graph structure is used to represent the interaction between users and items, and let be the original user-item interaction graph, where the node set is composed of the user set and the item set , and the edge set between nodes is if the user node and the item node have an interaction.

[0100] Step S12, construct an adjacency matrix: define the adjacency matrix as:

[0101] (1);

[0102] wherein represents a real set, the adjacency matrix A is a (m+n) x (m+n) dimensional real set, m and n represent the number of users and the number of items respectively, , R is the user interaction matrix, and the value 1 indicates that there is an interaction between two nodes, and T represents the transpose of the matrix.

[0103] Step S13, normalize the adjacency matrix to obtain a symmetric normalized adjacency matrix .

[0104] Further, in step S3, the adaptive view enhancement module generates an enhanced interaction graph from the original user-item interaction graph; specifically:

[0105] Step S31, for two nodes connected by an edge in the original user-item interaction graph, the node features of the two nodes after linear transformation are spliced, input into a multi-layer perception, and the original log-odds of the edge being retained or enhanced are calculated, as shown in formula (2):

[0106] (2);

[0107] wherein, represents the original log-odds of the edge in view k, i and j represent the user node and the item node connected by the edge, and represent the feature representations of the corresponding nodes after linear transformation, is a multi-layer perception, is a splicing operation;

[0108] Step S32, the original log-odds obtained in S31 are injected into a Kimmel random noise, and adjusted by a Sigmoid function and a temperature parameter, to convert the original log-odds into a nearly binary continuous differentiable edge weight, as shown in formula (3):

[0109] (3);

[0110] wherein, represents the differentiable edge weight calculated for the edge , and represent two independent Kimmel random noises, is a temperature parameter, and the temperature parameter controls the randomness of the enhancement strategy;

[0111] Step S33, the symmetric normalized adjacency matrix of step S13 is enhanced to obtain an enhanced interaction graph adjacency matrix , that is, the differentiable edge weight calculated for the edge by step S32 is assembled into an edge weight matrix , and a Hadamard product is calculated, and the calculation formula is as follows:

[0112] (4);

[0113] wherein, is the enhanced interaction graph adjacency matrix calculated, is the symmetric normalized adjacency matrix, is the Hadamard product, is the edge The computed differentiable edge weight The assembled edge weight matrix

[0114] Step S34, the cosine similarity of the constraint original user-item interaction graph and the enhanced interaction graph node features is performed, and an adaptive enhanced loss is calculated;

[0115] The calculation of the adaptive enhanced loss is shown in formula (5):

[0116] (5)

[0117] Wherein, The calculated adaptive enhanced loss is represented by m and n, respectively representing the number of users and the number of items, p and q representing the loop index of traversing all user-item pairs, And The joint feature vectors of the user and item features in the original user-item interaction graph and the enhanced interaction graph are represented by and respectively, The length of the vector is represented by

[0118] Further, in step S4, the original user-item interaction graph and the enhanced interaction graph obtained in step S3 are input into the graph message passing encoder module, and the neighborhood information propagation and node feature fusion of the original user-item interaction graph and the enhanced interaction graph are performed through the lightweight multi-layer graph convolutional network, specifically:

[0119] Step S41, the user nodes and item nodes in the recommendation dataset are respectively initialized and embedded, and the initialized embedded representation is used as the input of the graph convolutional network of the original user-item interaction graph and the enhanced interaction graph;

[0120] Step S42, the same form of local neighborhood information aggregation is performed on the original user-item interaction graph and the enhanced interaction graph, as shown in formula (6); wherein the original user-item interaction graph uses the symmetric normalized adjacency matrix obtained by the normalization processing in step S13 as input, and the enhanced interaction graph uses the enhanced interaction graph adjacency matrix enhanced in step S33 as input;

[0121] The local neighborhood aggregation is represented as:

[0122] (6)

[0123] Wherein, And The information of the user and the item aggregated from the neighborhood is represented by and respectively, The i-th row of the symmetric normalized adjacency matrix is represented by Connection strength with all items Represents a symmetric normalized adjacency matrix The j-th column encodes the item node. Connection strength with all users Initialize the embedded representation for the user node. Initialize the embedding representation for item nodes; use it as the user node embedding representation for the 0th layer of the graph convolutional network. and the embedding representation of item nodes at level 0 ;

[0124] Step S43: The local neighborhood information aggregation result from step S42 is fused with the node embedding of the previous layer of the graph convolutional network through residual connections to update the node embedding of the current layer of the graph convolutional network; the embedding update is shown in formula (7):

[0125] , (7);

[0126] in, The graph convolutional network represents the first... User node embedding in the layer, Indicates the first Layer user node Information aggregated from domain item nodes The graph convolutional network represents the first... User nodes in the layer Embedded representation;

[0127] The graph convolutional network represents the first... Layer item node embedding, Indicates the first Layer Item Node Information aggregated from domain user nodes The graph convolutional network represents the first... Layer of item knots Embedded representation;

[0128] Step S43 involves stacking L layers of convolutional layers to gradually fuse higher-order neighborhood information, performing this process in parallel and completely consistent across the original user-item interaction graph and the enhanced interaction graph.

[0129] Step S44: Sum the output embeddings of all convolutional layers in the graph convolutional network, including the initial node embedding representation of layer 0, to obtain the final embedding representations of user nodes and item nodes respectively. and The embedding of all layers of the graph convolution network is added to generate the final node embedding representation of the original user-item interaction graph and the enhanced interaction graph; as shown in formula (8):

[0130] (8);

[0131] wherein, is the final embedding representation of the user node , is the final embedding representation of the item node ; L represents the total number of layers of the graph convolution network, represents the index of the current layer, and represent the embedding representation of the user node and the item node at the first layer;

[0132] Step S45, the final embedding representation of the user node and the final embedding of the item node obtained on the original user-item interaction graph constitute the final embedding representation of the original user-item interaction graph , and the final embedding representation of the user node and the final embedding of the item node obtained on the enhanced interaction graph constitute the final embedding representation of the enhanced interaction graph .

[0133] Further, the view alignment task in step S5 is performed by the view alignment module, specifically:

[0134] Based on the final embedding representation of the original user-item interaction graph and the final embedding representation of the enhanced interaction graph generated in step S45, for each node, the average pooling strategy is adopted to average the double-view node features to obtain the aligned node feature matrix , and the aligned feature of each node in the matrix is calculated as shown in formula (9):

[0135] (9);

[0136] wherein, represents the aligned feature of each node calculated, and each constitutes the aligned node feature matrix , represents the final embedding representation of each node in the original user-item interaction graph, represents the final embedding representation of each node in the enhanced interaction graph.

[0137] Furthermore, in step S6, the Bayesian personalized ranking loss is calculated to optimize the main task of the recommendation model; the specific steps are as follows:

[0138] Step S611: Based on the original interaction data in the recommendation dataset, construct a positive sample for each observed user-item interaction pair, and randomly sample an item from the set of items that have never been interacted with to construct a negative sample, thus forming a training triplet. set Construct training batches;

[0139] Step S612, based on the aligned node feature matrix The interaction score is predicted by calculating the inner product of user-item pairs based on the user node features and item node features; the interaction score is calculated as shown in formula (10):

[0140] (10);

[0141] in, This represents the calculated user item interaction score. Representing the characteristics of each user node, Representing the characteristics of each item node, Indicates transpose;

[0142] Step S613, for each training triplet in the training batch Calculate the Bayesian personalized ranking loss, as shown in formula (11):

[0143] (11);

[0144] in, This represents the Bayesian personalized ranking loss. This represents the training triple set. Indicates a positive sample. Indicates a negative sample. Represents the Sigmund function. This represents the positive sample interaction score. This represents the negative sample interaction score.

[0145] Furthermore, in step S6, the multi-level contrastive learning loss is calculated, specifically through the following steps:

[0146] Step S614: Based on the final embedded representation of the original user-item interaction graph generated in step S44. and the final embedded representation of the enhanced interaction graph For nodes The embedding representation in the original user-item interaction graph and the embedding representation in the enhanced interaction graph form a positive sample pair; remove nodes from the current training batch. all other nodes of the same type as the node constitute a negative sample set of the node

[0147] Step S615, for the node and the nodes in the negative sample set, calculate norm distance; as shown in formula (12):

[0148] (12);

[0149] wherein denotes the norm distance calculated for the node and the nodes in the negative sample set, denotes the embedding representation of the node in the original user-item interaction graph, denotes the embedding representation of the nodes in the negative sample set in the original user-item interaction graph;

[0150] Step S616, set a dynamic threshold , and retain the negative samples satisfying ;

[0151] Step S617, calculate the user-side and item-side multi-level contrastive learning loss based on the user set and the item set;

[0152] Calculate the user-side multi-level contrastive learning loss, as shown in formula (13):

[0153] (13);

[0154] wherein denotes the calculated user-side multi-level contrastive learning loss, a is the user index, and m is the number of users, denotes the logarithmic function, denotes the exponential function, denotes the temperature coefficient, denotes the embedding representation of the user node in the original user-item interaction graph, denotes the embedding representation of the user node in the enhanced interaction graph, denotes the negative sample set, denotes the cosine similarity function;

[0155] Calculate the item-side multi-level contrastive learning loss, as shown in formula (14):

[0156] (14);

[0157] wherein, denotes the calculated item-side multi-level contrastive loss, b is an item index, and n is the number of items, denotes the embedding representation of the item node on the original user-item interaction graph, denotes the embedding representation of the item node on the enhanced interaction graph;

[0158] Step S618, the total multi-level contrastive learning loss is calculated; as shown in formula (15):

[0159] (15);

[0160] wherein, denotes the total multi-level contrastive learning loss.

[0161] Further, in step S6, the final optimization of the recommendation model is performed, specifically:

[0162] Step S619, the Bayesian personalized ranking loss, the multi-level contrastive learning loss and the adaptive enhancement loss calculated in step S3 are jointly optimized, and the overall training loss is calculated; as shown in formula (16):

[0163] (16);

[0164] wherein, is the overall training loss, denotes the adaptive enhancement loss weight, denotes the Bayesian personalized ranking loss weight;

[0165] Step S620, the overall training loss is optimized by dynamically adjusting the weight in the training stage, and the adaptive view enhancement loss weight An exponential decay strategy is used, the initial value of the adaptive view enhancement loss weight is = 0.3, the decay coefficient is , and the adaptive view enhancement loss weight is gradually reduced as the training proceeds, so that the recommendation model gradually shifts from focusing on view construction to other goals;

[0166] Step S621, the multi-level contrastive learning loss weight is kept at a fixed value = 0.2, and the contrastive learning task maintains a stable contribution throughout the training process. The above process is continuously iterated until the model converges.

[0167] wherein, a recommendation dataset is constructed; and the specific process is as follows: in order to verify the effectiveness and universality of the present application, an experimental environment is constructed based on three publicly available real-world datasets, specifically including:

[0168] Construction of Last.FM Dataset: This dataset is derived from the online music system Last.fm, and the construction process includes collecting the user social network relationships on its platform, the attribute information of users and music artists, and the "listening" interaction records between users and artists. This experiment extracts the effective user-item bipartite graph structure and the corresponding interaction data to simulate the music recommendation scenario.

[0169] Construction of Yelp Dataset: This dataset is derived from the commercial review platform Yelp, and the construction process mainly includes collecting the rating data of users on local business places (such as restaurants, stores). This experiment organizes the data into a user-business item interaction matrix, which is used to build the experimental verification basis for the rating prediction task.

[0170] Construction of BeerAdvocate Dataset: This dataset is collected from the professional beer review website BeerAdvocate, and the construction process involves integrating a large number of comments and corresponding ratings published by users on different beer products. This experiment processes this data into user-beer item interaction records to evaluate the performance of the invention in the fine-grained commodity recommendation scenario.

[0171] Preprocessing and segmentation of the dataset: According to the latest collaborative filtering model method, the dataset is divided into training set, validation set and test set in the ratio of 7:2:1.

[0172] Although embodiments of the present application have been shown and described, it is to be understood that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the present application, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A contrastive learning recommendation method based on adaptive view optimization, characterized in that, Includes the following steps: Step S1: Construct the recommendation dataset and formalize the recommendation dataset task; Step S2: Construct the recommendation model. The recommendation model adopts a serially combined multi-module structure, consisting of an adaptive view enhancement module, a graph message passing encoder module, a view alignment module, and a model optimization module. Step S3: The adaptive view enhancement module generates an enhanced interaction graph from the original user-item interaction graph; it performs differentiable edge sampling on the original user-item interaction graph using a multilayer perceptron and the Kimber-soft maximum method to generate the enhanced interaction graph; it performs cosine similarity constraints on the node features of the original user-item interaction graph and the enhanced interaction graph, and calculates the adaptive enhancement loss. Step S4: Input the original user item interaction graph and the enhanced interaction graph obtained in step S3 into the graph message passing encoder module. Then, through a lightweight multi-layer graph convolutional network, perform neighborhood information propagation and node feature fusion on the original user item interaction graph and the enhanced interaction graph to generate more expressive node representations of the original user item interaction graph and the enhanced interaction graph. Step S5: Based on the original user item interaction graph node representation and the enhanced interaction graph node representation generated in step S4, the view alignment task is performed through the view alignment module. The node representations of the original user item interaction graph and the enhanced interaction graph are fused using an average pooling strategy to output the aligned node feature matrix. Step S6: Perform final optimization of the recommendation model; Based on the recommendation dataset from step S1 and the aligned node feature matrix output from step S5, the Bayesian personalized ranking loss and the multi-level contrastive learning loss are calculated simultaneously. The Bayesian personalized ranking loss, the multi-level contrastive learning loss, and the adaptive enhancement loss calculated in step S3 are jointly optimized, and the process is iterated until the recommendation model converges.

2. The contrastive learning recommendation method based on adaptive view optimization according to claim 1, characterized in that: In step S1, the recommendation dataset task is formalized, specifically as follows: Step S11: Use a graph structure to represent the interaction between the user and the item. This is the original user-item interaction graph, containing a set of nodes. From user set and item collection Composition, the set of edges between nodes If user node With item nodes If there is interaction, then ; Step S12, Construct the adjacency matrix: Define the adjacency matrix for: (1); in, Represents the set of real numbers, adjacency matrix For (m+n) A set of real numbers of dimension (m+n), where m and n represent the number of users and the number of items, respectively. R is the user interaction matrix, with a value of 1 indicating an interaction between two nodes, and T represents the transpose of the matrix; Step S13, for the adjacency matrix Normalization is performed to obtain a symmetric normalized adjacency matrix. .

3. The contrastive learning recommendation method based on adaptive view optimization according to claim 2, characterized in that: In step S3, the adaptive view enhancement module generates an enhanced interaction diagram from the original user-item interaction diagram; specifically: Step S31: For two nodes connected by an edge in the original user-item interaction graph, the node features of the two nodes after linear transformation are concatenated and input into a multilayer perceptron to calculate the original log probability of an edge being preserved or enhanced, as shown in formula (2): (2); in, Represents the edges in view k The original logarithmic odds, i and j represent the user nodes connected by the edge, respectively. and item nodes , and This represents the feature representation of the corresponding node after a linear transformation. It is a multilayer perceptron. For splicing operations; Step S32: Inject the original logarithmic probability obtained in S31 into Kimber random noise, and adjust it with the Sigmoid function and temperature parameter to convert the original logarithmic probability into an approximately binary continuously differentiable edge weight, as shown in formula (3): (3); in, Represented as an edge The calculated differentiable edge weights, and This represents two independent Kimberl random noises. Temperature parameters To control the randomness of the enhancement strategy; Step S33, the symmetric normalized adjacency matrix of step S13 Enhancement is performed to obtain the enhanced interaction graph adjacency matrix. The edge calculated in step S32 is... Calculated differentiable edge weights Assembled edge weight matrix Then, the Hadamard product is calculated using the following formula: (4); in, The calculated adjacency matrix of the enhanced interaction graph, For a symmetric normalized adjacency matrix, In order to accumulate Hadamard, For the edge Calculated differentiable edge weights The assembled edge weight matrix; Step S34: Perform cosine similarity calculations on the node features of the constrained original user item interaction graph and the enhanced interaction graph, and calculate the adaptive enhancement loss. The adaptive enhancement loss is calculated as shown in Equation (5): (5); in, This represents the calculated adaptive augmentation loss, where m and n represent the number of users and items, respectively, and p and q represent the loop indices for iterating through all user-item pairs. and Let represent the joint feature vectors of user and item features in the original user-item interaction graph and the enhanced interaction graph, respectively. Indicates the length of the vector.

4. The contrastive learning recommendation method based on adaptive view optimization according to claim 3, characterized in that: In step S4, the original user-item interaction graph and the enhanced interaction graph obtained in step S3 are input into the graph message passing encoder module. Then, a lightweight, multi-layer graph convolutional network is used to perform neighborhood information propagation and node feature fusion on the original user-item interaction graph and the enhanced interaction graph, respectively. Specifically: Step S41: Initialize the embedding representations for user nodes and item nodes in the recommendation dataset, and use the initial embedding representations as inputs to the graph convolutional networks of the original user-item interaction graph and the enhanced interaction graph. Step S42: Perform local neighborhood information aggregation in the same form on both the original user-item interaction graph and the enhanced interaction graph, as shown in formula (6); wherein the original user-item interaction graph uses the symmetric normalized adjacency matrix obtained after normalization processing in step S13. As input, the enhanced interaction graph uses the adjacency matrix of the enhanced interaction graph from step S33. As input; Local neighborhood aggregation is represented as: (6); in, and These respectively represent aggregation of information from an item's neighborhood to a user, and aggregation of information from a user's neighborhood to an item. Represents a symmetric normalized adjacency matrix The i-th row encodes the user node. Connection strength with all items Represents a symmetric normalized adjacency matrix The j-th column encodes the item node. Connection strength with all users Initialize the embedded representation for the user node. Initialize the embedding representation for item nodes; use it as the user node embedding representation for the 0th layer of the graph convolutional network. and the embedding representation of item nodes at level 0 ; Step S43: The local neighborhood information aggregation result from step S42 is fused with the node embedding of the previous layer of the graph convolutional network through residual connections to update the node embedding of the current layer of the graph convolutional network; the embedding update is shown in formula (7): , (7); in, This represents the graph convolutional network. User node embedding in the layer, Indicates the first Layer user node Information aggregated from domain item nodes This represents the graph convolutional network. User nodes in the layer Embedded representation; This represents the graph convolutional network. Layer item node embedding, Indicates the first Layer Item Node Information aggregated from domain user nodes This represents the graph convolutional network. Layer of item knots Embedded representation; Step S43 involves stacking L layers of convolutional layers to gradually fuse higher-order neighborhood information, performing this process in parallel and completely consistent across the original user-item interaction graph and the enhanced interaction graph. Step S44: Sum the output embeddings of all convolutional layers in the graph convolutional network, including the initial node embedding representation of layer 0, to obtain the final embedding representations of user nodes and item nodes respectively. and The embeddings of all layers in the graph convolutional network are summed to generate the final node embedding representations of the original user-item interaction graph and the enhanced interaction graph, as shown in Equation (8): (8); in, For user nodes The final embedding representation, For item nodes The final embedding representation; L represents the total number of layers in the graph convolutional network. Indicates the index of the current layer. and Represents user node and item nodes In the Layer embedding representation; Step S45: The final embedding representation of the user nodes and the final embedding representation of the item nodes obtained from the original user-item interaction graph constitute the final embedding representation of the original user-item interaction graph. The final embedding representation of the user node and the final embedding representation of the item node obtained on the enhanced interaction graph constitute the final embedding representation of the enhanced interaction graph. .

5. The contrastive learning recommendation method based on adaptive view optimization according to claim 4, characterized in that: Step S5, which involves performing the view alignment task via the view alignment module, specifically involves: The final embedded representation of the original user-item interaction graph generated based on step S45. And the final embedded representation of the enhanced interaction graph For each node, an average pooling strategy is used to average the features of the nodes in both views, resulting in an aligned node feature matrix. The alignment feature of each node in the matrix is ​​calculated as shown in formula (9): (9); in, Represents each calculated node Alignment features, each Forming the aligned node feature matrix , Represent each node In the final embedded representation of the original user-item interaction graph, Represent each node In the final embedded representation of the enhanced interaction graph.

6. The contrastive learning recommendation method based on adaptive view optimization according to claim 5, characterized in that: In step S6, the Bayesian personalized ranking loss is calculated to optimize the main task of the recommendation model; the specific steps are as follows: Step S611: Based on the original interaction data in the recommendation dataset, construct a positive sample for each observed user-item interaction pair, and randomly sample an item from the set of items that have never been interacted with to construct a negative sample, thus forming a training triplet. set Construct training batches; Step S612, based on the aligned node feature matrix The interaction score is predicted by calculating the inner product of user-item pairs based on the user node features and item node features; the interaction score is calculated as shown in formula (10): (10); in, This represents the calculated user item interaction score. Representing the characteristics of each user node, Representing the characteristics of each item node, Indicates transpose; Step S613, for each training triplet in the training batch Calculate the Bayesian personalized ranking loss, as shown in formula (11): (11); in, This represents the Bayesian personalized ranking loss. This represents the training triple set. Indicates a positive sample. Indicates a negative sample. Represents the Sigmund function. This represents the positive sample interaction score. This represents the negative sample interaction score.

7. The contrastive learning recommendation method based on adaptive view optimization according to claim 6, characterized in that: In step S6, the multi-level contrastive learning loss is calculated, and the specific steps are as follows: Step S614: Based on the final embedded representation of the original user-item interaction graph generated in step S44. and the final embedded representation of the enhanced interaction graph For nodes The embedding representation in the original user-item interaction graph and the embedding representation in the enhanced interaction graph form a positive sample pair; remove nodes from the current training batch. All other nodes of the same type constitute a node The negative sample set, nodes of the same type, that is, both users or both items; Step S615, for node nodes in the negative sample set ,calculate Norm distance; as shown in formula (12): (12); in, Represents the calculated nodes nodes in the negative sample set of Norm distance Represents a node In the embedded representation of the original user-item interaction graph, Represents nodes in the negative sample set Embedded representation in the original user-item interaction graph; Step S616: Set dynamic threshold , retain satisfaction Negative samples; Step S617: Calculate the multi-level contrastive learning loss for the user side and the item side based on the user set and the item set; The multi-level contrastive learning loss on the user side is calculated as shown in Equation (13): (13); in, This indicates the calculated multi-level contrastive learning loss on the user side, where 'a' is the user index and 'm' is the number of users. Represents the logarithmic function. Represents an exponential function. Indicates the temperature coefficient. This represents the embedding representation of user nodes in the original user-item interaction graph. This represents the embedding representation of user nodes in the enhanced interaction graph. Represents the set of negative samples. Represents the cosine similarity function; The multi-level contrastive learning loss on the item side is calculated as shown in formula (14): (14); in, This indicates the calculated multi-level comparison loss on the item side, where b is the item index and n is the number of items. This represents the embedding representation of an item node in the original user item interaction graph. This represents the embedded representation of an item node in the enhanced interaction graph. Step S618, calculate the total multi-level contrastive learning loss; as shown in formula (15): (15); in, This represents the total multi-level contrastive learning loss.

8. The contrastive learning recommendation method based on adaptive view optimization according to claim 7, characterized in that: In step S6, the recommendation model undergoes final optimization, specifically as follows: Step S619: Jointly optimize the Bayesian personalized ranking loss, the multi-level contrastive learning loss, and the adaptive enhancement loss calculated in step S3, and calculate the overall training loss; as shown in formula (16): (16); in, As a result of overall training losses, This indicates the adaptive augmentation loss weights. This represents the weights of the Bayesian personalized ranking loss. Step S620: During the training phase, the overall training loss is optimized by dynamically adjusting the weights, and the loss weights are enhanced for adaptive views. Using an exponential decay strategy, the initial values ​​of the adaptive view enhancement loss weights are used. =0.3, attenuation coefficient As training progresses, the weights of the adaptive view enhancement loss are gradually reduced, causing the recommendation model to shift its focus from view construction to other objectives. Step S621, Multi-level contrastive learning loss weights Keep a fixed value =0.2, the contrast learning task maintains a stable contribution throughout the training process, and the above process is iterated until the model converges.

Citation Information

Patent Citations

  • Sequence recommendation uncertainty perception contrast learning method

    CN116108283A

  • Graph contrast learning recommendation method for self-adaptive intention perception enhancement

    CN120723975A