Comparison learning sequence recommendation method and system based on time interval data enhancement
By designing the longest uniform subsequence based on time interval data enhancement in sequence recommendation and using the inductive bias introduced by Fourier transform, the problem of reduced user modeling stability and unused user information sharing in the prior art is solved, and more accurate and consistent user preference capture and recommendation results are achieved.
Patent Information
- Application Number
- CN202411600933.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-04
AI Technical Summary
The prior art ignores potential information sharing among users in sequence recommendation, resulting in a decrease in user modeling stability. The data enhancement method mainly focuses on the behavior sequence of individual users and fails to fully utilize similarities between users or information in social relationship networks.
A method and system for recommending a comparison learning sequence based on time interval data enhancement is proposed. By designing the longest uniform sub-sequence from single-user and cross-user user behavior sequences, the representativeness of the user behavior sequence is enhanced from a global and local perspective, and the inductive bias introduced by Fourier transform is used to enhance the inductive ability of the comparison learning sequence recommendation model.
By enhancing the representativeness of user behavior sequences and the induction ability of the model, the capture accuracy of user preferences is improved, the accuracy and consistency of recommendation results are enhanced, and the short-term needs of users can be better understood and predicted.
Smart Images

Figure CN119557784A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of sequence recommendation, and in particular relates to a contrastive learning sequence recommendation method and system based on time interval data enhancement. Background Art
[0002] Recommendation systems are an effective way to enhance user interactivity, increase sales, and enhance user experience for enterprises, such as e-commerce platforms, medical services, social behavior analysis, and travel-related applications. Sequential recommendation focuses on the temporal order of user behavior and the time series characteristics of user behavior. By capturing the user's behavior patterns over a period of time, it infers their future preferences and predicts what the user may be interested in next.
[0003] In recent years, the Transformer recommendation model with contrastive learning has been widely used in video platforms and shopping platforms. As a typical example of self-supervised learning, contrastive learning has a strong performance in generating high-quality embedding representations from unlabeled data by maximizing the consistency between positive samples and distinguishing negative samples from positive samples. For example, positive samples are constructed from the original sequence through data augmentation to perform contrastive learning. Positive samples are also constructed through unsupervised elimination and supervised positive sampling. These data augmentation methods for contrastive learning can enhance the resolution of sequence encoders and improve robustness and noise resistance. In order to solve the problem of reduced user modeling stability caused by significant changes in the time interval between historical interactions and current interactions, the sequence data is also augmented from the perspective of time interval, considering the uniformity of the overall sequence, and inserting a new item between two adjacent behaviors, so that the entire sequence is more uniform. However, local dynamic changes in user behavior may have an impact on it, especially when users frequently purchase goods of the same category in a short period of time.
[0004] In summary, most existing data augmentation methods focus on the behavior sequences of individual users, while ignoring the potential information sharing between users. The large amount of valuable information contained in the similarities between users or social relationship networks has not been fully utilized. Summary of the invention
[0005] Based on the problems existing in the prior art, this application proposes a contrastive learning sequence recommendation method and system based on time interval data enhancement, which designs the longest uniform subsequence from the user behavior sequence of a single user and the user behavior sequence across users, respectively, so as to enhance the representativeness of the user behavior sequence from both a global and a local perspective, and better reflect the actual behavior pattern of the user; enhance the validity of the data, and improve the accuracy of the model in capturing user preferences; the present invention also adopts a mechanism beyond self-attention; the mechanism beyond self-attention uses Fourier transform to balance the inductive bias and the self-attention mechanism. By using the inductive bias introduced by Fourier transform, the contrastive learning sequence recommendation model can perceive frequency information, thereby capturing the basic patterns and periodicity that may be ignored by a single self-attention mechanism, and enhancing the inductive ability of the contrastive learning sequence recommendation model.
[0006] In a first aspect of the present application, the present application proposes a contrastive learning sequence recommendation method based on time interval data enhancement, the method comprising:
[0007] Acquire original sequence recommendation data, where the original sequence recommendation data is a user behavior sequence of multiple users; the user behavior sequence is interaction items between users and items arranged in chronological order;
[0008] Divide each user behavior sequence into multiple subsequences, and determine the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence;
[0009] Replace and insert the longest uniform subsequence in each user behavior sequence to obtain enhanced sequence recommendation data;
[0010] Replace the longest uniform subsequence in different user behavior sequences to obtain enhanced sequence recommendation data;
[0011] The enhanced sequence recommendation data is used for enhanced training of the comparative learning sequence recommendation model.
[0012] In a second aspect of the present application, the present invention further proposes a contrastive learning sequence recommendation system based on time interval data enhancement, comprising:
[0013] A data collection module is used to obtain original sequence recommendation data, where the original sequence recommendation data is a user behavior sequence of multiple users; the user behavior sequence is an interaction item between users and items arranged in chronological order;
[0014] A data processing module is used to divide each user behavior sequence into multiple subsequences, and determine the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence;
[0015] The data enhancement module is used to replace and insert the longest uniform subsequence in each user behavior sequence to obtain enhanced sequence recommendation data; replace the longest uniform subsequence in different user behavior sequences to obtain enhanced sequence recommendation data;
[0016] The data recommendation module uses the enhanced sequence recommendation data for enhanced training of a comparative learning sequence recommendation system.
[0017] Beneficial effects of this application:
[0018] The present application proposes a contrastive learning sequence recommendation method and system based on time interval data enhancement. It considers the uniformity of both global and local sequences. By inserting new items between related items, the time difference of local sequences can be reduced, which helps to better capture the user's short-term interest changes. The longest subsequence is selected to ensure that it has sufficient similarity with the global sequence. The inserted items are also more similar to the surrounding items, so that the consistency and coherence of the recommendations can be maintained. This further ensures the accuracy of the contrastive learning sequence recommendation model. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a flow chart of a comparative learning sequence recommendation method based on time interval data enhancement according to an embodiment of the present invention;
[0020] Figure 2 It is a schematic diagram of user behavior sequence in the prior art;
[0021] Figure 3 is a flow chart of a method for determining the longest uniform subsequence according to an embodiment of the present invention;
[0022] Figure 4 is a schematic diagram of a user behavior sequence according to an embodiment of the present invention;
[0023] Figure 5 is a flow chart of another method for determining the longest uniform subsequence according to an embodiment of the present invention;
[0024] Figure 6 is another schematic diagram of a user behavior sequence according to an embodiment of the present invention;
[0025] Figure 7 is a schematic diagram of the structure of a comparative learning recommendation model according to an embodiment of the present invention;
[0026] Figure 8 It is a structural diagram of a contrastive learning sequence recommendation system based on time interval data enhancement according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] In order to better understand the embodiments of the present application, some nouns or terms that appear in the description of the embodiments of the present application are first translated and explained as follows:
[0029] Sequential Recommendation (SR): Sequential recommendation can effectively predict users' future interests or behaviors, and is widely used in many Internet fields such as e-commerce and social media. Previous studies have shown that there are differences in the time intervals between user behavior sequences, which may lead to the phenomenon of preference drift. Further research shows that the accuracy of sequential recommendation with uniform time interval distribution of user behavior sequences is better than that of non-uniform sequential recommendation.
[0030] Contrastive Learning Sequential Recommendation Model: Contrastive Learning, as an unsupervised or semi-supervised learning method, has received widespread attention in the field of machine learning in recent years. The core idea of contrastive learning is to learn representations by comparing the similarities and differences between samples. In the sequential recommendation model, contrastive learning can help capture long-term dependencies in user behavior sequences and distinguish between positive samples (e.g., products that users actually clicked) and negative samples (e.g., products that users did not click), thereby improving the performance of the recommendation system. In the sequential recommendation scenario, contrastive learning can help the model better understand the user's historical behavior patterns, thereby more accurately predicting the products that the user may be interested in in the future.
[0031] Time interval data augmentation: Time interval data augmentation is a data augmentation technique for time series data, which aims to increase the diversity and robustness of the data set by adjusting the time intervals between data points in the time series. For example, Xie X, Sun F, Liu Z, et al. Contrastive learning for sequential recommendation[C] / / 2022IEEE 38th international conference on data engineering(ICDE).IEEE, 2022:1259-1273. The public CL4Srec and Liu Z, Chen Y, Li J, et al. Contrastive self-supervised sequential recommendation with robust augmentation.arXiv 2021[J].arXiv preprint arXiv:2108.06479, 2021. The public CoSeRec constructs positive samples from the original sequence through data augmentation, thereby performing contrastive learning. Qiu R, Huang Z, Yin H, et al. Contrastive learning for representation degeneration problem in sequential recommendation [C] / / Proceedings of the fifteenth ACM international conference on web search and data mining. 2022: 813-823. The public DuoRec constructs positive samples through unsupervised elimination and supervised forward sampling. This contrastive learning enhancement method can enhance the resolution ability of the sequence encoder and improve its robustness and noise resistance.In the time-aware data augmentation method Dang Y, Yang E, Guo G, et al. Uniform sequence better: Time interval aware data augmentation for sequential recommendation [C] / / Proceedings of the AAAI conference on artificial intelligence. 2023, 37 (4): 4225-4232. In the publicly disclosed TiCoSeRec, it was found that the time interval between historical interactions and current interactions in the sequence may vary significantly, resulting in reduced stability of user modeling, so they augmented the sequence data from the perspective of time interval.
[0032] Since most existing data augmentation methods focus on the behavior sequences of individual users and ignore the potential information sharing between users, the large amount of valuable information contained in the similarities between users or social relationship networks has not been fully utilized.
[0033] In order to solve the above technical problems, the embodiments of the present application provide a comparative learning sequence recommendation method and system based on time interval data enhancement, which is based on the longest uniform subsequence, for the user behavior sequence of a single user and the user behavior sequence across users, so as to enhance the representativeness of the user behavior sequence from both a global and a local perspective, and better reflect the actual behavior pattern of the user; enhance the validity of the data, and improve the accuracy of the model in capturing user preferences; and thereby optimize the comparative learning sequence recommendation model, so that the recommendation results of the comparative learning sequence recommendation model are more accurate.
[0034] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0035] Figure 1 is a flow chart of a comparative learning sequence recommendation method based on time interval data enhancement according to an embodiment of the present invention; Figure 1 As shown, the method includes:
[0036] 101. Obtain original sequence recommendation data, where the original sequence recommendation data is a user behavior sequence of multiple users; the user behavior sequence is interaction items between users and items arranged in chronological order;
[0037] In an embodiment of the present invention, original sequence recommendation data of a target user is obtained, wherein the original sequence recommendation data includes: target user information, target item information, and a sequence data set of interaction behaviors of the target user with respect to the items at each time step.
[0038] Specifically, the user behavior sequences of multiple users can be obtained by accessing the database. For example, the browsing history of user A on the e-commerce platform and the chronological order of occurrence are obtained by accessing the database, wherein user A's historical behavior sequentially shows a variety of different interactive behaviors such as "browse", "search", and "purchase", and the items of interaction include: "facial cleanser", "earphones", "charger" and other items. For another example, the browsing history of user B on the e-commerce platform and the chronological order of occurrence are obtained by accessing the database, wherein user B's historical behavior sequentially shows a variety of different interactive behaviors such as "browse", "search", and "purchase", and the items of interaction include: "hand cream", "facial cleanser", "moisturizing lotion" and other items.
[0039] Most existing data augmentation methods focus on the behavior sequences of individual users, while ignoring the potential information sharing between users. The large amount of valuable information contained in the similarities between users or social relationship networks has not been fully utilized. By mining the potential connections between users, not only can the personalization of the recommendation system be enhanced, but it can also help the model better understand group behavior patterns, thereby improving the quality and diversity of recommendations.
[0040] For example, a user buys a lip mask in autumn due to dry weather, and buys multiple sunscreen products in summer. Traditional techniques would try to insert a product item between autumn and summer to make the entire sequence look more uniform. However, this insertion method does not truly reflect the user's behavior pattern, because the user's behavior of buying sunscreen products in summer is continuous and closely related.
[0041] Figure 2 This shows an example of a gap in the types of items purchased in different seasons, where s represents the time standard deviation, d represents the unit time interval, and the user behavior sequence is the interaction item between users and items arranged in chronological order. The chronological order here can be the same or different time intervals. For example, the time interval between item v1 and item v2 is 10d, and the time interval between item v2 and item v3 is d, indicating that the time order of item v1 and item v2 is far apart, and the time order of item v2 and item v3 is close. When the subsequence is not inserted, the original user behavior sequence [v1, v2, v3, v4, v5], the first subsequence [v i ] and the second subsequence [v' i] are denoted as s, s1, and s2 respectively. When inserted in the first subsequence, the time standard deviations of the local sequence and the whole sequence are s1′ and s1″ respectively. When inserted in the second subsequence, the time standard deviations of the local sequence and the whole sequence are s2′ and s2″ respectively.
[0042] Based on the above problems, the embodiment of the present invention proposes a simple and effective data enhancement strategy. It considers the uniformity of both global and local sequences. By inserting new items between related items, the time difference of local sequences can be ensured to be reduced, which helps to better capture the changes in users' interests in the short term. The longest subsequence is selected to ensure that it has sufficient similarity with the global sequence. The inserted item should be more similar to the surrounding items, so that the consistency and coherence of the recommendation can be maintained. For example, inserting another sunscreen product into the subsequence of buying sunscreen products in summer can better reflect the actual needs of users than inserting other unrelated products. In addition, the embodiment of the present invention mines the relationship between users by finding subsequences with three identical items between users, and selects the most uniform sequence for exchange, constructs a pseudo-item-user interaction sequence, and significantly enhances the interaction density. The embodiment of the present invention not only considers the overall trend of user behavior, but also pays attention to the specific interests shown by users in a short period of time, so that users' short-term needs can be better understood and predicted.
[0043] 102. Divide each user behavior sequence into multiple subsequences, and determine the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence;
[0044] In the embodiment of the present invention, Figure 3 As shown, the method of dividing each user behavior sequence into multiple subsequences and determining the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence includes:
[0045] 201. Divide each user behavior sequence into a plurality of subsequences according to a preset division length;
[0046] 202. Determine the target position for inserting each subsequence according to the average time of each subsequence and the interval time of adjacent items at both ends;
[0047] 203. Insert a new item that the user has not interacted with but is associated with an existing item in the user behavior sequence into a target position in each subsequence to obtain an amplified subsequence;
[0048] 204. Insert a new item that the user has not interacted with but is associated with an existing item in the user behavior sequence into a target position in each subsequence to obtain an amplified subsequence;
[0049] When the standard deviations of multiple amplicon sequences are all the smallest, the amplicon sequence with the largest length is selected as the longest uniform subsequence of the current user behavior sequence.
[0050] like Figure 4 As shown in , if the time differences between adjacent items in the sequence are close or equal, then the sequence can be considered uniform. The smaller the overall time standard deviation of the sequence, the more uniform the sequence is, indicating that user behavior presents a more regular pattern during this time period. Figure 4 (a), is a uniform sequence, is a non-uniform sequence. Figure 4 In (b), the commonly used prior art 1, namely the Insert method, only randomly selects a position in a given sequence to insert a new item. This method adds a new item at any position in the sequence, which may cause the uniformity of the sequence to decrease, especially when the original sequence already has a certain uniformity. Figure 4 In (c), the prior art 2, i.e., Ti-Insert, is an insertion method based on the overall uniformity of the sequence. Ti-Insert will select the insertion position and insert it in the sequence to make the sequence more uniform as a whole. After inserting similar items, the overall time standard deviation of the sequence is minimized. However, this method does not consider that a large time interval will produce seasonal changes, leading to changes in user needs. Figure 4 In (d), the present application considers both the uniformity of the entire sequence and focuses on the uniformity of the local sequence, so that the longest uniform subsequence can be expanded and the problems caused by the large insertion time interval can be avoided.
[0051] Specifically, this embodiment analyzes the user behavior sequence Slice, divide into multiple segments of length greater than 2, these segments can be used as possible subsequences, and calculate the time interval between elements in these subsequences. The position with the closest average time interval between the adjacent items at both ends and the subsequence is taken as the target position. The target position can be formulated as:
[0052]
[0053] Among them, k u represents the target position; d(·) represents the calculation time difference, and μ represents the subsequence The average time, Display items timestamp, Display items timestamp, represents the i-1th interaction term between user u and item, represents the jth interaction item between the user and the item, i refers to the subsequence The leftmost position of j refers to the subsequence The rightmost position.
[0054] For example, in Figure 4 (d) Neutron sequence The time difference with the left adjacent element v1 is 4d, The time difference with the adjacent element v7 on the right is 3d. The right end v7 is closer to the subsequence than the left end v1. The right end of the subsequence is selected as the target position, so that the subsequence can be expanded into a more uniform and longer subsequence. Each target position inserts a new item that the user has not interacted with but is related to the existing items in the sequence.
[0055] In other embodiments of the present invention, Figure 5 As shown, the method of dividing each user behavior sequence into multiple subsequences and determining the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence includes:
[0056] 211. Determine a first user behavior sequence and a second user behavior sequence having the same anchor point according to the relationship between the interaction items between the user and the item; the anchor points are three interaction items between the user and the item;
[0057] 212. Determine the starting point, the middle point, and the ending point of the first user behavior sequence and the second user behavior sequence respectively according to the same anchor points of the first user behavior sequence and the second user behavior sequence;
[0058] 213. Divide the first user behavior sequence and the second user behavior sequence into a left subsequence, a to-be-replaced subsequence, and a right subsequence according to the starting point, the middle point, and the ending point;
[0059] 214. If the ratio of the length of the subsequence to be replaced in the second user behavior sequence to the length of the first user behavior sequence exceeds a preset length threshold, use the subsequence to be replaced in the second user behavior sequence as a replacement subsequence;
[0060] 215. According to the standard deviation of each replacement subsequence in the second user behavior sequence, select a replacement subsequence with the smallest standard deviation and the largest length as the longest uniform subsequence of the first user behavior sequence.
[0061] In the embodiment of the present invention, the subsequence to be replaced in the first user behavior sequence and the subsequence to be replaced in the second user behavior sequence have at least three identical items.
[0062] In this embodiment of the present invention, the calculation formula of the amplicon sequence with the smallest standard deviation and the largest length is expressed as:
[0063]
[0064] in, Indicates the amplicon sequence with the smallest standard deviation and the largest length, which is also the second user behavior sequence Satisfaction and first user behavior sequence Interchangeable subsequence, Std means to find the standard deviation; Represents the second user behavior sequence A collection of connected time interval sequences, represents the optimal amplicon sequence selected, Represents the amplicon sequence selected by the cycling process.
[0065] 103. Insert the longest uniform subsequence into each user behavior sequence to obtain enhanced sequence recommendation data;
[0066] In the embodiment of the present invention, the standard deviations of different amplicon sequences are compared, and the subsequence with the smallest standard deviation and the largest length is selected as the optimal subsequence. The subsequence obtained in this way not only has the largest amount of information and similarity with the overall sequence, but also maintains a high uniformity. The operation is expressed by the formula:
[0067]
[0068] Among them, p represents the amplicon sequence with the smallest standard deviation and the largest length, Represents user behavior sequence subsequence of , σ u Represents a subsequence time standard deviation, SortBy(·) indicates sorting according to multiple conditions, wherein the multiple conditions include the standard deviation of the amplicon sequence and the length of the amplicon sequence.
[0069] For the same user behavior sequence, replace and insert the longest uniform subsequence, and the enhanced sequence recommendation data is obtained as follows:
[0070]
[0071] For example, suppose the user behavior sequence is [v1,v2,v3,v4], and the subsequences are [v1,v2], [v1,v2,v3], [v2,v3], [v2,v3,v4], [v3,v4]; by calculating the standard deviation and the subsequence length, it is determined that a new item is inserted to the left of the subsequence [v1,v2,v3]. Then the longest uniform subsequence is [v i ,v2,v3,v4]; after replacing and inserting the longest uniform subsequence in the original user behavior sequence [v1,v2,v3,v4], [v i ,v2,v3,v4], the enhanced sequence recommendation data can be expressed as [v i,v1,v2,v3,v4].
[0072] 104. Replace the longest uniform subsequence in different user behavior sequences to obtain enhanced sequence recommendation data;
[0073] Traditional data augmentation methods mostly use the project relationships of the same user to increase the diversity of item-item transformations. Although data transformation within a user can provide a certain degree of variability, this method is often limited by the limitations of user data, resulting in low data density and inability to obtain additional information from other users' data.
[0074] This embodiment uses the data relationship of user behavior sequences across users to break this limitation. By integrating the commonalities or similar patterns between different users, it can not only improve the breadth and depth of the data set, but also improve the generalization ability of the model and enhance its robustness.
[0075] Figure 6 It is the subsequence replacement between different user behavior sequences. Light colors represent the unselected parts of the original sequence, while dark colors highlight the subsequence area selected for replacement. Nodes of the same color represent the same items, except for the lightest shade. The original user behavior sequence A can be divided into three parts: Represents all items on the left side of the subsequence to be replaced, represents the subsequence to be replaced, Represents all items on the right side of the subsequence to be replaced.
[0076] In this embodiment, the data information of other user behavior sequences is used to replace the subsequences of the user behavior sequence A. For the interaction item sequences of two users a and b, the first user behavior sequence is and the second user behavior sequence sequence and There are two pairs of anchor items and The corresponding time interval sequences are and This embodiment uses three specific points as anchor points to define two subsequences. The anchor points will help the embodiment of the present invention identify the sequence and The starting point, middle point and end point of the neutron sequence, then the sequence and It can be expressed as:
[0077]
[0078] Among them, | represents sequence connection; the subsequences are and if and Then the sequence and Have certain similarities.
[0079] The embodiment of the present invention selects the sequence and When selecting subsequences, it is required to contain at least three identical items instead of two. More common elements help improve the accuracy and reliability of subsequence matching and ensure that the selected subsequences are more closely related.
[0080] In the preferred embodiment of the present invention, a shorter sequence is not sufficient to provide sufficient information density to ensure the matching quality. The embodiment of the present invention sets a length ratio threshold ζ, a confidence Regulation subsequence of Length occupies The ratio of sequence lengths. When L ≥ ζ, interchangeability is established. In the experiment of the embodiment of the present invention, ζ is set to 0.3.
[0081] Figure 6 User behavior sequence A and user behavior sequence B and their processed subsequences are shown. Figure 6 (a) and Figure 6 (b) Different parts of the original user behavior sequences A and B are marked, including non-uniform subsequences and uniform subsequences. Figure 6 (c) and Figure 6 (d) indicates that among all subsequences that meet the above conditions, the embodiment of the present invention selects the most uniform subsequence for replacement operation to ensure the representativeness of the subsequence in the entire sequence and the robustness of the matching. The operation is expressed by the formula:
[0082]
[0083] in Representation sequence Satisfaction and sequence The set of interchangeable subsequences, Represents a set of time interval sequences associated with it. By exchanging pseudo user sequences with interchangeability, the embodiment of the present invention generates a new pseudo user sequence, as shown below:
[0084]
[0085] The enhanced sequence recommendation data is used for enhanced training of a comparative learning sequence recommendation system.
[0086] Since the contrastive learning sequence recommendation model itself is not the focus of the present invention, the present invention does not make specific limitations on this, and the common Transformer model can be used. Contrastive learning is a self-supervised learning method that learns the representation of data by comparing the similarities between different samples. In the Transformer model, contrastive learning is used to further enhance the representation ability of users and items; in the contrastive learning process, a positive sample pair (i.e., similar user-item pairs) and a negative sample pair (i.e., dissimilar user-item pairs) are usually constructed. Then, the model learns a representation space so that the distance between positive sample pairs in the representation space is as close as possible, while the distance between negative sample pairs in the representation space is as far as possible. In this way, the model can learn the potential relationship between users and items, and recommend items that may be of interest to users.
[0087] For ease of demonstration, in the embodiment of the present invention, the contrastive learning sequence recommendation model optimizes the encoder by maximizing the consistency between two enhanced versions (called "positive sample pairs") from the same sequence; specifically, given a batch of N sequences In the embodiment of the present invention, each sequence Sample two enhancement operations to obtain 2N enhanced sequences in is from the same interaction sequence For each user is considered as a positive sample, while the remaining 2(N-1) enhanced samples in the same batch are considered as negative samples. The enhanced sequence is encoded by the encoder f(·). Figure 7 For each sequence in (b) They are represented as and The data enhancement method provided in the embodiment of the present invention is used to enhance the sequence into two views, and the sequence is encoded by connecting the embedding outputs. Finally, it maximizes the consistency between the two views.
[0088] In some preferred embodiments of the present invention, in order to further improve the performance of the contrastive learning sequence recommendation model, this embodiment introduces a frequency-adjustable inductive bias mechanism in the Transformer model. To go beyond the self-attention layer (Beyond Self-Attention, BSA), is the rescaling filter matrix of the lth layer, T l is the input of the lth layer. When l=0, T 0 =E u The BSA layer is defined as follows:
[0089]
[0090] The first term corresponds to the discrete Fourier transform (DSP), and λ≤1 is a coefficient used to adjust the strength of the inductive bias. Multi-head self-attention (MSA) is defined as:
[0091]
[0092] Where h is the number of heads, is a learnable parameter.
[0093] From the perspective of self-attention, the inductive bias indicates that the purchased item is influenced by its previous item. The embodiment of the present invention introduces a frequency-adjustable filter. Figure 7 (a) Introduces the attention inductive bias and adjusts the frequency scale by decomposing the high-frequency and low-frequency components. The embodiment of the present invention not only utilizes the inductive bias, but also extracts its high- and low-frequency information:
[0094]
[0095] Where μ is a trainable parameter for scaling the high-pass filter. Specifically, μ can be a D-dimensional vector or scalar. LFC(·) represents a low-frequency component extractor, which mainly captures relatively stable features in the entire sequence. These features are not affected by local changes, thereby helping the model capture global information. HFC(·) represents a high-frequency component extractor, which extracts signals of local fluctuations from the input sequence, meaning that it pays more attention to features that change frequently in the local range. By selectively utilizing this high-frequency information, the model can better capture local details, thereby avoiding the problem of over-smoothing. By combining LFC and HFC, it is possible to capture global features while retaining local details, thereby achieving a more comprehensive understanding of sequence data.
[0096] In the embodiment of the present invention, Figure 8 As shown, the embodiment of the present invention also proposes a contrastive learning sequence recommendation system 500 based on time interval data enhancement, including:
[0097] The data collection module 501 is used to obtain original sequence recommendation data, where the original sequence recommendation data is a user behavior sequence of multiple users; the user behavior sequence is an interaction item between users and items arranged in chronological order;
[0098] The data processing module 502 is used to divide each user behavior sequence into multiple subsequences, and determine the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence;
[0099] The data enhancement module 503 is used to replace and insert the longest uniform subsequence in each user behavior sequence to obtain enhanced sequence recommendation data; replace the longest uniform subsequence in different user behavior sequences to obtain enhanced sequence recommendation data;
[0100] The data recommendation module 504 uses the enhanced sequence recommendation data for enhanced training of a comparative learning sequence recommendation system.
[0101] The comparative learning sequence recommendation method provided in the embodiment of the present application can be implemented using a comparative learning sequence recommendation model built using a deep learning algorithm such as a Transformer model. Before applying the comparative learning sequence recommendation model to the comparative learning sequence recommendation system, it is necessary to use a large amount of sample data and sequence recommendation data enhanced by the present invention to train the comparative learning sequence recommendation model, so that the comparative learning sequence recommendation model can effectively fit the sample data distribution. In this way, when the trained comparative learning sequence recommendation model is deployed on a terminal device or server, an online recommendation service is performed.
[0102] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A contrastive learning sequence recommendation method based on time interval data enhancement, characterized in that: The method comprises: Acquire original sequence recommendation data, where the original sequence recommendation data is a user behavior sequence of multiple users; the user behavior sequence is interaction items between users and items arranged in chronological order; Divide each user behavior sequence into multiple subsequences, and determine the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence; Replace and insert the longest uniform subsequence in each user behavior sequence to obtain enhanced sequence recommendation data; Replace the longest uniform subsequence in different user behavior sequences to obtain enhanced sequence recommendation data; The enhanced sequence recommendation data is used for enhanced training of the comparative learning sequence recommendation model.
2. The contrastive learning sequence recommendation method based on time interval data enhancement according to claim 1 is characterized in that: The step of dividing each user behavior sequence into a plurality of subsequences and determining the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence comprises: Divide each user behavior sequence into several subsequences according to the preset division length; According to the average time of each subsequence and the interval time of the adjacent items at both ends, the target position to be inserted of each subsequence is determined; Insert a new item that the user has not interacted with but is associated with an existing item in the user behavior sequence into the target position in each subsequence to obtain an amplified subsequence; According to the standard deviation of each amplicon sequence, the amplicon sequence with the smallest standard deviation and the largest length is selected as the longest uniform subsequence of the current user behavior sequence; When the standard deviations of multiple amplicon sequences are all the smallest, the amplicon sequence with the largest length is selected as the longest uniform subsequence of the current user behavior sequence.
3. The contrastive learning sequence recommendation method based on time interval data enhancement according to claim 2 is characterized in that: The determination formula of the target position is expressed as: Among them, k u represents the target position; d(·) represents the calculation time difference, and μ represents the subsequence The average time, Display items timestamp, Display items timestamp, represents the i-1th interaction term between user u and item, represents the jth interaction item between user u and item, i refers to the subsequence The leftmost position of j refers to the subsequence The rightmost position.
4. The contrastive learning sequence recommendation method based on time interval data enhancement according to claim 3 is characterized in that: The calculation formula of the amplicon sequence with the smallest standard deviation and the largest length is expressed as: Among them, p represents the amplicon sequence with the smallest standard deviation and the largest length, Represents user behavior sequence subsequence of , σ u Represents a subsequence time standard deviation, SortBy(·) indicates sorting according to multiple conditions, wherein the multiple conditions include the standard deviation of the amplicon sequence and the length of the amplicon sequence.
5. The contrastive learning sequence recommendation method based on time interval data enhancement according to claim 1, characterized in that: The step of dividing each user behavior sequence into a plurality of subsequences and determining the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence comprises: Determining a first user behavior sequence and a second user behavior sequence having the same anchor point according to the relationship between the interaction items between the user and the item; the anchor points are three interaction items between the user and the item; According to the same anchor points of the first user behavior sequence and the second user behavior sequence, respectively determine the starting point, the middle point and the ending point of the first user behavior sequence and the second user behavior sequence; Divide the first user behavior sequence and the second user behavior sequence into a left subsequence, a subsequence to be replaced, and a right subsequence according to the starting point, the middle point, and the ending point; If the ratio of the length of the subsequence to be replaced in the second user behavior sequence to the length of the first user behavior sequence exceeds a preset length threshold, the subsequence to be replaced in the second user behavior sequence is used as the replacement subsequence; According to the standard deviation of each replacement subsequence in the second user behavior sequence, a replacement subsequence with the smallest standard deviation and the largest length is selected as the longest uniform subsequence of the first user behavior sequence.
6. The contrastive learning sequence recommendation method based on time interval data enhancement according to claim 5 is characterized in that: The to-be-replaced subsequence in the first user behavior sequence and the to-be-replaced subsequence in the second user behavior sequence have at least three identical items.
7. The contrastive learning sequence recommendation method based on time interval data enhancement according to claim 6 is characterized in that: The calculation formula of the amplicon sequence with the smallest standard deviation and the largest length is expressed as: in, Indicates the amplicon sequence with the smallest standard deviation and the largest length, which is also the second user behavior sequence Satisfaction and first user behavior sequence Interchangeable subsequence, Std means to find the standard deviation; Represents the second user behavior sequence A collection of connected time interval sequences, represents the optimal amplicon sequence selected, Represents the amplicon sequence selected by the cycling process.
8. The contrastive learning sequence recommendation method based on time interval data enhancement according to claim 1, characterized in that: The contrastive learning sequence recommendation system adopts a mechanism beyond self-attention; the mechanism beyond self-attention adopts Fourier transform to balance the inductive bias and the self-attention mechanism.
9. A contrastive learning sequence recommendation system based on time interval data enhancement, characterized in that: include: A data collection module is used to obtain original sequence recommendation data, where the original sequence recommendation data is a user behavior sequence of multiple users; The user behavior sequence is the interaction items between users and items arranged in chronological order; A data processing module is used to divide each user behavior sequence into multiple subsequences, and determine the longest uniform subsequence according to the time standard deviation and sequence length of each subsequence; The data enhancement module is used to replace and insert the longest uniform subsequence in each user behavior sequence to obtain enhanced sequence recommendation data; and used to replace the longest uniform subsequence in different user behavior sequences to obtain enhanced sequence recommendation data; The data recommendation module uses the enhanced sequence recommendation data for enhanced training of a comparative learning sequence recommendation system.
Citation Information
Cited By
Recommendation model training method and device, recommendation method and device, equipment and distributed system
CN121188284A