Sequence recommendation method based on anti-fact data enhancement

Through a sequence recommendation method based on counterfactual data augmentation, the LSTM neural network and sampler model are used to generate counterfactual sequences, which solves the user preference prediction problem caused by real-world data sparseness and achieves higher recommendation accuracy.

CN119884467APending Publication Date: 2025-04-25CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411808346.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Existing sequence recommendation models are difficult to effectively predict user preferences in the case of sparse real-world data, resulting in poor execution of recommendation strategies in practice.

Method used

A sequence recommendation method based on counterfactual data augmentation is adopted to acquire user historical behavior data, establish user content feature vectors, and use LSTM neural network to train the recommendation model. Then, the sampler model is introduced to generate counterfactual sequences and the recommended model is retrained to improve performance.

Benefits of technology

This method can effectively reduce the impact of imperfect training data, improve the accuracy of user preference prediction, and improve the performance of sequence recommendation models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884467A_ABST
    Figure CN119884467A_ABST
Patent Text Reader

Abstract

The invention relates to a sequence recommendation method based on anti-fact data enhancement, and belongs to the field of internet preference prediction. The method comprises the following steps: acquiring video data and user data; processing the enhanced video data and user data by adopting an embedding layer to obtain user embedding and video embedding; splicing the user embedding and the video embedding to obtain a user interest representation vector; inputting the user interest representation vector into a sequence recommendation model for processing to obtain a pre-training model; enabling the original data to pass through an anti-fact data enhancement framework to generate an anti-fact sequence; retraining the recommendation model by using the anti-fact sequence to generate a complete recommendation model; according to the invention, user preference prediction can be accurately and effectively carried out, and the accuracy of user preference prediction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of Internet preference prediction and relates to a sequence recommendation method based on counterfactual data enhancement. Background Art

[0002] Sequential recommendation is a decision support system that aims to predict user preferences based on their historical behaviors. However, due to the sparsity of real-world data, this recommendation strategy may not perform well in practice. To this end, this paper proposes a new counterfactual data augmentation framework to mitigate the impact of imperfect training data and provide support for sequential recommendation models.

[0003] In the past few years, many sequential recommendation models have been proposed and have achieved good performance in various application scenarios. These models use complex mechanisms to predict user preferences from their historical behaviors. However, sequential recommendation models are essentially still based on the appearance of two or more items in a sequence to capture their joint distribution, which requires more high-quality sequence data for training than non-sequential recommendation models. However, this condition conflicts with the sparsity of real-world data. In practice, the sequences observed can only cover a very small number of user content interactions. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a sequence recommendation method based on counterfactual data enhancement, the method comprising: acquiring video data and user data; inputting the original training data into a user preference prediction model for training to obtain a pre-trained model, inputting the video data and user data into a data enhancement framework to generate a counterfactual sequence, retraining the recommendation model with the enhanced training data to obtain a complete recommendation model, and using the model to predict interest preferences.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] A sequence recommendation method based on counterfactual data enhancement, the method comprising the following steps:

[0007] S1: Obtain the user's historical behavior data on the website. The historical behavior data includes user information and content information;

[0008] S2: Establish user content feature vector based on historical behavior data;

[0009] S3: Input the feature vector into the sequence recommendation model for training;

[0010] S4: Calculate the model cross entropy loss and adjust the model parameters according to the model cross entropy loss to obtain the pre-trained recommendation model;

[0011] S5: Input the original data into the sampler model to generate counterfactual sequences;

[0012] S6: Retraining recommendation models using counterfactual sequences;

[0013] S7: Input the user data to be predicted into the recommendation model to calculate the user's interest preference.

[0014] Furthermore, in S1, the historical behavior data comes from PC, WAP, APP and offline data; the user information includes the user's identification ID, the user's gender, age and access preferences; the content information includes the identification code of the project, the project category and the author.

[0015] Furthermore, in S2, establishing the user content probability prediction feature vector specifically includes:

[0016] Clear the missing values ​​in the features, convert non-numerical features into numerical features, and use the embedding layer to process the content data and user data; the embedding layer is a neural network layer commonly used in deep learning. Its main function is to convert some low-dimensional or high-dimensional features into the same dimension to facilitate the subsequent vector dimension unification; divide different types of features, encode and vectorize the features, and obtain user embedding and video embedding, which are expressed as:

[0017] u m =[α1,α2,...,α i ,...,α M ]

[0018] e n =[β1,β2,...,β j ,...,β N ]

[0019] Among them, M and N represent the number of all user features and content features; for category features, α i is a one-hot vector. For discrete features, α i is a scalar value; when the jth feature of the content is a sparse feature, β j One-hot vector, when it is a non-categorical feature, β j is a scalar value; u m is the embedding representation of the mth user, e n is the embedding representation of the nth content;

[0020] Then the final input sequence feature vector is:

[0021] Z i =[α1,α2,...,α i ,...,α M ,β1,β2,...,βj ,...,β N ].

[0022] Furthermore, in S3, the feature vector is input into the recommendation model for training, which is specifically represented by using an LSTM neural network to learn the user feature vector and the content feature vector. The following is the process from input to output:

[0023] 1. Forget Gate

[0024] f t =σ(W f ·[h t-1 ,z t ]+b f )

[0025] The function of the forget gate is to determine the memory unit C at the previous moment. t-1 What information will be forgotten? t The output is controlled, and the value is between 0 and 1; t-1 is the hidden state vector of the previous time step, z t is the input data of the current time step

[0026] 2. Input Gate

[0027] i t =σ(W i ·[h t-1 ,z t ]+b i )

[0028]

[0029] The input gate determines which new information is written into the new memory cell; i t is the activation value of the input gate, and is a candidate new state;

[0030] 3. Update memory unit

[0031]

[0032] Update the memory unit C through the control of the forget gate and the input gate t ;

[0033] 4. Output Gate

[0034] ot=σ(W o ·[h t-1 ,z t ]+b o )

[0035] h t =ot *tanh(C t )

[0036] The output gate determines the hidden state h at the current moment t , combined with the control signal of the current memory unit and the output gate.

[0037] Furthermore, in S4, the neural network parameters in the recommendation model can be optimized by minimizing the cross entropy loss; the calculation formula of the cross entropy loss is:

[0038]

[0039] Among them, loss represents the cross entropy loss, N represents the number of training samples, represents the predicted click probability of the jth sample, y j Represents the actual click label of the user for the jth sample.

[0040] Furthermore, in S5, the sequential recommendation aims to model the impact of the interaction on the future interaction, so as to predict the user's future preference. There is a user set U and a content set I. The user-content interaction set is denoted as T, and T is organized as Each u i ∈U, In the i-th sample of T, with user u i Interacted items are represented as sequences in history and is the next item; given {U,I,T},; to achieve this goal, the following optimization problem is constructed:

[0041]

[0042] Among them, the output of model A is given by historical information T i Under the conditions of The probability of interaction, is the set of negative samples, It is from u s Randomly selected from items that have not been interacted with; if Then the label y i =1 otherwise y i =0;

[0043] To solve the sparsity problem of training data, a sampler model is introduced, denoted as S, which solves the sparsity problem of training data by generating counterfactual sequences. In the new framework, both S and A are pre-trained based on the original dataset. Then, the counterfactual sequences generated by S are used to re-optimize A, and finally A is used to provide a recommendation list.

[0044] The most intuitive heuristic sampling method is to take a certain content t in the sequenced Replace with other random content items a , and then the new sequence {t 1 ,…,t d-1 ,t a ,t d+1 ,…t l} Input into model S to get the content that may be of interest in the end at last As generated counterfactual data; introducing too much randomness in the generated sequence, resulting in a decrease in model performance;

[0045]

[0046] In the classification problem, the input feature space is divided into many sub-controls according to different output labels; the boundary between different input sub-controls is called the decision boundary; the samples near the decision boundary are considered to be more discriminative samples for the overall decision; the design of the sampler gives the unity principle, and the generated counterfactual sequence minimally changes the user's historical items and changes the current interactive items; let e t ∈R D is the embedding of content item t, and measures the change of user behavior based on the embedding space; for a given real sequence ({u,t 1 ,t 2 ,…,t l},t l+1 )∈T and index d, optimizing the following objective:

[0047]

[0048] in and is the embedding of the changed item and the original item; C represents the set of items to be replaced. In the above formula, the goal is to minimize the behavior of changing the past to change the current item; the final generated counterfactual sequence is Through this “least accurate” optimization, in the generated counterfactual sequence t a Some small changes will make the distance Not enough to change t l+1 , which means that the counterfactual sequence is close to the decision boundary.

[0049] Furthermore, in S6, the counterfactual sequence generated in S5 is re-input into the pre-trained LSTM network for training.

[0050] Furthermore, in S7, a feature vector of the user to be predicted and an input feature sequence are constructed and put into a sequence recommendation model for training to obtain a final prediction result.

[0051] The beneficial effect of the present invention is that the present invention can accurately and effectively predict user preferences, thereby improving the accuracy of user preference prediction.

[0052] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0054] Figure 1 This is a structural diagram of the sequence recommendation model in the present invention. DETAILED DESCRIPTION

[0055] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.

[0056] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.

[0057] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.

[0058] The present invention proposes a sequence recommendation method based on counterfactual data enhancement. The sequence recommendation model is as follows: Figure 1 As shown, the method includes: obtaining content data and user data; obtaining feature vectors through an embedding layer for the content data and the user data; using the feature vectors to train a sequence recommendation model to obtain a pre-trained model, using a sampler model to regenerate a counterfactual behavior sequence, and using the counterfactual sequence to retrain the model to obtain better performance.

[0059] The training process of sequence recommendation based on counterfactual data enhancement includes:

[0060] S1: Obtain the user's historical behavior data on the website. The historical behavior data includes user information and content information.

[0061] Historical behavior data comes from PC, WAP, APP, and offline data; user information includes the user's identification ID, gender, age, and access preferences; content information includes the project's identification code, project category, author, etc.

[0062] S2: Use the embedding layer to process user data and content data to obtain an embedding vector.

[0063] The embedding layer is a neural network layer commonly used in deep learning. Its main function is to convert some low-dimensional or high-dimensional features into the same dimension to facilitate the subsequent unification of vector dimensions. Different types of features are divided and encoded and vectorized to obtain user embedding and video embedding, which are expressed as:

[0064] u m =[α1,α2,...,α i ,...,α M ]

[0065] e n =[β1,β2,...,β j ,...,β N ]

[0066] Among them, M and N represent the number of all user features and content features; for category features, α i is a one-hot vector. For discrete features, α i is a scalar value. Similarly, when the jth feature of the content is a sparse feature, β j One-hot vector, when it is a non-categorical feature, β j is a scalar value. m is the embedding representation of the mth user, e n is the embedding representation of the nth content.

[0067] Then the final input sequence feature vector is:

[0068] Z i =[α1,α2,...,α i ,...,α M ,β1,β2,...,β j ,...,β N ]

[0069] S3: Input the feature vector into the recommendation model for training. Specifically, it can be expressed as using LSTM neural network to learn user feature vectors and content feature vectors. LSTM is a special recurrent neural network that is suitable for processing and predicting tasks based on time series and can better capture long-term dependencies in sequence data. The key to LSTM lies in its internal gating mechanisms (input gate, forget gate, and output gate) to help it selectively remember or forget information. The following is the formula flow from input to output:

[0070] 1. Forget Gate

[0071] f t =σ(W f ·[h t-1 ,z t ]+b f )

[0072] The function of the forget gate is to determine the memory unit C at the previous moment. t-1 What information will be forgotten? t The output of h is controlled, and the value is between 0 and 1. t-1 is the hidden state vector of the previous time step, z t Is the input data of the current time step 2. Input gate

[0073] i t =σ(W i ·[h t-1 ,z t ]+b i )

[0074]

[0075] The input gate determines what new information is written into the new memory cell. t is the activation value of the input gate, and is a candidate new state.

[0076] 3. Update memory unit

[0077]

[0078] Update the memory unit C through the control of the forget gate and the input gate t .

[0079] 4. Output Gate

[0080] ot=σ(W o ·[h t-1 ,z t ]+b o )

[0081] h t =o t *tanh(C t )

[0082] The output gate determines the hidden state h at the current moment t , which combines the control signal of the current memory cell and the output gate.

[0083] S4: The neural network parameters in the recommendation model can be optimized by minimizing the cross entropy loss. The calculation formula of the cross entropy loss is:

[0084]

[0085] S5: Introduce the sampler model to generate counterfactual sequences to solve the problem of sparse data rows. The most intuitive heuristic sampling method is to replace a certain content t in the sequence d Replace with other random content items a , and then the new sequence {t 1 ,…,t d-1 ,t a ,t d+1 ,…t l} Input into model S to get the content that may be of interest in the end at last As the generated counterfactual data. This heuristic sampler model is easy to implement. However, it has too many degrees of freedom, thus introducing too much randomness in the generated sequence, which may lead to a decrease in model performance.

[0086]

[0087] In classification problems, the input feature space can be divided into many sub-controls according to different output labels. The boundary between different input sub-controls is called the decision boundary. For samples near the decision boundary, the label can be easily changed even with a small change in the input features. Therefore, samples that are usually located near the decision boundary can be considered as samples that are more discriminative for the overall decision. The design of the sampler can give the unity principle, and the generated counterfactual sequence "minimally" changes the user's historical items so that her current interactive items can be "completely" changed. Formally, assuming e t ∈R Dis the embedding of content item t, and we measure the change of user behavior based on the embedding space. For a given real sequence ({u,t 1 ,t 2 ,…,t l},t l+1 )∈T and index d, we optimize the following objective:

[0088]

[0089] in and is the embedding of the changed term and the original term. C represents the set of terms to be replaced. In this equation, the goal is to minimize the behavior of changing the past so that the current term can be accurately changed. The resulting counterfactual sequence is Through this “least accurate” optimization, in the generated counterfactual sequence t a Some small changes will make the distance Not enough to change t l+1 , which means that the counterfactual sequence is close to the decision boundary.

[0090] S6: Use the counterfactual sequence generated in S5 to re-input it into the pre-trained LSTM network for training.

[0091] S7: Construct the feature vector of the user to be predicted and the input feature sequence, and put them into the sequence recommendation model for training to obtain the final prediction result.

[0092] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.

Claims

1. A sequence recommendation method based on counterfactual data enhancement, characterized in that: The method comprises the following steps: S1: Obtain the user's historical behavior data on the website. The historical behavior data includes user information and content information; S2: Establish user content feature vector based on historical behavior data; S3: Input the feature vector into the sequence recommendation model for training; S4: Calculate the model cross entropy loss and adjust the model parameters according to the model cross entropy loss to obtain the pre-trained recommendation model; S5: Input the original data into the sampler model to generate counterfactual sequences; S6: Retraining recommendation models using counterfactual sequences; S7: Input the user data to be predicted into the recommendation model to calculate the user's interest preference.

2. The method for sequential recommendation based on counterfactual data enhancement according to claim 1, characterized in that: In S1, the historical behavior data comes from PC, WAP, APP and offline data; the user information includes the user's identification ID, the user's gender, age and access preferences; the content information includes the identification code, project category and author of the project.

3. The method for sequential recommendation based on counterfactual data enhancement according to claim 1, characterized in that: In S2, a user content probability prediction feature vector is established. include: Clear the missing values ​​in the features, convert non-numerical features into numerical features, and use the embedding layer to process the content data and user data; the embedding layer is a neural network layer commonly used in deep learning. Its main function is to convert some low-dimensional or high-dimensional features into the same dimension to facilitate the subsequent vector dimension unification; divide different types of features, encode and vectorize the features, and obtain user embedding and video embedding, which are expressed as: u m =[α1,α2,...,α i ,...,α M ] e n =[β1,β2,...,β j ,...,β N ] Among them, M and N represent the number of all user features and content features; for category features, α i is a one-hot vector. For discrete features, α i is a scalar value; when the jth feature of the content is a sparse feature, β j One-hot vector, β for non-categorical features j is a scalar value; u m is the embedding representation of the mth user, e n is the embedded representation of the nth content; Then the final input sequence feature vector is: Z i =[α1,α2,...,α i ,...,α M ,β1,β2,...,β j ,...,β N ]。 4. The method for sequential recommendation based on counterfactual data enhancement according to claim 1, characterized in that: In S3, the feature vector is input into the recommendation model for training, which is specifically represented by using an LSTM neural network to learn the user feature vector and the content feature vector. The following is the process from input to output: (1) Forget Gate f t =σ(W f ·[h t-1 ,z t ]+b f ) The function of the forget gate is to determine the memory unit C at the previous moment. t-1 What information will be forgotten? t The output is controlled, and the value is between 0 and 1; h t-1 is the hidden state vector of the previous time step, z t is the input data of the current time step; (2) Input Gate i t =σ(W i ·[h t-1 ,z t ]+b i ) The input gate determines which new information is written into the new memory cell; i t is the activation value of the input gate, and is a candidate new state; (3) Update memory unit Update the memory unit C through the control of the forget gate and the input gate t ; (4) Output gate ot=σ(W o ·[h t-1 ,z t ]+b o ) h t =o t *tanh(C t ) The output gate determines the hidden state h at the current moment t , combined with the control signal of the current memory unit and the output gate.

5. The method for sequential recommendation based on counterfactual data enhancement according to claim 1, characterized in that: In S4, the neural network parameters in the recommendation model can be optimized by minimizing the cross entropy loss; the calculation formula of the cross entropy loss is: Among them, loss represents the cross entropy loss, N represents the number of training samples, represents the predicted click probability of the jth sample, y j Represents the actual click label of the user for the jth sample.

6. The method for sequential recommendation based on counterfactual data enhancement according to claim 1, characterized in that: In S5, the sequential recommendation aims to model the impact of the interaction on the future interaction, so as to predict the user's future preference. There is a user set U and a content set I. The user-content interaction set is denoted as T, and T is organized as Each u i ∈U, In the i-th sample of T, with user u i Interacted items are represented as sequences in history and is the next item; given {U,I,T},; to achieve this goal, the following optimization problem is constructed: Among them, the output of model A is given by historical information T i Under the conditions of The probability of interaction, is the set of negative samples, It is from u s Randomly selected from items that have not been interacted with; if Then the label y i =1 otherwise y i =0; To solve the sparsity problem of training data, a sampler model is introduced, denoted as S, which solves the sparsity problem of training data by generating counterfactual sequences. In the new framework, both S and A are pre-trained based on the original dataset. Then, the counterfactual sequences generated by S are used to re-optimize A, and finally A is used to provide a recommendation list. The most intuitive heuristic sampling method is to take a certain content t in the sequence d Replace with other random content items a , and then the new sequence {t 1 ,…,t d-1 ,t a ,t d+1 ,…t l } Input into model S to get the content that may be of interest in the end at last As generated counterfactual data; introducing too much randomness in the generated sequence, resulting in a decrease in model performance; In the classification problem, the input feature space is divided into many sub-controls according to different output labels; the boundary between different input sub-controls is called the decision boundary; the samples near the decision boundary are considered to be more discriminative samples for the overall decision; the design of the sampler gives the unity principle, and the generated counterfactual sequence minimally changes the user's historical items and changes the current interactive items; let e t ∈R D is the embedding of content item t, and measures the change of user behavior based on the embedding space; for a given real sequence ({u,t 1 ,t 2 ,…,t l },t l+1 )∈T and index d, optimizing the following objective: in and is the embedding of the changed item and the original item; C represents the set of items to be replaced. In the above formula, the goal is to minimize the behavior of changing the past to change the current item; the final generated counterfactual sequence is Through this optimization, in the generated counterfactual sequence t a Some small changes will make the distance Not enough to change t l+1 , indicating that the counterfactual sequence is close to the decision boundary.

7. The sequence recommendation method based on counterfactual data enhancement according to claim 1, characterized in that: In S6, the counterfactual sequence generated in S5 is re-input into the pre-trained LSTM network for training.

8. The sequence recommendation method based on counterfactual data enhancement according to claim 1, characterized in that: In S7, a feature vector of the user to be predicted and an input feature sequence are constructed and put into a sequence recommendation model for training to obtain a final prediction result.