Sequence recommendation method and system based on cooperative attention network and contrastive learning

By employing collaborative attention networks and contrastive learning methods, the system learns the temporal and location embedding features of users and items, dynamically extracts high-order collaborative information, and enhances semantic associations. This solves the problem of dynamic changes in user interests and item attributes in existing sequence recommendation models, and achieves more accurate item recommendations.

CN115982480BActive Publication Date: 2025-12-19SHANDONG NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310113975.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-13
Publication Date
2025-12-19
Estimated Expiration
2043-02-13

AI Technical Summary

Technical Problem

Existing sequence recommendation models fail to effectively capture the dynamic changes in user interests and the dynamic features of item attributes, and do not make full use of the semantic association information between nodes, resulting in inaccurate recommendations.

Method used

By constructing a collaborative attention network and contrastive learning method, the system learns the time and location embedding features of users and items respectively, adaptively learns feature weights, and uses a multi-feature fusion system attention network to extract high-order collaborative information. Combined with a semantically aware contrastive learning objective, the system enhances the semantic association between nodes.

Benefits of technology

It improves the accuracy and recall of sequence recommendations, outputs a more accurate list of recommended items, and enhances the performance of item recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115982480B_ABST
    Figure CN115982480B_ABST
Patent Text Reader

Abstract

The application discloses a sequence recommendation method and system based on a collaborative attention network and contrast learning, and the method comprises the following steps: constructing a time interaction graph, learning initial embedding, time embedding and position embedding of a user node and an item node respectively to obtain unified embedding of the nodes; inputting the unified embedding of the nodes into a collaborative attention network to update the same embedding of the nodes and obtain final node embedding representation of the user and the item; constructing a semantic perception contrast learning target based on the initial embedding of the user and the item; performing inner product operation on the final node embedding representation of the user and the item to generate a predicted score of the user to the item, and outputting a recommended sequence of the item according to the predicted score; and finally, jointly optimizing the contrast learning target and the recommendation target by using a constructed contrast learning loss function and a cross-entropy loss function. The application realizes dynamic extraction of high-order collaborative information of the user and the item, captures diversified preferences of the user, and improves the accuracy of sequence recommendation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of sequence recommendation, and particularly relates to a sequence recommendation method and system based on a collaborative attention network and contrast learning. BACKGROUND

[0002] With the rapid development of the Internet, information overload has become a problem that needs to be solved. A large amount of Internet data is flooding the world, and how to extract valuable information from these massive data has become a very important task, so the recommendation system has emerged. At present, a large number of research works apply the classic collaborative filtering method to the static user-item interaction, and realize recommendation by using the similarity of users and items. However, in real life, the interests of users are not static, but change with time. Therefore, the sequence recommendation task has attracted widespread attention in recent years, which emphasizes capturing the dynamic interests of users according to the time sequence information in the historical interaction sequence, and predicting the next item that the user will interact with.

[0003] Early sequence recommendation models are mostly based on Markov chains and neural network models to model a single sequence of users, and cannot establish high-order associations between sequences, so some excellent sequence recommendation models are proposed, which introduce graph neural networks (GNN) and their extended networks into the sequence recommendation task, and construct user sequences into sequence graphs to mine high-order connectivity between sequences. Among them, GNN provides a unified framework for the recommendation system to model rich data and capture multi-hop relationships in the graph structure, and explicitly encodes key collaborative signals to improve the representation of users and items.

[0004] However, most of the existing GNN-based methods assume that the item attributes are static, but over time, items may also show different external characteristics, such as popularity, theme changes, etc. In addition, the time information and location information of nodes have different effects and meanings for modeling user dynamic interests, so it is necessary to measure the importance of the two features. In addition, some existing methods believe that only the interaction sequence of users can reflect the interests of users, but there is semantic association between nodes, so it is necessary to fully utilize semantic information to refine the diversified preferences of users. SUMMARY

[0005] To solve the above problems of the prior art, the application provides a sequence recommendation method and system based on a collaborative attention network and contrast learning, which learns time and location embedding features of user and item nodes respectively, adaptively learns weights of the two features, and then uses a constructed system attention network with multi-feature fusion to learn time dynamics and sequence patterns of the user and the item, and dynamically extracts high-order collaborative information of the user and the item; meanwhile, the semantic association between nodes is enhanced by expanding the contrast learning target with semantic perception, the diversified preferences of the user are captured, and the accuracy of sequence recommendation is improved.

[0006] In a first aspect, the disclosure provides a sequence recommendation method based on a collaborative attention network and contrast learning.

[0007] A sequence recommendation method based on a collaborative attention network and contrast learning comprises:

[0008] A user-item time sequence interaction graph is constructed according to user historical interaction records, initial embedding, time embedding and location embedding of the user and the item are learned respectively, and then node unified embedding of the user and the item is learned;

[0009] The node unified embedding is input into a multi-feature fusion collaborative attention network to extract high-order collaborative information of the node, and the node unified embedding is updated through multi-layer information propagation iteration to obtain final node embedding representation of the user and the item;

[0010] Based on the initial embedding of the user and the item, a contrast learning target with semantic perception of the user and the item is constructed;

[0011] The final node embedding representation of the user and the item is subjected to inner product operation to generate a predicted score of the user for the item, and a recommended item sequence is output according to the predicted score;

[0012] A contrast learning loss function and a cross-entropy loss function are constructed to jointly optimize the contrast learning target and the recommendation target.

[0013] Further technical solutions, according to the initial embedding, time embedding and location embedding of the user and the item, the obtained various feature embeddings are adaptively fused to learn the node unified embedding of the user and the item, comprising:

[0014] Self-attention mechanisms are respectively performed on the time embedding and the location embedding to learn respective weights of the time embedding and the location embedding;

[0015] The initial embedding, the time embedding and the location embedding of the user and the item are respectively weighted and calculated to obtain the node unified embedding of the user and the item.

[0016] Further technical solutions, the multi-feature fusion collaborative attention network includes a multi-feature fusion self-attention layer, a feedforward neural network and a collaborative attention aggregation network, by stacking L layers of multi-feature fusion collaborative attention network, output the final node embedding representation of user u and item v at time t And

[0017] Further technical solutions, for j neighbor items of user u The node of the j neighbor items is uniformly embedded and input into the multi-feature fusion self-attention layer, and the item representation of the j neighbor items is output by the self-attention mechanism;

[0018] The output item representation is input into the feedforward neural network, and the updated item representation is output;

[0019] The updated j item representations are input into the collaborative attention aggregation network for aggregation to obtain the neighborhood embedding of user u;

[0020] The neighborhood embedding of user u is spliced with the initial embedding and then input into the feedforward neural network to output the updated l-layer node embedding representation of user u

[0021] Further technical solutions, the inner product operation is performed on the final node embedding representation of user u and item v output by the L-layer collaborative attention network, and the predicted score of user u recommending item v at time t is calculated, i.e.

[0022]

[0023] The recommendation target is output according to the predicted score.

[0024] Further technical solutions, the cross-entropy loss function is used to optimize the recommendation target, and the observed positive sample v and unobserved negative sample v' of user y at time point t are used for training, and the loss function is:

[0025]

[0026] Where, λ||Θ|| is the Frobenius norm parameterized on λ.

[0027] Further technical solutions, based on the initial embedding of users and items, a user and item semantic-aware contrastive learning target is constructed, including:

[0028] The K-Means algorithm is used to cluster all user and item nodes, and the nodes in each sub-cluster are semantic neighbors of each other, and the cluster center is a representative of a group of semantic neighbor nodes;

[0029] According to the initial embedding, a contrast learning target is constructed between the user and item nodes and their corresponding cluster centers, and semantic neighbor nodes of the user and item nodes are learned.

[0030] Further technical solutions, the cluster center c x and c z are positive examples, and the cluster centers c i and c j are negative examples, and training is performed to construct user and item contrast learning loss functions, respectively.

[0031] The user contrast learning loss function is:

[0032]

[0033] The item contrast learning loss function is:

[0034]

[0035] Where h u is the initial embedding of the user u, h v is the initial embedding of the item v, and τ is a temperature coefficient representing the degree of differentiation of negative samples.

[0036] In a second aspect, the present disclosure provides a sequence recommendation system based on a collaborative attention network and contrast learning.

[0037] A sequence recommendation system based on a collaborative attention network and contrast learning includes:

[0038] A data acquisition module for acquiring user historical interaction records;

[0039] A data processing module for constructing a user-item time sequence interaction graph based on the user historical interaction records, learning initial embeddings, time embeddings and location embeddings of users and items respectively, and further learning node unified embeddings of users and items;

[0040] A node embedding output module for inputting the node unified embeddings into a multi-feature fusion collaborative attention network to extract high-order collaborative information of the nodes, updating the node unified embeddings through multi-layer information propagation iteration, and obtaining final node embedding representations of the users and items;

[0041] A contrast learning target construction module for constructing a user and item semantic perception contrast learning target based on the initial embeddings of the users and items;

[0042] The prediction module is configured to perform inner product operation on the final node embedding representation of the user and the item to generate a predicted score of the user on the item, and output a recommended item sequence according to the predicted score.

[0043] The optimization module is configured to construct a contrastive learning loss function and a cross-entropy loss function, and jointly optimize the contrastive learning target and the recommendation target.

[0044] In a third aspect, the present disclosure further provides an electronic device, comprising a memory and a processor, and computer instructions stored in the memory and running on the processor, when the computer instructions are run by the processor, the steps of the method of the first aspect are completed.

[0045] In a fourth aspect, the present disclosure further provides a computer readable storage medium for storing computer instructions, when the computer instructions are executed by a processor, the steps of the method of the first aspect are completed.

[0046] The above one or more technical solutions have the following beneficial effects:

[0047] 1. The present application provides a sequence recommendation method and system based on collaborative attention network and contrastive learning, which considers the time, location characteristics and importance of user and item nodes, constructs a unified framework for users and items through collaborative attention network with multi-feature fusion, models time dynamics and sequential patterns, dynamically extracts high-order collaborative information of users and items, and introduces semantic perception contrastive learning to enhance the relevance of nodes and semantic neighbors, capture the diversity of user preferences, and improve the performance of sequence recommendation.

[0048] 2. The present application can obtain higher recall rate on Top-K recommendation task, return more accurate item recommendation list, and has better item recommendation performance. BRIEF DESCRIPTION OF DRAWINGS

[0049] The drawings accompanying the specification of the present application form part of the present application and serve to provide a further understanding of the present application, the illustrative embodiments thereof, and their description are used to explain the present application and do not constitute an improper limitation of the present application.

[0050] Figure 1 A flowchart of the sequence recommendation method based on collaborative attention network and contrastive learning according to the embodiments of the present application is shown in the figure.

[0051] Figure 2 A schematic diagram of the collaborative attention network in the embodiments of the present application is shown in the figure.

[0052] Figure 3 A schematic diagram of the semantic perception contrastive learning method in the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION

[0053] It should be noted that the following detailed description is exemplary in nature and is intended to provide further description of the application. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.

[0054] It is to be understood that the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. It is also to be understood that the term "or" as used herein refers to a non-exclusive "or," unless otherwise indicated. It is further to be understood that all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs unless otherwise specifically defined.

[0055] Embodiment One

[0056] Generally, in the sequence recommendation task, the history interaction sequence of the user over time is modeled to predict the item that the user interacts at the next time point. Due to the connectivity between items, the item sequence can be constructed as a graph structure, and then a deep learning technology such as a graph neural network is applied to learn the high-order relationship between the sequences. In order to solve the problem that the existing sequence recommendation method does not consider the dynamic characteristics of the item attributes and the semantic association information existing in the user interaction sequence nodes, and thus the recommendation is not accurate, the embodiment provides a sequence recommendation method based on collaborative attention network and contrastive learning, which considers the dynamic preferences of users and items over time and attributes, and the different influences of time and location features on analyzing user interests, and designs a multi-feature fusion collaborative attention network to model the time dynamics and sequential patterns of users and items. In addition, considering that the original semantic information of the node has a positive effect on the sequence recommendation task, therefore, the embodiment also introduces a semantic-aware contrastive learning objective to enhance the semantic association between nodes, thereby refining the user interest. The sequence recommendation method based on collaborative attention network and contrastive learning provided by the embodiment includes the following steps:

[0057] Step S1, constructing a user-item time sequence interaction graph according to the user history interaction record, learning the initial embedding, time embedding and location embedding of the user and the item respectively, and then learning the node unified embedding of the user and the item;

[0058] Step S2, inputting the node unified embedding into the multi-feature fusion collaborative attention network, extracting the high-order collaborative information of the node, updating the node unified embedding through multi-layer information propagation iteration, and obtaining the final node embedding representation of the user and the item;

[0059] Step S3, based on the initial embedding of the user and the item, constructing a user and item semantic-aware contrastive learning objective;

[0060] Step S4, inner product operation is performed on the final node embedding of the user and the item to generate a predicted score of the user on the item, and a recommended item sequence is output according to the predicted score;

[0061] Step S5, a contrast learning loss function and a cross-entropy loss function are constructed, and the contrast learning target and the recommendation target are jointly optimized.

[0062] In combination Figure 1 The specific implementation process of the sequence recommendation method based on the collaborative attention network and the semantic perception contrast learning is described in detail in the following.

[0063] In the above step S1, the user-item time sequence interaction graph is constructed according to the user historical interaction record, and the initial embedding, the time embedding and the position embedding of the user and the item are learned respectively, and then the node unified embedding of the user and the item is learned, including:

[0064] Firstly, the user historical interaction record is obtained, and the user-item time sequence interaction graph is constructed according to the user historical interaction record. The user historical interaction record contains user ID, item ID and interaction timestamp. The interaction record of each user is sorted according to the timestamp to obtain the interaction sequence of each user, and all the interaction sequences of the users are constructed into a user-item time sequence interaction graph Wherein and represent the user set and the item set respectively, is defined as an edge set Each edge s u,v,t in it represents an interaction behavior between the user u and the item v at the time point t.

[0065] In the user-item time sequence interaction graph, a fixed size neighborhood is sampled for each user node, and a time point t is selected, and only the latest n item nodes before the time point t are sampled as the neighborhood of the user node, therefore, the first-order neighborhood of the user u can be represented by an ordered set .

[0066] Similarly, in the user-item time sequence interaction graph, a fixed size neighborhood is sampled for each item node, and a time point t is selected, and only the latest n user nodes before the time point t are sampled as the neighborhood of the item node, therefore, the first-order neighborhood set of the item v can be represented as

[0067] Secondly, according to the user-item time sequence interaction graph, the initial embedding matrices of all users and items are constructed respectively and Wherein and respectively represent the number of users and items, d is the embedding dimension. For a user u and an item v, their initial embeddings h u and h v , specifically:

[0068] For time embedding, the representation of the timestamp is obtained by using the time encoding function Φ(t):

[0069]

[0070] where ω1,..., d are learnable parameters.

[0071] Taking user u as an example, the time embedding t u of user u at time point t can be obtained: According to the user neighborhood , the corresponding time embedding of each interaction item is obtained.

[0072] For item v, it is similar.

[0073]

[0074]

[0075] In the above formula, pos represents the relative position index, 2i represents an even number, 2i+1 represents an odd number, and d represents the position embedding dimension.

[0076] Given the user neighborhood or the item neighborhood, the corresponding position embedding p u or p v is calculated according to the position index of user u or item v.

[0077] Finally, according to the initial embedding, time embedding and position embedding of the user node and the item node, the obtained various feature embeddings are adaptively fused to learn the unified embedding of the user node and the item node.

[0078] Taking user u at time point t as an example, for the obtained time embedding t u and position embedding p u , first, self-attention mechanisms are respectively performed on the two kinds of feature embeddings to learn their respective weights μ t and μ p :

[0079] μ t = Softmax(w t ·t u +bt )

[0080] μ p =Softmax(w p ·p u +b p )

[0081] in, and These are trainable parameters.

[0082] Then, the various embedding features of user u are weighted and calculated to obtain the unified node embedding e of user u. u :

[0083] e u =h u +μ t t u +μ p p u

[0084] Similarly, the unified embedding e of the nodes of project v can be calculated using the same method. v .

[0085] In step S2 above, nodes are uniformly embedded into a multi-feature fusion collaborative attention network to extract high-order collaborative information of nodes. After multi-layer information propagation and iteration, the unified node embedding is updated to obtain the final node embedding representation of users and projects.

[0086] like Figure 2 As shown, to better learn the temporal attributes and sequence patterns of users and projects, this embodiment designs a multi-feature fusion collaborative attention network framework to iteratively propagate node information and extends the network to capture higher-order collaborative signals of nodes. The aforementioned multi-feature fusion collaborative attention network includes a multi-feature fusion self-attention layer, a feedforward neural network, and a collaborative attention aggregation network. Taking user u at time t as an example, the information aggregation process of the l-th layer collaborative attention network is described in detail.

[0087] First, a self-attention layer with multi-feature fusion is constructed to learn the node relationships within the sequence. For the l-th layer, given the user u and the neighborhood set... For user u's neighbor items Obtain neighbor projects using the above method. Unified embedding:

[0088]

[0089] Use self-attention to focus on neighboring projects Contextual information, i.e., output items Project representation

[0090]

[0091] wherein, is the attention coefficient of the item in is defined as:

[0092]

[0093]

[0094] wherein, the scale factor is to prevent the inner product value from being too large, especially when the dimension is high.

[0095] Then, the item representation output by the self-attention layer is input into the feedforward neural network FFN to increase nonlinearity, and the updated item representation is output, that is:

[0096]

[0097] wherein, are two trainable parameters, and ReLU is an activation function.

[0098] After that, for the neighborhood of user u the neighbor item information is propagated through the collaborative attention aggregation network to obtain the aggregated representation of the neighborhood . That is, the updated item representation is input into the collaborative attention aggregation network for aggregation to obtain the neighborhood embedding of user u

[0099]

[0100] wherein, the attention weight coefficient is defined as:

[0101]

[0102]

[0103] Finally, the neighborhood embedding of user u is spliced with the initial embedding, and then input into the feedforward neural network FFN to update the l-th layer node embedding representation of user u

[0104]

[0105] Similarly, the l-th layer node embedding representation of item v can be obtained in a similar manner.​

[0106] Further, in order to capture the high-order collaborative information between users and items, the final node embedding representation of the user and the item at time t is output by stacking the L-layer multi-feature fusion collaborative attention network and

[0107] In the embodiment, in order to further improve the performance of the recommendation sequence and further refine the user interest, in step S3, the semantic-aware contrastive learning method is used to explore the semantic neighbor nodes of the nodes, the semantic-aware contrastive learning objective of the user and the item is constructed based on the initial embedding of the user and the item, the contrastive learning objective is optimized, and the semantic neighbor nodes of the nodes are learned to achieve the purpose of enhancing the semantic association between the nodes.

[0108] Specifically, first, the K-Means algorithm (i.e., K-means clustering algorithm) is used to cluster all user and item nodes, respectively. The nodes in each sub-cluster generally have similar semantics, i.e., they are semantic neighbor nodes, and the cluster center point (referred to as cluster center) is a representative of a group of semantic neighbor nodes. Then, according to the initial embedding, the contrastive learning objective is constructed between the user and item nodes and their corresponding cluster centers, and the semantic neighbor nodes of the user and item nodes are learned.

[0109] Further, the contrastive learning objective is optimized to learn the semantic neighbor nodes of the nodes and enhance the semantic association between the nodes. The cluster center c x or c z of the cluster where the user u or the item v is located is taken as the positive example, and the cluster center c i or c j of other clusters is taken as the negative example for training, and the contrastive learning loss function of the user and the item is constructed respectively. The loss functions are as follows:

[0110]

[0111]

[0112] Where τ is the temperature coefficient, representing the discrimination degree to the negative sample.

[0113] The contrastive learning loss functions of the user and the item are weighted and summed to obtain the final contrastive learning loss function :

[0114]

[0115] In step S4, the prediction phase is entered, and the inner product operation is performed on the final node embedding representations of the user u and the item v output by the L-th layer collaborative attention network to calculate the prediction score of the user u recommending the item v at a specific time, such as at time t, that is,

[0116]

[0117] The recommended item sequence is output according to the prediction scores, such as being sorted from high to low according to the prediction scores, and the top K items with the highest prediction scores are output, K being the number of items recommended to the user.

[0118] In step S5, a contrastive learning loss function and a cross-entropy loss function are constructed to jointly optimize the contrastive learning target and the recommendation target. The cross-entropy loss function is used to optimize the recommendation target, and for the observed positive sample v interacted by the user u at time point t, a negative sample v' is sampled for training, and the loss function is:

[0119]

[0120] Where λ||Θ|| is the parameterized Frobenius norm on λ.

[0121] The above contrastive learning loss is supplemented and is used together with the cross-entropy loss as the total training loss, that is,

[0122]

[0123] The sequence recommendation task is jointly optimized based on the total loss function until the total loss is less than a set threshold, and the optimization and training of the sequence recommendation task are completed.

[0124] The sequence recommendation method and system based on the collaborative attention network and the contrastive learning disclosed in the embodiment learn the time and location embedding features of the user and item nodes respectively, adaptively learn the weights of the two features, and then learn the time dynamics and sequential patterns of the user and item by using the trained system attention network with multiple feature fusion, to dynamically extract high-order collaborative information of the user and item. Meanwhile, in the network training process, the semantic association between nodes is enhanced by expanding the contrastive learning target with semantic perception, the diversified preferences of the user are captured, and the accuracy of the sequence recommendation is improved.

[0125] Embodiment Two

[0126] The embodiment provides a sequence recommendation system based on a collaborative attention network and contrastive learning, comprising:

[0127] A data acquisition module is configured to acquire user historical interaction records.

[0128] The data processing module is configured to construct a user-item time sequence interaction graph according to a user historical interaction record, learn initial embedding, time embedding and position embedding of the user and the item respectively, and further learn node uniform embedding of the user and the item.

[0129] The node embedding output module is configured to input the node uniform embedding into the multi-feature fusion collaborative attention network, extract high-order collaborative information of the node, update the node uniform embedding through multi-layer information propagation iteration, and obtain final node embedding representation of the user and the item.

[0130] The contrast learning target construction module is configured to construct a contrast learning target based on the initial embedding of the user and the item.

[0131] The prediction module is configured to perform an inner product operation on the final node embedding representation of the user and the item, generate a predicted score of the user for the item, and output a recommended item sequence according to the predicted score.

[0132] The optimization module is configured to construct a contrast learning loss function and a cross-entropy loss function, and jointly optimize the contrast learning target and a recommendation target.

[0133] Embodiment three

[0134] The embodiment provides an electronic device, including a memory and a processor, and computer instructions stored in the memory and running on the processor, when the computer instructions are run by the processor, the steps in the sequence recommendation method based on the collaborative attention network and the contrast learning are completed.

[0135] Embodiment four

[0136] The embodiment also provides a computer readable storage medium for storing computer instructions, when the computer instructions are executed by the processor, the steps in the sequence recommendation method based on the collaborative attention network and the contrast learning are completed.

[0137] The steps involved in the above embodiments two to four correspond to the method embodiment one, and the specific embodiments can refer to the related description part of the embodiment one. The term "computer readable storage medium" should be understood as including a single medium or multiple media of one or more instruction sets; it should also be understood as including any medium capable of storing, encoding or carrying instruction sets for execution by a processor and causing the processor to perform any method in the present application.

[0138] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computer device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. The present invention is not limited to any particular combination of hardware and software.

[0139] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

[0140] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.

Claims

1. A sequence recommendation method based on a cooperative attention network and contrastive learning, characterized in that, The method comprises the following steps: constructing a user-item time sequence interaction graph according to user historical interaction records, learning initial embeddings, time embeddings and position embeddings of users and items respectively, and then learning node unified embeddings of the users and the items; inputting the node unified embeddings into a multi-feature fusion collaborative attention network to extract high-order collaborative information of the nodes, updating the node unified embeddings through multi-layer information propagation iteration, and obtaining final node embedding representations of the users and the items; constructing a contrastive learning target based on the initial embeddings of the users and the items; performing inner product operation on the final node embedding representations of the users and the items to generate a predicted score of a user for an item, and outputting a recommended item sequence according to the predicted score; constructing a contrastive learning loss function and a cross-entropy loss function, and jointly optimizing the contrastive learning target and the recommendation target; wherein the node unified embeddings of the users and the items are learned by adaptively fusing the obtained multiple feature embeddings according to the initial embeddings, the time embeddings and the position embeddings of the users and the items, and the node unified embeddings comprise the following steps: respectively performing self-attention mechanisms on the time embeddings and the position embeddings to learn respective weights of the time embeddings and the position embeddings; respectively weighting and calculating the initial embeddings, the time embeddings and the position embeddings of the users and the items to obtain the node unified embeddings of the users and the items; The multi-feature fusion cooperative attention network comprises a multi-feature fusion self-attention layer, a feedforward neural network and a cooperative attention aggregation network, and the multi-feature fusion cooperative attention network is stacked a multi-feature fusion cooperative attention network, and outputs the final node embedding representation of the user and the item v at the moment and ; For a user of j a neighbor item , nodes of the j neighbor item are uniformly embedded into an input to a multi-feature fusion self-attention layer, and an item representation of the j neighbor item is output through a self-attention mechanism; inputting the output item representation into a feedforward neural network to output an updated item representation; The updated j project represents input into the co-attention aggregation network to obtain a neighborhood embedding for the user . embedding of a user is concatenated with an initial embedding and input to a feedforward neural network outputs an updated user first layer node embedding representation ​ 2. The sequence recommendation method based on the cooperative attention network and the contrastive learning of claim 1, wherein, The first layer collaborative attention network outputs a user and item final node embedding representation, which is subjected to an inner product operation to calculate the predicted score of the user recommending the item at time , i.e.: ; outputting a recommended target according to the predicted score.

3. The sequence recommendation method based on the cooperative attention network and the contrastive learning of claim 1, wherein, The contrastive learning target based on the semantic perception of the users and the items comprises the following steps: respectively clustering all user and item nodes by using a K-Means algorithm, and regarding the nodes in each sub-cluster as semantic neighbor nodes, and regarding a cluster center as a representative of a group of semantic neighbor nodes; constructing a contrastive learning target between the user and item nodes and the corresponding cluster centers according to the initial embeddings, and learning semantic neighbor nodes of the user and item nodes.

4. The sequence recommendation method based on a co-attention network and contrastive learning according to claim 1, wherein, With users and projects Cluster center of the cluster As a positive example, the cluster centers of other clusters are used. and For negative examples, training is performed, and contrastive learning loss functions for users and projects are constructed separately; The contrastive learning loss function of the user is: ; The contrastive learning loss function of the item is: ; wherein, is the initial embedding for the user , is the initial embedding for the item , is the temperature coefficient indicating the degree of discrimination against negative samples.

5. A sequence recommendation system based on a co-attention network and contrastive learning, characterized in that, The method comprises the following steps: a data acquisition module for acquiring user historical interaction records; a data processing module for constructing a user-item time sequence interaction graph according to user historical interaction records, learning initial embeddings, time embeddings and position embeddings of users and items respectively, and then learning node unified embeddings of the users and the items; a node embedding output module for inputting the node unified embeddings into a multi-feature fusion collaborative attention network to extract high-order collaborative information of the nodes, updating the node unified embeddings through multi-layer information propagation iteration, and obtaining final node embedding representations of the users and the items; a contrastive learning target construction module for constructing a contrastive learning target based on the initial embeddings of the users and the items; a prediction module for performing inner product operation on the final node embedding representations of the users and the items to generate a predicted score of a user for an item, and outputting a recommended item sequence according to the predicted score; an optimization module for constructing a contrastive learning loss function and a cross-entropy loss function, and jointly optimizing the contrastive learning target and the recommendation target.

6. An electronic device, comprising: A computer program product, comprising a memory and a processor, and computer instructions stored on the memory and run on the processor, when the computer instructions are run by the processor, complete the steps of the sequence recommendation method based on the collaborative attention network and the contrastive learning in any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, A computer program product for storing computer instructions, when the computer instructions are executed by a processor, complete the steps of the sequence recommendation method based on the collaborative attention network and the contrastive learning in any one of claims 1-4.