Long sequence recommendation method based on denoising multi-interest logical reasoning

By constructing a logical rule-based interest extractor and a multi-interest learning strategy, the problem of interference from noisy items in long sequences is solved, the accuracy of recommendations and the consideration of multiple interests are improved, and more stable and accurate item recommendations are achieved.

CN120216775BActive Publication Date: 2025-09-23NORTHEASTERN UNIV CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510685298.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-09-23
Estimated Expiration
2045-05-27

AI Technical Summary

Technical Problem

Existing recommendation methods fail to effectively alleviate the interference of noisy items in long sequences on logical reasoning, and lack cognitive reasoning capabilities, resulting in insufficient recommendation accuracy and are usually dominated by the user's single main interest.

Method used

A logical rule-based method is constructed. By designing a logical rule-based interest extractor, preference operators are used to enhance user interest representation, and self-attention methods are combined to extract multi-faceted interest embeddings. Multi-interest learning strategies are introduced, including interest probability distribution contrast loss and interest logical reasoning contrast loss, to perform item recommendations through logical reasoning.

Benefits of technology

By designing a logical rule-based method, a logical rule-based interest extractor is designed, preference operators are used to enhance user interest representation, and self-attention methods are combined to extract users' multi-faceted interest embeddings. Item recommendations are made through logical reasoning, which solves the problem of interference from noisy items in long sequences and improves the accuracy of recommendations and the consideration of multiple interests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216775B_ABST
    Figure CN120216775B_ABST
Patent Text Reader

Abstract

The present invention discloses a long sequence recommendation method based on denoising multi-interest logical reasoning, which relates to the field of data mining technology. The present invention defines two preference operators, and defines a mapping function based on logical rules for the two preference operators to obtain the preference probability embedding of the corresponding items, and uses the self-attention mechanism to extract the user interest embedding. Finally, logical reasoning is performed based on the obtained user interest embedding to recommend the next item, thereby avoiding the negative impact of noise items on logical reasoning and improving the accuracy of recommendation. A multi-interest learning strategy is designed, including IPD contrast loss and ILR contrast loss. The function of IPD contrast loss is to require the items to be as close as possible to the multi-interest probability distribution space, rather than just the probability distribution of a single interest. The function of ILR contrast loss is to ensure that the user's multiple interests can be considered during logical reasoning, rather than just focusing on their main interests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data mining technology, and in particular relates to a long sequence recommendation method based on denoising multi-interest logical reasoning. Background Art

[0002] Recommendation systems require both matching and cognitive reasoning capabilities, as users' future behavior depends not only on similarity matching with past interactions but also on the cognitive reasoning process from past interactions to future behavior. Recommendation methods based on logical reasoning use logical operators (including intersection, union, negation, and implication) on interacting items and incorporate logical rules into model learning to improve recommendation accuracy.

[0003] Existing recommendation methods based on logical reasoning can be roughly divided into two categories: methods that learn embedding representations based on logical rules and methods that convert the recommendation problem into a logical reasoning problem. The first category of methods uses first-order logic rules to accurately learn embedding representations for users and items. For example, Spillo et al. proposed a knowledge-aware recommendation method based on neural symbolic graph embedding and first-order logic rules. This method first extracts first-order logic rules from a knowledge graph and then learns embedding representations for users and items based on triples in the knowledge graph and the extracted logical rules. Furthermore, Yuan et al. proposed a sequential recommendation method with probabilistic logical reasoning (SR-PLR), which introduced probabilistic embeddings based on first-order logic rules into the sequential recommendation model, thereby improving recommendation accuracy. The second category of methods directly utilizes logical reasoning to solve the recommendation problem. For example, Shi et al. proposed a neural logic reasoning method (NLR), which converts the recommendation problem into a propositional logic problem. Using logical operations and rules, it performs logical reasoning on items in an interaction sequence to predict the next item that the user may be interested in. In contrast, Chen et al. proposed the Neural Collaborative Reasoning (NCR) method, which first models the relationship between users and items in an interaction sequence (such as purchase behavior) and then explicitly incorporates users' emotional tendencies (such as likes or dislikes) for logical reasoning, thereby achieving personalized recommendations. This method effectively enhances the recommendation system's ability to understand user preferences and further improves recommendation effectiveness. However, these methods have not yet explored the negative impact of noisy items in long interaction sequences on recommendation accuracy, nor have they considered users' multiple interests and preferences in long sequences.

[0004] Some studies have used heuristic methods, unsupervised learning, and community mining to capture multiple interests from user interaction sequences. Sabour et al. proposed a Multi-Interest Network with Dynamic Routing (MIND) algorithm and designed a multi-interest extractor based on a dynamic routing mechanism to model and extract multiple interests from interaction sequences. Cen et al. proposed a Controllable Multi-interest Framework for Sequential Recommendation (ComiRec), which uses a self-attention method to capture users' multiple interests from interaction sequences and introduces a controllable factor to balance the accuracy and diversity of recommendations. However, these methods cannot address the negative impact of noise on recommendation accuracy and lack cognitive reasoning capabilities. Summary of the Invention

[0005] In response to the shortcomings of the existing technology, the present invention provides a long sequence recommendation method based on denoising multi-interest logical reasoning, aiming to effectively alleviate the interference of noisy items in long sequences on logical reasoning, while overcoming the limitations of existing methods that are usually dominated by the user's single main interest, thereby improving the accuracy of recommendations.

[0006] The technical solution of the present invention is:

[0007] A long sequence recommendation method based on denoising multi-interest logical reasoning includes the following steps:

[0008] A logical rule-based interest extractor is constructed; the logical rule-based interest extractor is used to derive an embedded representation of the user's interests through an input interaction sequence, thereby obtaining a multifaceted interest embedding matrix of the user; the interaction sequence is a sequence used to represent the user's historical interaction items, including interaction items at different times, each interaction item being an embedded representation of an item interacted with by the user.

[0009] Construct an item recommendation model based on multi-interest logical reasoning; the item recommendation model based on multi-interest logical reasoning is used to recommend items to users based on the user's multi-faceted interest embedding matrix.

[0010] The multi-interest learning strategy is used to train the interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning, and the trained interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning are obtained.

[0011] Item recommendations are performed using the trained interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning to obtain item recommendation results.

[0012] Furthermore, the process of deriving the embedded representation of user interests through the input interaction sequence is as follows:

[0013] First, we determine whether the user likes the item based on the user's rating of the item. That is, if the item's rating is greater than the set threshold, it means the user likes the item; otherwise, the user dislikes the item. The user's rating is converted into a binary label to represent the user's two emotions towards the item: like or dislike. If the user For items If the score of the item is greater than the set threshold, then the item The binary label Otherwise, the item The binary label ; Based on binary labels , define two preference operators: and ,when When using the preference operator Increase the importance of the item in constructing the embedding representation of user interests; when When using the preference operator Reduce the importance of the item in constructing the embedding representation of user interests, specifically by adding a preference operator and Define mapping functions based on logical rules respectively and , and use mapping functions based on logical rules and Obtain the item preference probability embedding implementation, where, represents the embedding representation of an item, Represents the dimension of the embedding representation of the item; then the self-attention method is used to extract the embedding representation of the user's interest from the preference probability embedding of the item.

[0014] Furthermore, the method for constructing the item preference probability embedding is:

[0015] When a user likes an item When using a mapping function based on logical rules To obtain items Preference probability embedding:

[0016] (4);

[0017] in, Indicates items The embedding representation of Indicates that the user likes the item When, items The preference probability embedding of represents a multilayer perceptron, represents the number of the Beta distribution and , and For the The shape parameter of the Beta distribution.

[0018] When a user dislikes an item When using a mapping function based on logical rules To obtain items Preference probability embedding:

[0019] (5);

[0020] in, Indicates that the user does not like the item When, items The preference probability embedding of Yes or No logical operator The corresponding probability negation operator.

[0021] Furthermore, the method of extracting the embedding representation of user interests from the preference probability embedding of items using the self-attention method is specifically as follows:

[0022] For interactive sequences ,in, Indicates the users, Indicates the user's ID. Indicates the items The embedding representation of Indicates the item number. Representing an interaction sequence The number of interaction terms in ; According to formula (4) and formula (5), the interaction sequence is obtained The preference probability of all items in is embedded as ,in, Represents a mapping function based on logical rules or , calculate the preference probability embedding of all items A set of attention weight vectors:

[0023] (6);

[0024] (7);

[0025] in, and Represents the preference probability embedding of all items middle Partial matrix and Part of the matrix, They are of Partial and part, and For the The shape parameter of the Beta distribution; express The attention weight vector, express The attention weight vector, represents the softmax function, 、 and are trainable parameters, represents the dimension of the attention weight vector, Represents the matrix transpose symbol.

[0026] Then calculate the preference fusion embedding for each item:

[0027] When a user likes an item When , its preference fusion embedding is:

[0028] (8);

[0029] When a user dislikes an item When , its preference fusion embedding is:

[0030] (9);

[0031] in, Indicates items Preference fusion embedding.

[0032] According to the preference fusion embedding of each item, the user's preference fusion embedding matrix is ​​obtained: , Represents a user The preference fusion embedding matrix of .

[0033] Based on the obtained set of attention weight vectors and For users The preference fusion embedding matrix is ​​weighted summed to obtain the user An embedded representation of interest , as follows:

[0034] (10);

[0035] (11);

[0036] (12);

[0037] in, and They are respectively the embedding representation of interest middle The embedding vectors of the parts and Part of the embedding vector, is the activation function.

[0038] Furthermore, the method for obtaining the user's multi-faceted interest embedding matrix is:

[0039] The attention weight vectors in (6) and (7) are and from Dimension expanded to dimensional attention weight matrix and ,in and is a trainable parameter matrix. At the same time, repeating equations (10), (11) and (12) to obtain the user's multifaceted interest embedding matrix , Indicates user The embedding representation of interest, is the ID of the user's interest, is the number of user interests.

[0040] Furthermore, the process of the item recommendation model based on multi-interest logical reasoning is specifically as follows:

[0041] First, we use the user's multi-faceted interest embedding matrix obtained from the logic rule-based interest extractor Constructing embedded representations of logical expressions :

[0042] (13);

[0043] in, is the embedded representation of the logical expression; represents candidate items, is the embedding representation of the candidate item, Indicates implication.

[0044] Then, the embedding representation of the logical expression is is equivalent to:

[0045] (14);

[0046] in, Represents the NOT logical operator, Represents the logical operator, Represents the OR logical operator; then, the logical operator 、 and They are regarded as a multi-layer perceptron, respectively: and ; The input vector is , the output vector is ; and Both accept two input vectors and , and get the output vectors respectively and the output vector .

[0047] Finally, by evaluating the embedding representation of the logical expression and truth value Embedded representation of similarity to decide whether to recommend the target item , as follows:

[0048] (15);

[0049] in, Indicates the recommended target item. Represents a set of candidate items, similarity measurement function Embedded representation for evaluating logical expressions and truth value Embedded representation of The similarity between is the true value, True value Embedding representation of .

[0050] Furthermore, the multi-interest learning strategy utilizes the training loss function The interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning are trained, and the loss function of the training is The construction process is:

[0051] Embedding representation of each interest The probability density function of is defined as:

[0052] (16);

[0053] in, Embedding representation of interest The probability density function of represents the probability density function input value, yes function, and Show interest The corresponding The shape parameter of the Beta distribution.

[0054] The probability density function of is defined as:

[0055] (17);

[0056] in, for The probability density function of , , and For interest The corresponding The shape parameter of the Beta distribution; Embedding representation of interest The weight of , It is a multi-level perception. and Embedding representations of interests middle The embedding vectors of the parts and Part of the embedding vector, The ID of the user's interest.

[0057] Define target items Embedded representation of Embedded representation of user interests The KL divergence distance between:

[0058] (18);

[0059] in, Indicates the target item Embedded representation of Embedded representation of user interests The KL divergence distance between represents the KL divergence distance function, , and Target item The corresponding The shape parameter of the Beta distribution, .

[0060] Calculate target items Embedded representation of Embedding matrix with user's multifaceted interests The KL divergence distance between:

[0061] (19);

[0062] in, Indicates the target item Embedded representation of Embedding matrix with user's multifaceted interests The KL divergence distance between .

[0063] Constructing the contrast loss of interest probability distribution is:

[0064] (20);

[0065] in, is the contrastive loss of the probability distribution of interest, , and is the KL divergence distance vector, is a preset interval hyperparameter, is an embedding representation of a negative sample, Embedding representation of negative samples and user's multi-faceted interest embedding matrix The KL divergence distance between them.

[0066] Constructing the interest logic reasoning contrast loss is:

[0067] (twenty one);

[0068] in, represents the contrastive loss of interest logic reasoning, , embedded representation of logical expressions , Embedded representation of logical expressions and the embedding representation of the true value The similarity between Embedded representation of logical expressions and the embedding representation of the true value Similarity between, embedded representation of logical expressions Defined as , Embedded representation of logical expressions and the embedding representation of the true value similarity between is a preset hyperparameter.

[0069] Construct the logistic regularization loss as:

[0070] (twenty two);

[0071] in, is the logistic regularization loss, is the logistic regularization term, is the number of the logistic regularization term.

[0072] Training loss function Defined as:

[0073] (twenty three);

[0074] in, is the loss function for training in the multi-interest learning strategy, , , and is the preset parameter, Parameters for the interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning, is the two-norm.

[0075] Compared with the prior art, the present invention has the following beneficial effects:

[0076] Logical neural network architectures offer two significant advantages: modularity and logical regularization. Modularity refers to the dynamic assembly of neural network architectures based on logical expressions, where each logical operation corresponds to a lightweight neural network module. These network modules adapt their structure based on user interactions and preferences (e.g., likes and dislikes), accurately learning latent embeddings of user interests. Furthermore, logical regularization further improves the accuracy of learned interest embeddings by imposing constraints on the neural network using prior knowledge of logical rules.

[0077] Two preference operators are introduced to enhance the influence of preferred terms on interest representation and effectively suppress the interference of disliked terms, which helps reduce the negative impact of noise terms on learning user interests. In the process of learning interest embedding, the introduction of IPD and ILR contrastive losses avoids the limitation of the model learning only a single interest embedding, promotes the learning of multiple user interests, and improves the quality of multi-interest embedding learning. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1This is a framework diagram of a long sequence recommendation method based on denoising multi-interest logical reasoning in an embodiment of the present invention. DETAILED DESCRIPTION

[0079] The present invention is described in detail below with reference to the accompanying drawings and embodiments.

[0080] This paper first designs a logic-based interest extractor to enhance the importance of user-preferred items when constructing user interests, while reducing the negative impact of items that users dislike. Two preference operators are defined: It is mainly used to enhance the influence of user preference items in building user interests; It is used to reduce the impact of users' dislike of items. This design effectively alleviates the interference of noisy items on user interest modeling. Next, a mapping function based on logical rules is defined for the two preference operators to obtain the preference probability embeddings of the corresponding items. In the item preference probability distribution space, the self-attention mechanism is used to extract the user interest embedding. Finally, logical reasoning is performed based on the obtained user interest embedding to recommend the next item, thereby avoiding the negative impact of noisy items on logical reasoning and improving the accuracy of recommendations. In addition, in order to fully consider the user's multiple interests in the logical reasoning process, a multi-interest learning strategy is designed, which includes interest probability distribution (IPD) contrast loss and interest logical reasoning (ILR) contrast loss. The function of IPD contrast loss is to require items to be as close as possible to the multi-interest probability distribution space, rather than just the probability distribution of a single interest. The function of ILR contrast loss is to ensure that the user's multiple interests can be considered during logical reasoning, rather than focusing only on their main interest. This invention performs more stably and accurately on long sequence recommendation tasks.

[0081] A long sequence recommendation method based on denoising multi-interest logical reasoning, such as Figure 1 As shown, the following steps are included:

[0082] Step 1: Build a logical rule-based interest extractor.

[0083] Noise items in interaction sequences can adversely affect the logical reasoning of recommendation methods. By inferring user interests from interaction items, the negative impact of noise items can be effectively mitigated. Therefore, a logical rule-based interest extractor is proposed to derive an embedded representation of user interests through the input interaction sequence, thereby obtaining the user's multifaceted interest embedding matrix; the interaction sequence is a sequence used to represent the user's historical interaction items, which includes interaction items at different times, and each interaction item is an embedded representation of the item with which the user interacted.

[0084] Specifically, the process of deriving the embedded representation of user interests through the input interaction sequence is as follows:

[0085] First, we determine whether the user likes the item based on the user's rating of the item. That is, if the rating of the item is greater than 3, it means that the user likes the item; otherwise, the user does not like the item. The user's rating is converted into a binary label to represent the user's two emotions towards the item: like or dislike. If the user For items If the score is greater than 3, then the item The binary label Otherwise, the item The binary label ; Based on binary labels , define two preference operators: and ,when When using the preference operator Increase the importance of the item in constructing the embedding representation of user interests; when When using the preference operator Reduce the importance of the item in constructing the embedding representation of user interests, specifically by adding a preference operator and Define mapping functions based on logical rules respectively and , and use mapping functions based on logical rules and Obtain the item preference probability embedding implementation, where, represents the embedding representation of an item, Represents the dimension of the embedding representation of the item; then the self-attention method is used to extract the embedding representation of the user's interest from the preference probability embedding of the item.

[0086] The mapping function based on logical rules and Satisfying the double negation and idempotence in the logic rules, which can be expressed in mathematical language as follows:

[0087] (1);

[0088] (2);

[0089] (3);

[0090] in, Represents the NOT logical operator, Represents the logical operator, represents the OR logical operator; the above equation guarantees the mapping function based on the logical rules and Follow the double negation and idempotence in logical reasoning.

[0091] Mapping functions based on logical rules and Obtain preference probability embeddings from the item embedding representation following multiple independent Beta distributions, where the Beta distribution has two shape parameters , multiple independent Beta distributions can capture the user's multi-faceted interests in items. , and the construction method of its preference probability embedding is:

[0092] When a user likes an item When using a mapping function based on logical rules To obtain items Preference probability embedding:

[0093] (4);

[0094] in, Indicates items The embedding representation of Indicates that the user likes the item When, items The preference probability embedding of represents a multilayer perceptron, represents the number of the Beta distribution and , and For the The shape parameter of the Beta distribution, and The setting follows the range specified in the BetaE model proposed by Ren et al.

[0095] When a user dislikes an item When using a mapping function based on logical rules To obtain items Preference probability embedding:

[0096] (5);

[0097] in, Indicates that the user does not like the item When, items The preference probability embedding of Yes or No logical operator The corresponding probability negation operator.

[0098] The method of extracting the embedding representation of user interests from the item preference probability embedding using the self-attention method is specifically as follows:

[0099] For interactive sequences ,in, Indicates the users, Indicates the user's ID. Indicates the items The embedding representation of Indicates the item number. Representing an interaction sequence The number of interaction terms in ; According to formula (4) and formula (5), the interaction sequence is obtained The preference probability of all items in is embedded as , where, without loss of generality, Represents a mapping function based on logical rules or , and calculate the preference probability embedding of all items as follows A set of attention weight vectors:

[0100] (6);

[0101] (7);

[0102] in, and Represents the preference probability embedding of all items middle Partial matrix and Part of the matrix, They are of Partial and part, and For the The shape parameter of the Beta distribution; express The attention weight vector, express The attention weight vector, represents the softmax function, 、 and are trainable parameters, represents the dimension of the attention weight vector, Represents the matrix transpose symbol.

[0103] Then calculate the preference fusion embedding for each item:

[0104] When a user likes an item When , its preference fusion embedding is:

[0105] (8);

[0106] When a user dislikes an item When , its preference fusion embedding is:

[0107] (9);

[0108] in, Indicates items Preference fusion embedding.

[0109] According to the preference fusion embedding of each item, the user's preference fusion embedding matrix is ​​obtained: , Represents a user The preference fusion embedding matrix of .

[0110] Based on the obtained set of attention weight vectors and For users The preference fusion embedding matrix is ​​weighted summed to obtain the user An embedded representation of interest , as follows:

[0111] (10);

[0112] (11);

[0113] (12);

[0114] in, and They are respectively the embedding representation of interest middle The embedding vectors of the parts and Part of the embedding vector, is the activation function.

[0115] In order to capture the user’s diverse interests, the present invention transforms the attention weight vectors in Equations (6) and (7) into and from Dimension expanded to dimensional attention weight matrix and ,in and is a trainable parameter matrix. At the same time, repeating equations (10), (11) and (12) to obtain the user's multifaceted interest embedding matrix , Indicates user The embedding representation of interest, is the ID of the user's interest, is the number of user interests.

[0116] Step 2: Build an item recommendation model based on multi-interest logical reasoning.

[0117] The item recommendation model based on multi-interest logical reasoning is used to recommend items to users based on the user's multi-faceted interest embedding matrix.

[0118] For interactive sequences , the present invention adopts Horn clause to recommend the problem: Transformed into a logical reasoning problem, where Indicates the recommended target item. represents candidate items, represents the set of candidate items, Represents a recommendation decision function based on user interaction sequences; unlike NCR, which constructs Horn clauses directly based on interaction sequences, the present invention uses interest embeddings extracted from interaction sequences to construct Horn clauses, thereby effectively alleviating the negative impact of noise terms in interaction sequences on logical reasoning.

[0119] Specifically, we first embed the user's multi-faceted interest matrix obtained from the logic rule-based interest extractor. Constructing embedded representations of logical expressions , as shown below:

[0120] (13);

[0121] in, is the embedded representation of the logical expression; represents candidate items, is the embedding representation of the candidate item, To express implication, Equation (13) represents the embedding representation of the logical expression obtained by logical reasoning on the user's multi-faceted interest embedding and the candidate item embedding.

[0122] Then, the embedding representation of the logical expression is is equivalent to:

[0123] (14);

[0124] in, Represents the NOT logical operator, Represents the logical operator, Represents the OR logical operator; then, the logical operator 、 and They are regarded as a multi-layer perceptron, respectively: and ; The input vector is , the output vector is ; and Both accept two input vectors and , and get the output vectors respectively and the output vector , similar to NLR and NCR, constraints are imposed on these multilayer perceptrons through a logistic regularizer to ensure that they comply with the basic logical rules of logical operators.

[0125] Finally, by evaluating the embedding representation of the logical expression and truth value Embedded representation of similarity to decide whether to recommend the target item , as follows:

[0126] (15);

[0127] Among them, the similarity measurement function Embedded representation for evaluating logical expressions and truth value Embedded representation of The similarity between is the true value, True value Embedding representation, true value Embedded representation of Randomly initialized and not updated during model learning.

[0128] Step 3: Use the multi-interest learning strategy to train the interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning to ensure that in the logical reasoning process, not only the user's single interest is paid attention to, but also the user's multiple interests are considered at the same time, and the trained interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning are obtained.

[0129] Specifically, the embedding representation of each interest The probability density function of is defined as:

[0130] (16);

[0131] in, Embedding representation of interest The probability density function of represents the probability density function input value, yes function, and Show interest The corresponding The shape parameter of the Beta distribution.

[0132] The logic rule-based interest extractor in this invention adopts the self-attention method to learn the multi-faceted interest embedding matrix The importance of each interest in Embedding representation of interest The weight of , It is a multi-level perception. and Embedding representations of interests middle The embedding vectors of the parts and Part of the embedding vector, The ID of the user's interest.

[0133] The probability density function of is defined as:

[0134] (17);

[0135] in, for The probability density function of , , and For interest The corresponding The shape parameter of the Beta distribution.

[0136] Define target items Embedded representation of Embedded representation of user interests The KL divergence distance between the target items As close as possible to the user's interests :

[0137] (18);

[0138] in, Indicates the target item Embedded representation of Embedded representation of user interests The KL divergence distance between represents the KL divergence distance function, , and Target item The corresponding The shape parameter of the Beta distribution, .

[0139] At the same time, in order to make the target items As close as possible to various interests, calculate the target items Embedded representation of Embedding matrix with user's multifaceted interests The KL divergence distance between:

[0140] (19);

[0141] in, Indicates the target item Embedded representation of Embedding matrix with user's multifaceted interests The KL divergence distance between .

[0142] The present invention designs an interest contrast loss to ensure that multiple user interests are considered simultaneously during the logical reasoning process. The interest contrast loss includes the interest probability distribution (IPD) contrast loss and the interest logical reasoning (ILR) contrast loss. The interest probability distribution (IPD) contrast loss requires that in the interest probability distribution space, Greater than , and Greater than ,in, is an embedding representation of a negative sample, Embedding representation of negative samples and user's multi-faceted interest embedding matrix The KL divergence distance between them.

[0143] Construct the interest probability distribution (IPD) contrast loss as:

[0144] (20);

[0145] in, is the contrastive loss of the probability distribution of interest, , and is the KL divergence distance vector, Is a preset interval hyperparameter, here, using the formula Instead of the formula The summation of the mean reduces the computational complexity while ensuring .

[0146] Interest Logical Reasoning (ILR) contrast loss requires that the logical reasoning results based on multiple interests are closer to the true value than the results based on a single interest, and the logical reasoning results based on multiple interests are closer to the true value than the logical reasoning results of negative samples. The mathematical expression of the Interest Logical Reasoning (ILR) contrast loss is:

[0147] (twenty one);

[0148] in, represents the contrastive loss of interest logic reasoning, , embedded representation of logical expressions , Embedded representation of logical expressions and the embedding representation of the true value The similarity between Embedded representation of logical expressions and the embedding representation of the true value Similarity between, embedded representation of logical expressions Defined as , Embedded representation of logical expressions and the embedding representation of the true value similarity between is the preset hyperparameter, here, use To reduce computational complexity and ensure .

[0149] During training, the logistic regularization term is used make sure and Following the logic rule, the logistic regularization loss is as follows:

[0150] (twenty two);

[0151] in, is the logistic regularization loss, is the logical regularization term, and its specific description is shown in Table 1. is the number of the logistic regularization term.

[0152] Table 1 Description of logical regularization terms;

[0153]

[0154] In Table 1, is a logical expression, and , is a logical expression Logical variables in, for example or wait, represents the embedded representation of logical variables, F False value, false value F The embedding representation is a vector .

[0155] The logistic regularization loss , IPD contrast loss Combined with ILR contrast loss for training, the norm is introduced to constrain the size of parameters to prevent overfitting of the model. The loss function of training is defined as:

[0156] (twenty three);

[0157] in, is the loss function for training in the multi-interest learning strategy, , , and is the preset parameter, Parameters for the interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning, is the bi-norm, which is used to constrain the parameters of the interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning.

[0158] Step 4: Use the trained interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning to recommend items and obtain the item recommendation results.

[0159] In this example, extensive experiments were conducted on two public datasets, MovieLens 1M (ML-1M) and Movies and TV (MoTV), to compare the recommendation accuracy of six methods. These datasets contain user IDs, item IDs, and rating information. Sequence lengths for the ML-1M and MoTV datasets range from 10, 50, and 100. Sequence length in a dataset represents the number of items a user has interacted with in the recent past. The recommendation performance of these methods was evaluated using the NDCG@5, NDCG@10, HR@5, and HR@10 metrics. In Tables 2-5, the best results are shown in bold, and the strongest baseline results are underlined.

[0160] Table 2 NDCG@5 and HR@5 results of the proposed method and five baseline methods on the ML-1M dataset;

[0161]

[0162] Table 3 NDCG@10 and HR@10 results of the proposed method and five baseline methods on the ML-1M dataset;

[0163]

[0164] Table 4 NDCG@5 and HR@5 results of the proposed method and five baseline methods on the MoTV dataset;

[0165]

[0166] Table 5 NDCG@10 and HR@10 results of the proposed method and five baseline methods on the MoTV dataset;

[0167]

[0168] The results in Tables 2 to 5 show that the proposed method outperforms the five baseline methods in terms of NDCG@5 and NDCG@10 metrics across all datasets. On the ML-1M dataset with a sequence length of 100, the proposed method's HR@5 and HR@10 are slightly lower than those of GRU4Rec and NARM, likely due to excessive noise items interfering with the extraction of interest embeddings. Traditional sequence recommendation methods such as STAMP, GRU4Rec, and NARM are less affected by variations in sequence length, but their overall recommendation performance on both datasets is lower than that of the proposed method and NCR. For the ML-1M and MoTV datasets, the recommendation performance of NLR and NCR decreases significantly as the sequence length increases from 10 to 100. Compared to NLR and NCR, the proposed method effectively overcomes the adverse effects of noise items in long sequences on interest modeling. Therefore, the proposed method exhibits superior recommendation performance and robustness.

Claims

1. A long sequence recommendation method based on denoising multi-interest logical reasoning, characterized by: The following steps are involved: Constructing a logic rule-based interest extractor; the logic rule-based interest extractor is used to derive an embedded representation of the user's interests from an input interaction sequence, thereby obtaining a multifaceted interest embedding matrix for the user; the interaction sequence is a sequence representing the user's historical interaction items, including interaction items at different moments, each interaction item being an embedded representation of an item with which the user interacted; Constructing an item recommendation model based on multi-interest logical reasoning; the item recommendation model based on multi-interest logical reasoning is used to recommend items to users based on the user's multi-faceted interest embedding matrix; The multi-interest learning strategy is used to train the interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning, and the trained interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning are obtained; Utilize the trained interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning to recommend items and obtain the item recommendation results; The multi-interest learning strategy uses the training loss function The interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning are trained, and the loss function of the training is The construction process is: Embedding representation of each interest The probability density function of is defined as: (16); in, represents the dimension of the embedding representation of the item, Embedding representation of interest The probability density function of represents the probability density function input value, yes function, and Show interest The corresponding The shape parameter of the Beta distribution; The probability density function of is defined as: (17); in, is the ID of the user's interest, is the number of user interests, Embedding matrix for users’ multifaceted interests, for The probability density function of , , and For interest The corresponding The shape parameter of the Beta distribution; Embedding representation of interest The weight of , It is a multi-level perception. and Embedding representations of interests middle The embedding vectors of the parts and Part of the embedding vector, The ID of the user's interest; Define target items Embedded representation of Embedded representation of user interests The KL divergence distance between: (18); in, Indicates the target item Embedded representation of Embedded representation of user interests The KL divergence distance between represents the KL divergence distance function, , and Target item The corresponding The shape parameter of the Beta distribution, ; Calculate target items Embedded representation of Embedding matrix with user's multifaceted interests The KL divergence distance between: (19); in, Indicates the target item Embedded representation of Embedding matrix with user's multifaceted interests The KL divergence distance between ; Constructing the contrast loss of interest probability distribution is: (20); in, is the contrastive loss of the probability distribution of interest, , and is the KL divergence distance vector, is a preset interval hyperparameter, is an embedding representation of a negative sample, Embedding representation of negative samples and user's multi-faceted interest embedding matrix The KL divergence distance between them; Constructing the interest logic reasoning contrast loss is: (21); in, represents the contrastive loss of interest logic reasoning, , embedded representation of logical expressions , Embedded representation of logical expressions and the embedding representation of the true value The similarity between Embedded representation of logical expressions and the embedding representation of the true value Similarity between, embedded representation of logical expressions Defined as , Embedded representation of logical expressions and the embedding representation of the true value similarity between is a preset hyperparameter; Construct the logistic regularization loss as: (22); in, is the logistic regularization loss, is the logistic regularization term, is the number of the logistic regularization term; Training loss function Defined as: (23); in, is the loss function for training in the multi-interest learning strategy, , , and is the preset parameter, Parameters for the interest extractor based on logical rules and the item recommendation model based on multi-interest logical reasoning, is the two-norm.

2. The long sequence recommendation method based on denoising multi-interest logical reasoning according to claim 1 is characterized in that: The process of deriving the embedded representation of user interests through the input interaction sequence is as follows: First, we determine whether the user likes the item based on the user's rating of the item. That is, if the item's rating is greater than the set threshold, it means the user likes the item; otherwise, the user dislikes the item. The user's rating is converted into a binary label to represent the user's two emotions towards the item: like or dislike. If the user For items If the score of the item is greater than the set threshold, then the item The binary label Otherwise, the item The binary label ; Based on binary labels , define two preference operators: and ,when When using the preference operator Increase the importance of the item in constructing the embedding representation of user interests; when When using the preference operator Reduce the importance of the item in constructing the embedding representation of user interests, specifically by adding a preference operator and Define mapping functions based on logical rules respectively and , and use mapping functions based on logical rules and Obtain the item preference probability embedding implementation, where, represents the embedding representation of an item, Represents the dimension of the embedding representation of the item; then the self-attention method is used to extract the embedding representation of the user's interest from the preference probability embedding of the item.

3. The long sequence recommendation method based on denoising multi-interest logical reasoning according to claim 2 is characterized in that: The method for constructing the preference probability embedding of the item is: When a user likes an item When using a mapping function based on logical rules To obtain items Preference probability embedding: (4); in, Indicates items The embedding representation of Indicates that the user likes the item When, items The preference probability embedding of represents a multilayer perceptron, represents the number of the Beta distribution and , and For the The shape parameter of the Beta distribution; When a user dislikes an item When using a mapping function based on logical rules To obtain items Preference probability embedding: (5); in, Indicates that the user does not like the item When, items The preference probability embedding of Yes or No logical operator The corresponding probability negation operator.

4. The long sequence recommendation method based on denoising multi-interest logical reasoning according to claim 3 is characterized in that: The method of extracting the embedding representation of user interests from the item preference probability embedding using the self-attention method is specifically as follows: For interactive sequences ,in, Indicates the users, Indicates the user's ID. Indicates the items The embedding representation of Indicates the item number. Representing an interaction sequence The number of interaction terms in ; According to formula (4) and formula (5), the interaction sequence is obtained The preference probability of all items in is embedded as ,in, Represents a mapping function based on logical rules or , calculate the preference probability embedding of all items A set of attention weight vectors: (6); (7); in, and Represents the preference probability embedding of all items middle Partial matrix and Part of the matrix, They are of Partial and part, and For the The shape parameter of the Beta distribution; express The attention weight vector, express The attention weight vector, represents the softmax function, 、 and are trainable parameters, represents the dimension of the attention weight vector, Represents the matrix transpose symbol; Then calculate the preference fusion embedding for each item: When a user likes an item When , its preference fusion embedding is: (8); When a user dislikes an item When , its preference fusion embedding is: (9); in, Indicates items Preference fusion embedding; According to the preference fusion embedding of each item, the user's preference fusion embedding matrix is ​​obtained: , Represents a user The preference fusion embedding matrix of Based on the obtained set of attention weight vectors and For users The preference fusion embedding matrix is ​​weighted summed to obtain the user An embedded representation of interest , as follows: (10); (11); (12); in, and They are respectively the embedding representation of interest middle The embedding vectors of the parts and Part of the embedding vector, is the activation function.

5. The long sequence recommendation method based on denoising multi-interest logical reasoning according to claim 4 is characterized in that: The method for obtaining the user's multifaceted interest embedding matrix is: The attention weight vectors in (6) and (7) are and from Dimension expanded to dimensional attention weight matrix and ,in and is a trainable parameter matrix. At the same time, repeating equations (10), (11) and (12) to obtain the user's multifaceted interest embedding matrix , Indicates user The embedding representation of interest, is the ID of the user's interest, is the number of user interests.

6. The long sequence recommendation method based on denoising multi-interest logical reasoning according to claim 5 is characterized in that: The process of the item recommendation model based on multi-interest logical reasoning is specifically as follows: First, we use the user's multi-faceted interest embedding matrix obtained from the logic rule-based interest extractor Constructing embedded representations of logical expressions : (13); in, is the embedded representation of the logical expression; represents candidate items, is the embedding representation of the candidate item, expresses implication; Then, the embedding representation of the logical expression is is equivalent to: (14); in, Represents the NOT logical operator, Represents the logical operator, Represents the OR logical operator; then, the logical operator 、 and They are regarded as a multi-layer perceptron, respectively: and ; The input vector is , the output vector is ; and Both accept two input vectors and , and get the output vectors respectively and the output vector ; Finally, by evaluating the embedding representation of the logical expression and truth value Embedded representation of similarity to decide whether to recommend the target item , as follows: (15); in, Indicates the recommended target item. Represents a set of candidate items, similarity measurement function Embedded representation for evaluating logical expressions and truth value Embedded representation of The similarity between is the true value, True value Embedding representation of .