Sequence recommendation method and system based on dual-domain enhancement and frequency domain contrast learning

CN123012257APending Publication Date: 2026-10-30XIDIAN UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611057697.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-16
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

然而,序列推荐仍面临严重的数据稀疏性问题:用户与商品的交互记录往往极为有限,导致模型难以全面捕捉用户兴趣的动态演变规律,从而造成表征学习不足和性能瓶颈

Benefits of technology

[0027]其一,本发明由于构建了基于双域增强和频域对比学习的序列推荐方法及系统,考虑了现有数据增强仅在时域应用导致无法充分利用频谱结构信息的问题,将数据增强扩展到频域,有效地提升了推荐性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012257A_ABST
    Figure CN123012257A_ABST
Patent Text Reader

Abstract

The application discloses a sequence recommendation method and system based on dual-domain enhancement and frequency domain contrast learning, mainly to alleviate the problems of data sparsity of sequence recommendation data sets, deviation in semantics between generated enhanced sequences and original sequences in the prior art. The scheme comprises the following steps: obtaining a plurality of sequence recommendation data sets, preprocessing the sequence recommendation data sets to obtain a to-be-tested interaction sequence, and removing the last item of the to-be-tested interaction sequence to obtain a training interaction sequence; constructing a sequence recommendation network model comprising a single sequence enhancement unit, an encoder, a cross-sequence dual-domain enhancement unit and a frequency domain contrast learning unit; inputting the training interaction sequence into the sequence recommendation network model for iterative training to obtain a trained sequence recommendation network model; and inputting the to-be-tested interaction sequence into the trained sequence recommendation network model to obtain an item that is most likely to be interacted with by the to-be-tested interaction sequence in the future according to the model. The application effectively improves the performance of sequence recommendation by extending data enhancement to the frequency domain, and can be used in e-commerce and social platforms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer technology, and specifically relates to a sequence recommendation method and system that can be used in e-commerce and social platforms. Background Technology

[0002] Sequence recommendation aims to predict a user's next likely interaction by modeling their historical behavior sequences. This is one of the core tasks of modern recommender systems and is widely used in e-commerce and social platforms. For example, it recommends a user's next purchase based on their shopping history, or pushes potentially interesting posts and videos based on their likes and shares. Early sequence recommendation methods were based on the Markov chain assumption, using transition probabilities to describe the local sequential characteristics of user behavior. With the rise of deep learning, researchers have introduced various deep learning-based methods into the field of sequence recommendation, such as recurrent neural networks, convolutional neural networks, and Transformers, achieving some success.

[0003] In sequence recommendation methods, Normalized Diminished Cumulative Gain (NDCG) and Hit Ratio are commonly used as evaluation metrics. NDCG measures the ranking quality of the recommendation list by assigning higher gain weights to top-ranked relevant items and normalizing the NDCG, making the results comparable across different queries. Hit Ratio measures the accuracy of the recommendations, calculating whether the test item appears in the recommendation list, reflecting the model's basic ability to capture user interests.

[0004] In the field of sequence recommendation, the Transformer architecture, through its self-attention mechanism, learns the importance of features. Leveraging its powerful long-distance dependency modeling capabilities, this architecture has become the mainstream choice in sequence recommendation. However, sequence recommendation still faces a severe data sparsity problem: user-item interaction records are often extremely limited, making it difficult for the model to fully capture the dynamic evolution of user interests, resulting in insufficient representation learning and performance bottlenecks. To address this issue, contrastive learning has been introduced into sequence recommendation. For example, Xie et al., in their paper "Contrastive Learning for Sequential Recommendation" (Proceedings of the IEEE International Conference on Data Engineering, 2022, pp. 1259–1273), proposed a multi-task framework, CL4SRec. This method is the first to introduce contrastive learning into the field of sequence recommendation, generating positive sample views through random augmentation operations such as pruning, masking, and reordering, and combining the traditional sequential prediction objective with the contrastive learning objective. Utilizing contrastive learning loss, user representations are encoded by maximizing the consistency between different views of the same user interaction sequence in the latent space. In this way, CL4SRec can infer accurate user representations and then easily select attractive items individually for each user. However, this random augmentation operation is inherently limited to discrete item-level operations and is highly susceptible to disrupting fine temporal dependencies in the sequence, resulting in semantic deviations between the generated augmented sequence and the original sequence.

[0005] Patent document CN202510118935.8 discloses a sequence recommendation method based on contrastive learning and variational autoencoders. This method performs time-frequency domain transformation on the original data branch and data sliding augmentation on the data augmentation branch. At the model level, it employs a stochastic deep augmentation strategy, using a Transformer encoder to encode the data in both the original and augmented data branches, obtaining the mean and variance of the data in each branch. It then maximizes the positive and negative sample loss according to a contrastive learning strategy, and subsequently uses a shared Transformer decoder to generate a new item sequence. However, this method still uses a stochastic augmentation strategy, resulting in insufficient correlation between the data in the augmented sequence branch and the original data, potentially introducing unnecessary noise.

[0006] In their paper "Augmenting Sequential Recommendation with Balanced Relevance and Diversity" (Proceedings of the AAAI Conference on Artificial Intelligence, 2025, pp. 11563–11571), Dang et al. proposed a novel data augmentation method, BASRec. They pointed out that sequences generated by random augmentation methods often lack sufficient relevance to the original sequences. To address this issue, BASRec designs two modules: single-sequence augmentation and cross-sequence augmentation to generate virtual samples with both diversity and semantic relevance. For single-sequence augmentation, BASRec enhances diversity by sampling operation weights from a uniform distribution, building upon traditional random augmentation operations, while simultaneously achieving relevance by fusing the original and augmented sequence representations. For cross-sequence augmentation, BASRec employs a nonlinear hybrid method for fusion. However, this fusion incurs significant computational overhead in assigning weights to each parameter. To address this, BASRec decomposes this process and further proposes a hybrid method combining item-level and feature-level approaches to generate virtual samples with both diversity and semantic relevance. However, since the BASRec method is limited to time-domain mixing, the results produced by this homogeneous enhancement strategy lack diversity and fail to make full use of the rich information contained in the spectral structure. The model cannot distinguish user representations based on the natural semantics of frequency components, resulting in a decrease in recommendation accuracy. Summary of the Invention

[0007] The purpose of this invention is to overcome the shortcomings of the prior art and propose a sequence recommendation method and system based on dual-domain enhancement and frequency domain contrast learning, so as to avoid semantic deviation between the generated enhanced sequence and the original sequence, further distinguish user representations, and improve recommendation accuracy.

[0008] The technical approach to achieving the objective of this invention is as follows: by constructing a single-sequence enhancement module and a cross-sequence dual-domain enhancement module, semantic deviations between the generated enhanced sequence and the original sequence are avoided; by constructing a frequency domain contrast learning module, user representations are further distinguished; and by constructing a recommendation network containing the above modules, recommendation accuracy is improved.

[0009] Based on the above ideas, the technical solution of the present invention includes:

[0010] 1. A sequence recommendation method based on dual-domain enhancement and frequency domain contrastive learning, characterized in that it includes:

[0011] (1) Obtain multiple sequence recommendation datasets and preprocess them to obtain the interaction sequence L to be tested. testThen, remove the last item from the interaction sequence to be tested to obtain the training interaction sequence L. train ;

[0012] (2) Construct a sequence recommendation network model including a single sequence enhancement unit, an encoder, a cross-sequence dual-domain enhancement unit, and a frequency domain contrast learning unit;

[0013] (3) Train the interaction sequence L train The input is fed into the sequence recommendation network model for iterative training to obtain the trained sequence recommendation network model;

[0014] (4) The interaction sequence to be tested L test The input is fed into a trained sequence recommendation network model to obtain the interaction sequence L that the model considers to be tested. test The Topm items most likely to be interacted with subsequently.

[0015] Furthermore, the (2) step of constructing a sequence recommendation network model including a single-sequence enhancement unit, an encoder, a cross-sequence dual-domain enhancement unit, and a frequency domain contrast learning unit is implemented as follows:

[0016] (2a) Construct a single-sequence augmentation unit including an embedding layer, random augmentation, and mixup operation, used to augment the training interaction sequence L train The trained interaction representation E is obtained through the embedding layer. u Then E u The random augmentation representation is obtained through random augmentation. Then E u and Virtual samples are obtained by mixing using the mixup operation. ;

[0017] (2b) The virtual samples obtained by the single sequence augmentation unit are processed using the SASRec encoder. and training interaction representation E u Mapped to sequence representation respectively and H u ;

[0018] (2c) Establish a cross-sequence dual-domain augmentation unit that includes time-domain cross-sequence augmentation and frequency-domain cross-sequence augmentation, which is used to select time-domain or frequency-domain cross-sequence augmentation to train the interactive sequence representation H according to the application probability p. u ;

[0019] (2d) Establish a frequency domain contrastive learning unit that includes fast Fourier transform, frequency domain masking, inverse fast Fourier transform, and adaptive contrastive learning, used to first represent the training interaction sequence H u The amplitude spectrum A is obtained by mapping to the frequency domain using a fast Fourier transform. u and phase spectrum Then, frequency domain masks are applied to mask the high-frequency and low-frequency components respectively to construct low-frequency and high-frequency views. Finally, the low-frequency and high-frequency views are mapped back to the time domain through inverse fast Fourier transform to obtain the low-frequency view in the time domain. and high frequency view The input is then fed into adaptive contrastive learning.

[0020] (2e) Connect the single sequence enhancement unit in series with the encoder, and connect the cross-sequence dual-domain enhancement unit and the frequency domain contrast learning unit in parallel after the encoder to form a sequence recommendation network model.

[0021] 2. A sequence recommendation system based on dual-domain enhancement and frequency domain contrastive learning, characterized in that it includes:

[0022] The data preprocessing module is used to preprocess the sequence recommendation dataset to obtain the interaction sequences for training and testing, and to generate the necessary data for training the sequence recommendation network model.

[0023] The sequence recommendation network building module is used to construct a sequence recommendation network model that includes a single sequence augmentation unit, an encoder, a cross-sequence dual-domain augmentation unit, and a frequency domain contrastive learning unit.

[0024] The training module is used to train the model using gradient descent, optimize the sequence recommendation network model, and obtain a trained sequence recommendation network model.

[0025] The output module is used to output the interaction sequence L to be tested. test The input is fed into a trained sequence recommendation network model, and the output model considers the test interaction sequence L to be... test The Topm items most likely to be interacted with subsequently.

[0026] Compared with the prior art, the present invention has the following advantages:

[0027] Firstly, this invention constructs a sequence recommendation method and system based on dual-domain enhancement and frequency domain contrast learning. It addresses the problem that existing data enhancement methods only apply to the time domain, resulting in insufficient utilization of spectral structure information. By extending data enhancement to the frequency domain, it effectively improves recommendation performance.

[0028] Secondly, this invention constructs a cross-sequence dual-domain enhancement unit in the sequence recommendation network model, enabling the model to jointly extract multi-scale local sequence dependencies and global frequency patterns from the temporal embedding space and frequency spectral structure, effectively alleviating the problem of difficulty in simultaneously enhancing sample diversity and semantic consistency in sequence recommendation tasks.

[0029] Third, this invention uses a frequency domain contrastive learning unit in the sequence recommendation network model to decouple and model the frequency components, which reduces the misleading effect of high-frequency noise signals on the early optimization of the model. It can focus on the long-term stable interest components of users, while also taking into account the progressive learning of short-term dynamic preferences, thereby further improving the discriminative power of user representation and the accuracy of sequence recommendation. Attached Figure Description

[0030] Figure 1 This is a flowchart illustrating the implementation of the sequence recommendation method based on dual-domain enhancement and frequency domain contrastive learning in this invention.

[0031] Figure 2 This is a schematic diagram of the sequence recommendation network model structure constructed in the method of this invention;

[0032] Figure 3 yes Figure 2 Random enhancement in;

[0033] Figure 4 yes Figure 2 The cross-sequence dual-domain enhancement unit;

[0034] Figure 5 yes Figure 2 Frequency domain contrast learning unit;

[0035] Figure 6 This is a block diagram of the sequence recommendation system based on dual-domain enhancement and frequency domain contrastive learning according to the present invention. Detailed Implementation

[0036] To enable those skilled in the art to better understand the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0037] Example 1: A sequence recommendation method based on dual-domain enhancement and frequency domain contrastive learning.

[0038] Reference Figure 1 The implementation steps of this example include the following:

[0039] Step 1: Preprocess multiple sequence recommendation datasets to obtain the interaction sequence L to be tested. test and training interaction sequence L train .

[0040] The sequence recommendation dataset is a collection of user interaction sequences, consisting of user-item interaction records collected from e-commerce websites or social platforms. This step performs the following preprocessing on the acquired sequence recommendation datasets:

[0041] (1.1) Filter out users and items with fewer than 5 interaction records from the sequence recommendation dataset to prevent users and items with too few interaction records from interfering with the recommendation;

[0042] (1.2) Let U and V represent the user set and the item set, respectively. The interaction sequences in the filtered sequence recommendation dataset are reordered in chronological order to obtain the interaction sequence to be tested, L. test :

[0043] L test = (v1, ..., v j , ..., v L ),

[0044] Where v j Let L represent the j-th item that the user interacted with, and L be the length of the sequence.

[0045] (1.3) The interaction sequence to be tested L test Remove the last item from the sequence to obtain the training interaction sequence L. train :

[0046] L train = (v1, ..., v j , ..., v L-1 ).

[0047] Step 2: Construct a sequence recommendation network model based on dual-domain enhancement and frequency domain contrastive learning.

[0048] The sequence recommendation network model includes a single sequence augmentation unit, an encoder, a cross-sequence dual-domain augmentation unit, and a frequency domain contrastive learning unit.

[0049] Reference Figure 2 The implementation of this step includes the following:

[0050] (2.1) Construct a single-sequence augmentation unit including an embedding layer, random augmentation, and mixup operations:

[0051] Train the interaction sequence L train The input embedding layer yields the trained interaction representation E. u ;

[0052] like Figure 3 As shown, the random enhancement operation includes three different operations: replacement, reordering, and masking, wherein:

[0053] This substitution operation enhances the sequence by replacing existing items with semantically similar ones, i.e., given a training interaction representation E. u First, the enhancement ratio β is obtained by sampling from a uniform distribution U(a, b). s, where a and b are tunable hyperparameters satisfying 0<a<b<1; the replacement scale is calculated according to this ratio: L s = β s ·(L-1), where L is the length of the sequence; then randomly select L items in the training interaction representation E u and replace them with the most similar items to obtain a random augmentation representation s ;

[0054] This reordering operation aims to weaken the model's excessive dependence on the chronological order of interactions by rearranging the order of items, so as to improve its robustness to unknown interaction patterns, that is, given the training interaction representation E u , first sample the augmentation ratio β from the uniform distribution U(a, b) r , and determine the length of the subsequence to be reordered as L according to this ratio r = β r ·(L-1); then randomly select a position k in the training interaction representation E u , and randomly reorder the sequence of items with the length L starting from position k to obtain a random augmentation representation r ;

[0055] This masking operation randomly shields a part of the interaction terms in the original sequence, forcing the model to make predictions under incomplete information, so as to improve its robustness to data noise and reduce the risk of overfitting, that is, given the training interaction representation E u , first sample the augmentation ratio β from the uniform distribution U(a, b) m , and determine the number of items to be masked as L according to this ratio m = β m ·(L-1); then randomly select L positions in the training interaction representation E u to form a mask index set M, and replace the item indices at these positions with index 0 to obtain a random augmentation representation m ;

[0056] The mixup operation mixes the random augmentation representation obtained by the random augmentation operation with the training interaction representation E u to obtain a virtual representation for model training :

[0057] ,

[0058] where is the mixing weight sampled from Beta(α, α), and α is a tunable hyperparameter;

[0059] ​​​(2.2) The virtual samples obtained by the single sequence augmentation unit are processed using the SASRec encoder. and training interaction representation E u Mapped to sequence representation respectively and H u ;

[0060] (2.3) Establish a cross-sequence dual-domain enhancement unit that includes time-domain cross-sequence enhancement and frequency-domain cross-sequence enhancement:

[0061] like Figure 4 As shown, the temporal cross-sequence enhancement is divided into item-level mixing and feature-level mixing, and their respective enhancement operations are as follows:

[0062] For item-level mixing, given a batch of training interaction sequence representations Sample L-1 weight values ​​from Beta(α,α) to construct a mixed weight vector. And from the training interaction sequence of the current batch In the process, another training interaction sequence is randomly selected to represent... By mixing it with the virtual sample: Where N, L, and E represent the batch size, the interaction sequence to be tested, and the E, respectively. test and embedding dimension, ◦ denotes the Hadamard product, and α is an adjustable hyperparameter;

[0063] For feature-level mixing, E weight values ​​are sampled from Beta(α, α) to construct a mixed weight vector. and mix H u and Obtain virtual samples: ;

[0064] like Figure 4 As shown, the frequency domain cross-sequence enhancement is divided into item-level Freqmix and feature-level Freqmix, and their enhancement operations are as follows:

[0065] For item-level Freqmix, take the training interaction sequence representation H from the current batch. u Randomly select another training interaction sequence from the same batch to represent As H u The hybrid partners, and H through fast Fourier transform u and Mapping to the frequency domain yields H u Frequency domain representation and Frequency domain representation ;

[0066] Then F u Decomposed into amplitude spectrum Au and phase spectrum ,Will Decomposed into amplitude spectrum and phase spectrum Sample a mixed weight vector M of length L-1 from Beta(α,α). c Mixing A at the amplitude spectrum level u and The amplitude of the virtual sample is obtained: ;

[0067] Then, the phase spectrum of the virtual sample is obtained by employing a dominant phase selection strategy: ;

[0068] Finally, the virtual sample is obtained by recovering the time-domain representation through the inverse fast Fourier transform: ,in M represents c The j-th element, , and Representing matrices respectively , and The (i, j)th element;

[0069] For the feature level Freqmix, it is a mixture weight vector M of length E sampled from Beta(α, α). d Mixing A at the amplitude spectrum level u and The amplitude spectrum of the virtual sample is obtained: The phase spectrum of the virtual sample is obtained by employing a dominant phase selection strategy: ;

[0070] Finally, the virtual sample is obtained by recovering the time-domain representation through the inverse fast Fourier transform: ,in M represents d The j-th element;

[0071] (2.4) Establish a frequency domain contrastive learning unit that includes Fast Fourier Transform, frequency domain masking, Inverse Fast Fourier Transform, and adaptive contrastive learning:

[0072] (2.4.1) As Figure 5 As shown, the training interaction sequence representation H u The amplitude spectrum A is obtained by mapping to the frequency domain using a fast Fourier transform. u and phase spectrum Amplitude spectrum A u The frequency band is divided into a low-frequency band [0, 0.3F], a mid-frequency band [0.3F, 0.7F], and a high-frequency band [0.7F, F]. After the division, a mask probability β is selected.F Then construct low-frequency and high-frequency views, where:

[0073] When constructing a low-frequency view, it is based on β. F Mask A u The amplitude of the high-frequency band is used to obtain the amplitude spectrum of the low-frequency view. Then, the low-frequency view in the time domain is reconstructed using the inverse fast Fourier transform. :

[0074] ,

[0075] Where Re(⋅) represents the real part of the complex number, F is the number of frequency points, and β F It is an adjustable hyperparameter;

[0076] When constructing a high-frequency view, it is based on β. F Mask A u The amplitude of the low-frequency band is used to obtain the amplitude spectrum of the high-frequency view. Then, the high-frequency view in the time domain is reconstructed using the inverse fast Fourier transform. :

[0077] ;

[0078] (2.4.2) Adaptive contrastive learning divides the contrastive pattern into three stages according to the training process. The first stage is the contrastive training interaction sequence representation H. u and low-frequency view Calculate the contrastive learning loss L fcl :

[0079] ,

[0080] Where E c Here, t represents the hyperparameter used to control the contrastive mode in contrastive learning, and t denotes the t-th iteration. Here, sim(⋅) represents the contrastive learning loss function used, and sim(⋅) represents the cosine similarity function. The set of negative samples corresponding to H1;

[0081] The second phase compares the training interaction sequence representation H. u and high frequency view Calculate the contrastive learning loss L fcl :

[0082] ;

[0083] Third stage: Comparison of low-frequency views and high frequency view Calculate the contrastive learning loss L fcl :

[0084] .

[0085] Step 3: Iteratively train the sequence recommendation network model.

[0086] (3.1) The initial number of iterations is t, the maximum number of iterations is T = 200, and the weight parameters of the recommendation network model in the t-th iteration are w. t And let t = 1;

[0087] (3.2) Train the interaction sequence L train As input to the sequence recommendation network model, the model's output H is obtained. u The binary cross-entropy loss function is used as the loss function for this sequence recommendation network model:

[0088] ,

[0089] in This refers to the items that the user actually interacts with. This represents the selected negative sample, and σ(⋅) represents the sigmoid function;

[0090] (3.3) Generating virtual samples using cross-sequence dual-domain enhancement units Calculate the L1 loss for cross-sequence enhanced recommendations:

[0091] ,

[0092] in, represent The corresponding positive samples, represent The corresponding negative sample;

[0093] (3.4) Train the interaction sequence L train Input single-sequence augmentation unit to generate virtual samples The loss weight w is calculated using the augmentation ratio β of the random augmentation operation and the mixed weight λ:

[0094] ,

[0095] in This represents increased strength. It is all The minimum value in, It is all The maximum value in each virtual sample Each corresponds to a loss weight w;

[0096] (3.5) Based on the loss weight w, the single-sequence augmentation recommendation loss L2 is obtained:

[0097] ;

[0098] (3.6) Using the three recommendation losses L obtained from (3.2) to (3.5) main L1, L2, and the contrastive learning loss L obtained using the frequency domain contrastive learning unit. fcl Calculate the total loss L total :

[0099] ;

[0100] (3.7) Apply gradient descent to the loss value L total Perform backpropagation to update the weight parameters of the sequence recommendation network model, and obtain the updated weight parameters w of the sequence recommendation network model. t+1 :

[0101] ,

[0102] Where w t This represents the weight parameters before the update, where lr is the learning rate with a value of 0.001, and t = t + 1;

[0103] (3.8) Repeat (3.2) to (3.7) for twenty rounds to evaluate the model performance. If the model performance does not improve or t = T, stop training and obtain the trained sequence recommendation network model. Otherwise, return to step (3.2).

[0104] Step 4: Obtain the sequence recommendation results.

[0105] The interaction sequence to be tested L test The input is fed into a trained sequence recommendation network model to obtain the interaction sequence L that the model considers to be tested. test The Topm items most likely to be interacted with subsequently.

[0106] It should be noted that the step numbers in this specification and claims are only for the purpose of clearly describing the embodiments of the present invention and facilitating understanding, and their order is not limited.

[0107] Example 2: A sequence recommendation system based on dual-domain enhancement and frequency domain contrastive learning.

[0108] Reference Figure 6 This example includes: a data preprocessing module 1, a sequence recommendation network construction module 2, a training module 3, and an output module 4. The sequence recommendation network construction module 2 includes a single-sequence enhancement submodule 21, an encoder submodule 22, a cross-sequence dual-domain enhancement submodule 23, and a frequency domain contrastive learning submodule 24.

[0109] The functions and transmission relationships of each module are as follows:

[0110] The data preprocessing module 1 is used to acquire the sequence recommendation dataset, filter, rearrange, and remove the last item from it to obtain the training interaction sequence L. train Interaction sequence L to be tested test And train the interaction sequence L train The sequence recommendation network construction module 2 and training module 3 transmit the interaction sequence L to be tested. test Transmitted to output module 4.

[0111] The sequence recommendation network construction module 2 is used to construct a sequence recommendation network model including a single sequence enhancement unit, an encoder, a cross-sequence dual-domain enhancement unit, and a frequency domain contrastive learning unit. The single sequence enhancement submodule 21 is used to train the interactive sequence L. train Generate virtual samples that combine diversity and semantic consistency. And transmit it to encoder submodule 22; encoder submodule 22 is used to process the virtual samples generated by single sequence enhancement submodule 21. and training interaction sequence L train Convert them into sequence representations respectively and H u And represent the sequence H u The data is transmitted to the cross-sequence dual-domain enhancement submodule 23 and the frequency domain contrast learning submodule 24; the cross-sequence dual-domain enhancement submodule 23 is used to process the two sequence representations H. u and A hybrid approach is employed to discover preference knowledge among different sequences, and local sequence dependencies and global frequency patterns are jointly extracted from the temporal embedding space and frequency domain spectral structure; this frequency domain contrastive learning submodule 24 is used to decouple the modeling of sequence representation H u The frequency components enable the model to focus on long-term stable interests in interaction sequences while also learning short-term dynamic changes.

[0112] The training module 3 is used to utilize the training interaction sequence L input by the data preprocessing module 1. train The sequence recommendation network model was trained and optimized using gradient descent to obtain a well-trained sequence recommendation network model.

[0113] The output module 4 is used to transmit the interaction sequence L to be tested transmitted by the data preprocessing module 1. test The input is fed into a trained sequence recommendation network model, which outputs the Topm items that the model believes are most likely to be interacted with in the next interaction sequence.

[0114] The effects of this invention will be further illustrated below with simulation experiments:

[0115] 1. Simulation experimental conditions:

[0116] The hardware platform for the simulation experiment is as follows: AMD EPYC 7663 CPU with a clock speed of 2.0GHz, 80G of memory, and NVIDIA GeForce RTX 4090 24G graphics card.

[0117] The software platform for the simulation experiment is Windows 11 as the operating system, Python 3.10 as the programming language, PyCharm 2023 as the programming software, and PyTorch as the deep learning framework.

[0118] The simulation experiments used three datasets commonly used in the recommender system field: Beauty, Sports, and Toys.

[0119] Beauty is a dataset of user reviews and purchase behavior data for beauty and skincare products on Amazon, covering interaction records of cosmetics, skincare products, and other items.

[0120] Sports is a user behavior dataset for Amazon's sports products category, containing interaction records for sports equipment, fitness gear, and other related products.

[0121] Toys is a dataset of user reviews and purchases of toys from Amazon, recording user interactions with various toy products.

[0122] The parameters of the three datasets are shown in Table 1.

[0123] Table 1 Parameters of the three datasets

[0124]

[0125] The sparsity is obtained by subtracting the number of interactions from the product of the number of users and the number of items by subtracting 1:

[0126] .

[0127] 2. Simulation Experiment Content and Result Analysis:

[0128] Simulation 1. The present invention and eight existing methods (Caser, SASRec, BERT4Rec, CoSeRec, ICLRec, IOCRec, ELCRec, and BASRec) are used to make recommendations on the Beauty dataset described in Table 1. The hit rate H@K and the normalized cumulative gain N@K of each method are calculated as evaluation indicators, where K represents the number of recommended results taken, which is set to 5, 10, or 20. The results are shown in Table 2.

[0129] Table 2. Performance comparison of the present invention with eight existing methods on the Beauty dataset.

[0130]

[0131] Simulation 2. The present invention and eight existing methods (Caser, SASRec, BERT4Rec, CoSeRec, ICLRec, IOCRec, ELCRec, and BASRec) were used to make recommendations on the Sports dataset described in Table 1. Their respective H@K and N@K were calculated as evaluation metrics, and the results are shown in Table 3.

[0132] Table 3. Performance comparison of the present invention with eight existing methods on the Sports dataset.

[0133]

[0134] Simulation 3. The present invention and eight existing methods (Caser, SASRec, BERT4Rec, CoSeRec, ICLRec, IOCRec, ELCRec, and BASRec) were used to make recommendations on the Toys dataset described in Table 1. Their respective H@K and N@K were calculated as evaluation metrics, and the results are shown in Table 4.

[0135] Table 4. Performance comparison of the present invention with eight existing methods on the Toys dataset.

[0136]

[0137] As can be seen from the results in Tables 2, 3 and 4, on three different sequence recommendation datasets, the present invention improves the normalized loss cumulative gain and hit rate to varying degrees compared with the prior art, indicating that the present invention can effectively improve recommendation performance.

[0138] The simulation experiments above demonstrate that the sequence recommendation network model proposed in this invention can utilize the rich information contained in the spectral structure, thereby achieving further performance improvements compared to traditional recommendation models. The key technology lies in the sequence recommendation network model constructed in this invention based on dual-domain enhancement and frequency-domain contrastive learning. The cross-sequence dual-domain enhancement module in this network model can jointly generate virtual samples from the frequency and time domains, generating diverse and semantically relevant virtual samples while maintaining temporal consistency, effectively expanding the training distribution and improving the model's generalization ability. The frequency-domain contrastive learning module in this network model can map user representations to the frequency domain and decompose them into low-frequency and high-frequency views. It constructs multi-granularity interest representations through frequency-domain amplitude spectrum masks and uses adaptive contrastive learning to dynamically adjust the contrast targets at different training stages, avoiding early training being misled by high-frequency noise.

[0139] The sources of the eight prior art technologies listed in Tables 2, 3, and 4 are as follows:

[0140] Caser, as mentioned above, is a sequence recommendation method based on convolutional sequence embedding proposed by Tang et al. in "Personalized top-N sequential recommendation via convolutional sequence embedding[C] / / 2018 ACM International Conference on Web Search and Data Mining (WSDM). ACM, 2018: 565-573".

[0141] SASRec, as mentioned above, is a sequence recommendation method based on a self-attention mechanism proposed by Kang et al. in "Self-attentive sequential recommendation[C] / / 2018 IEEE International Conference on Data Mining (ICDM). IEEE, 2018:197-206".

[0142] The BERT4Rec mentioned above is a sequence recommendation method based on a bidirectional Transformer encoder, proposed by Sun et al. in "BERT4Rec: Sequential recommendation with bidirectional encoder representations from transformer[C] / / 2019 ACM International Conference on Information and Knowledge Management (CIKM). ACM,2019: 1441-1450".

[0143] CoSeRec, as mentioned above, is a sequence recommendation method based on contrastive self-supervised learning and robust data augmentation, proposed by Liu et al. in "Contrastive self-supervised sequential recommendation with robust augmentation. arXiv preprint arXiv:2108.06479,2021".

[0144] ICLRec, as mentioned above, is a sequential recommendation method based on intent contrastive learning proposed by Chen et al. in "Intent contrastive learning for sequential recommendation[C] / / 2022 ACM Web Conference (WWW). ACM, 2022: 2172-2182".

[0145] The aforementioned IOCRec is a sequence recommendation method based on multi-intention-oriented contrastive learning, proposed by Li et al. in "Multi-intention oriented contrastive learning for sequential recommendation [C] / / 2023 ACM International Conference on WebSearch and Data Mining (WSDM). ACM, 2023: 411-419".

[0146] The ELCRec mentioned above is an intent learning sequence recommendation method based on end-to-end learnable clustering, proposed by Liu et al. in "End-to-end learnable clustering for intent learning in Recommendation[C] / / 2024 Conference on Neural Information Processing Systems (NeurIPS). 2024: 5913-5949".

[0147] BASRec, as mentioned above, is a data-enhanced sequential recommendation method based on balancing relevance and diversity, proposed by Dang et al. in “Augmenting sequential recommendation with balanced relevance and diversity[C] / / 2025 AAAI Conference on Artificial Intelligence (AAAI). AAAI Press, 2025: 11563-11571”.

[0148] The above descriptions are merely two specific examples of the present invention and do not constitute any limitation on the present invention. Obviously, those skilled in the art, after understanding the content and principles of the present invention, may make various modifications and changes in form and detail without departing from the principles and structure of the present invention. For example, in this example, the sequence recommendation network model can use not only the SASREC encoder but also other encoders such as the GRU4SREC encoder. The random augmentation operation used in this example can be replaced by other random augmentation operations. However, these modifications and changes based on the ideas of the present invention are still within the scope of protection of the claims of the present invention.

Claims

1. A sequence recommendation method based on dual-domain enhancement and frequency domain contrastive learning, characterized in that, include: (1) Obtain multiple sequence recommendation datasets and preprocess them to obtain the interaction sequence L to be tested. test Then, remove the last item from the interaction sequence to be tested to obtain the training interaction sequence L. train ; (2) Construct a sequence recommendation network model including a single sequence enhancement unit, an encoder, a cross-sequence dual-domain enhancement unit, and a frequency domain contrast learning unit; (3) Train the interaction sequence L train The input is fed into the sequence recommendation network model for iterative training to obtain the trained sequence recommendation network model; (4) The interaction sequence to be tested L test The input is fed into a trained sequence recommendation network model to obtain the interaction sequence L that the model considers to be tested. test The Topm items most likely to be interacted with subsequently.

2. The method according to claim 1, characterized in that, In step (1), the multiple sequence recommendation datasets obtained are preprocessed to obtain the interaction sequence L to be tested. test and training interaction sequence L train Its implementation includes: (1a) Filter out users and items with fewer than 5 interaction records from the sequence recommendation dataset to prevent users and items with too few interaction records from interfering with the recommendation; (1b) Let U and V represent the user set and the item set, respectively. Reorder the interaction sequences in the filtered sequence recommendation dataset according to the time order to obtain the interaction sequence to be tested, L. test : L test = (v1, ..., v j ,..., v L ), Where v j Let L represent the j-th item that the user interacted with, and L be the length of the sequence. (1c) The interaction sequence to be tested L test Remove the last item from the sequence to obtain the training interaction sequence L. train : L train = (v1, ..., v j , ..., v L-1 )。 3. The method according to claim 1, characterized in that, The (2) step involves constructing a sequence recommendation network model that includes a single-sequence enhancement unit, an encoder, a cross-sequence dual-domain enhancement unit, and a frequency domain contrast learning unit. Its implementation includes: (2a) Construct a single-sequence augmentation unit including an embedding layer, random augmentation, and mixup operation, used to augment the training interaction sequence L train The trained interaction representation E is obtained through the embedding layer. u Then E u The random augmentation representation is obtained through random augmentation. Then E u and Virtual samples are obtained by mixing using the mixup operation. ; (2b) The virtual samples obtained by the single sequence augmentation unit are processed using the SASRec encoder. and training interaction representation E u Mapped to sequence representation respectively and H u ; (2c) Establish a cross-sequence dual-domain augmentation unit that includes time-domain cross-sequence augmentation and frequency-domain cross-sequence augmentation, which is used to select time-domain or frequency-domain cross-sequence augmentation to train the interactive sequence representation H according to the application probability p. u ; (2d) Establish a frequency domain contrastive learning unit that includes fast Fourier transform, frequency domain masking, inverse fast Fourier transform, and adaptive contrastive learning, used to first represent the training interaction sequence H u The amplitude spectrum A is obtained by mapping to the frequency domain using a fast Fourier transform. u and phase spectrum Then, frequency domain masks are applied to mask the high-frequency and low-frequency components respectively to construct low-frequency and high-frequency views. Finally, the low-frequency and high-frequency views are mapped back to the time domain through inverse fast Fourier transform to obtain the low-frequency view in the time domain. and high frequency view The input is then fed into adaptive contrastive learning. (2e) Connect the single sequence enhancement unit in series with the encoder, and connect the cross-sequence dual-domain enhancement unit and the frequency domain contrast learning unit in parallel after the encoder to form a sequence recommendation network model.

4. The method according to claim 1, characterized in that, In (3), the training interaction sequence L train The input is fed into a sequence recommendation network model for iterative training, the implementation of which includes: (3a) The initial number of iterations is t, the maximum number of iterations is T = 200, and the weight parameters of the recommendation network model in the t-th iteration are w. t And let t = 1; (3b) Train the interaction sequence L train As input to the sequence recommendation network model, the model's output H is obtained. u The binary cross-entropy loss function is used as the loss function for this sequence recommendation network model: , in This refers to the items that the user actually interacts with. This represents the selected negative sample, and σ(⋅) represents the sigmoid function; (3c) Generating virtual samples using cross-sequence dual-domain enhancement units Calculate the L1 loss for cross-sequence enhanced recommendations: , in, represent The corresponding positive samples, represent The corresponding negative sample; (3d) Train the interaction sequence L train Input single-sequence augmentation unit to generate virtual samples The loss weight w is calculated using the augmentation ratio β of the random augmentation operation and the mixed weight λ: , in This represents increased strength. It is all The minimum value in, It is all The maximum value in each virtual sample Each corresponds to a loss weight w; (3e) Based on the loss weight w, the single-sequence augmentation recommendation loss L2 is obtained: ; (3f) Using the three recommendation losses L obtained from (3b) to (3e) main L1, L2, and the contrastive learning loss L obtained using the frequency domain contrastive learning unit. fcl Calculate the total loss L total : ; (3g) The loss value L is obtained by gradient descent. total Perform backpropagation to update the weight parameters of the sequence recommendation network model, and obtain the updated weight parameters w of the sequence recommendation network model. t+1 : , Where w t This represents the weight parameters before the update, where lr is the learning rate with a value of 0.001, and t = t + 1; (3h) Repeat (3b) to (3g) for twenty rounds to evaluate the model performance. If the model performance does not improve or t = T, stop training and obtain the trained sequence recommendation network model. Otherwise, return to step (3b).

5. The method according to claim 3, characterized in that: The random enhancement operation in (2a) includes three different operations: substitution, reordering, and masking, wherein: The replacement operation is to replace the original items with semantically similar items to augment the sequence, that is, given the training interaction representation E u , first sample the augmentation ratio β from the uniform distribution U(a, b) s , where a and b are tunable hyperparameters satisfying 0<a<b<1; calculate the replacement scale according to this ratio: L s = β s · (L-1), where L is the length of the to-be-tested interaction sequence L test ; then randomly select L items in the training interaction representation E u s items, and replace them with the most similar items to obtain a random augmentation representation ;​ The reordering operation aims to reduce the model's over-reliance on the temporal order of interactions by rearranging the order of items, thereby improving its robustness to unknown interaction patterns. That is, given a training interaction representation E... u First, the enhancement ratio β is obtained by sampling from a uniform distribution U(a, b). r Based on this ratio, the length of the subsequence to be rearranged is determined to be L. r = β r · (L-1); then train the interactive representation E u Randomly select a position k, and randomly rearrange the elements starting from position k with a length of L. r The order of items is randomly enhanced. ; Masking, by randomly masking a portion of the interaction terms in the original sequence, forces the model to make predictions with incomplete information, thereby improving its robustness to data noise and reducing the risk of overfitting. That is, given the training interaction representation E... u First, the enhancement ratio β is obtained by sampling from a uniform distribution U(a, b). m The number of items L to be shielded is determined based on this ratio. m = β m · (L-1); then from the training interaction representation E u L is randomly selected from the middle m The positions form a mask index set M, and the item indices at these positions are replaced with index 0 to obtain a randomized enhanced representation. ; The mixup operation in (2a) is to transform the random augmentation representation obtained from the random augmentation operation. Interaction representation with training E u The mixture yields a virtual representation for model training. : , in It is a mixture weight sampled from Beta(α, α), where α is an adjustable hyperparameter.

6. The method according to claim 3, characterized in that, The temporal cross-sequence enhancement in (2c) is divided into item-level mixing and feature-level mixing, and their respective enhancement operations are as follows: For item-level mixing, given a batch of training interaction sequence representations Sample L-1 weight values ​​from Beta(α, α) to construct a mixed weight vector. And from the training interaction sequence of the current batch In the process, another training interaction sequence is randomly selected to represent... By mixing it with the virtual sample: Where N, L, and E represent the batch size, the interaction sequence to be tested, and L, respectively. test and embedding dimension, ◦ denotes the Hadamard product, and α is an adjustable hyperparameter; For feature-level mixing, E weight values ​​are sampled from Beta(α, α) to construct a mixed weight vector. and mix H u and Obtain virtual samples: .

7. The method according to claim 3, characterized in that, The frequency domain cross-sequence enhancement in (2c) is divided into item-level Freqmix and feature-level Freqmix, and their enhancement operations are as follows: (2c1) Enhanced operations for item-level Freqmix: Take the training interaction sequence representation H from the current batch u Randomly select another training interaction sequence from the same batch to represent As H u The hybrid partners, and H through fast Fourier transform u and Mapping to the frequency domain yields H u Frequency domain representation and Frequency domain representation ; Then F u Decomposed into amplitude spectrum A u and phase spectrum ,Will Decomposed into amplitude spectrum and phase spectrum Sample a mixed weight vector M of length L-1 from Beta(α, α). c Mixing A at the amplitude spectrum level u and The amplitude of the virtual sample is obtained: ; Then, the phase spectrum of the virtual sample is obtained by employing a dominant phase selection strategy: ; Finally, the virtual sample is obtained by recovering the time-domain representation through the inverse fast Fourier transform: ,in M represents c The j-th element, , and Representing matrices respectively , and The (i, j)th element; (2c2) Feature-level Freqmix enhancement operations: Sample a mixed weight vector M of length E from Beta(α, α). d Mixing A at the amplitude spectrum level u and The amplitude spectrum of the virtual sample is obtained: ; The phase spectrum of the virtual sample is obtained by employing a dominant phase selection strategy: ; Finally, the virtual sample is obtained by recovering the time-domain representation through inverse fast Fourier transform: ,in M represents d The j-th element.

8. The method according to claim 3, characterized in that: The frequency domain mask in (2d) is obtained after obtaining the frequency domain representation F. u Amplitude spectrum A u and phase spectrum Then, the amplitude spectrum A u The frequency band is divided into a low-frequency band [0, 0.3F], a mid-frequency band [0.3F, 0.7F], and a high-frequency band [0.7F, F]. After the division, a mask probability β is selected. F Then, low-frequency and high-frequency views are constructed. The low-frequency view is constructed based on β. F Mask A u The amplitude of the high-frequency band is used to obtain the amplitude spectrum of the low-frequency view. and phase spectrum The low-frequency view is constructed; when constructing the high-frequency view, it is based on β. F Mask A u The amplitude of the low-frequency band is used to obtain the amplitude spectrum of the high-frequency view. and phase spectrum Construct a high-frequency view, where F is the number of frequency points, and β F It is an adjustable hyperparameter; The adaptive contrastive learning in (2d) is based on obtaining a low-frequency view in the time domain. and high frequency view Subsequently, the contrastive pattern was divided into three stages according to the training process, and the contrastive learning loss L was calculated. fcl : , Where E c sim(⋅) is a hyperparameter used to control the contrast patterns in contrastive learning, representing the cosine similarity function, and t represents the t-th iteration. The contrastive learning loss function used is... Let H1 be the set of negative samples.

9. A sequence recommendation system based on dual-domain enhancement and frequency domain contrastive learning, characterized in that, include: The data preprocessing module is used to preprocess the sequence recommendation dataset to obtain the interaction sequences for training and testing, and to generate the necessary data for training the sequence recommendation network model. The sequence recommendation network building module is used to construct a sequence recommendation network model that includes a single sequence augmentation unit, an encoder, a cross-sequence dual-domain augmentation unit, and a frequency domain contrastive learning unit. The training module is used to train the model using gradient descent, optimize the sequence recommendation network model, and obtain a trained sequence recommendation network model. The output module is used to output the interaction sequence L to be tested. test The input is fed into a trained sequence recommendation network model, and the output model considers the test interaction sequence L to be... test The Topm items most likely to be interacted with subsequently.

10. The system according to claim 8, characterized in that, The sequence recommendation network construction module includes: The single-sequence enhancement submodule is used to train the interactive sequence L. train Generate virtual samples that combine diversity and semantic consistency. ; The encoder submodule is used to process the virtual samples generated by the single-sequence enhancement submodule. and training interaction sequence L train Convert them into sequence representations respectively and H u ; Cross-sequence dual-domain enhancement submodule for hybrid sequence representation H u And another sequence representation To discover the preference knowledge between different sequences, and to jointly extract local sequence dependencies and global frequency patterns from the temporal embedding space and frequency spectral structure; The frequency domain contrastive learning submodule is used to decouple the modeling sequence representation H. u The frequency components enable the model to focus on long-term stable interests in interaction sequences while also learning short-term dynamic changes.

Citation Information

Patent Citations

  • Sequence recommendation method based on comparative learning and variational auto-encoder

    CN119939036A