User emotion and opinion consistent interpretable recommendation method and system
Through the combination of the emotion-opinion alignment module and the Sentires toolkit, detailed recommendation explanation text is generated, which solves the problem that the existing recommendation system cannot explain and accurately represent the user's multi-faceted emotions, and improves the performance and user satisfaction of the recommendation system.
Patent Information
- Application Number
- CN202410753849.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2024-09-06
AI Technical Summary
Existing recommendation systems cannot effectively explain recommendation results, and cannot accurately learn users' emotional expressions of multiple aspects of a product, resulting in a lack of detailed and personalized explanation content.
By introducing the emotion-opinion alignment module, using the Sentires toolkit to extract product features and user opinions, constructing a user-item-feature preference rating matrix, and encoding the emotion representation into the opinion representation, through the encoder-decoder structure and attention The mechanism generates explanatory text, ensuring consistency of sentiments and opinions.
Significantly improves the performance of recommendation systems and the quality of explanation texts, provides more personalized and detailed recommendation explanations, and enhances user experience and satisfaction.
Smart Images

Figure CN118608244A
Abstract
Description
Technical Field
[0001] The present invention relates to an explainable recommendation method, and in particular to an explainable recommendation method and system in which user emotions and opinions are consistent. Background Art
[0002] Recommender systems play an important role in many online application platforms. They provide recommendations to help users choose the most relevant items based on their preferences. In various literatures, various recommendation algorithms have been proposed, such as user / item-based collaborative filtering, matrix factorization, and deep neural networks. However, traditional recommendation methods cannot explain the recommendation results to users. Recently, researchers have studied explainable recommender systems. Explainable recommender systems can not only provide users with a list of recommendations, but also intuitively explain why these items are recommended. Most importantly, these explanations help improve the transparency, persuasiveness, effectiveness, credibility, and satisfaction of the recommendation system.
[0003] To improve the performance of explainable recommender systems, recent work has focused on using user reviews for sentiment analysis. Some methods use the predicted ratings of the recommendation module to adjust the sentiment of the generated explanations. However, even in a highly rated review, the user may be dissatisfied with a certain aspect of the product. For example, in a shopping review on an e-commerce website, a user gave a high rating to the craftsmanship of the purchased sweater, but complained about the material of the sweater. Recently, some methods take into account that users may have opinions on multiple aspects of a product. They represent sentiment as polarity. For example, in a movie recommendation system, users comment on different aspects of a movie (e.g., actors, plot, visual effects) and express their sentiment (positive or negative) on these aspects in their comments. These methods use corresponding representations to represent positive and negative sentiments. However, these methods cannot learn accurate sentiment representations to provide explanations because they only use simple rating information for sentiment analysis.
[0004] In order to obtain detailed sentiment information, many methods have begun to encode opinion information into explainable recommendations. Opinion information is a representation of sentiment at the word level. Although typical multi-task learning methods try to recognize the importance of generating text containing user opinions, it is still limited to the form of templates, which requires a lot of manpower to define different templates for different scenarios. Although the scoring form is simple, if user sentiment and opinions are not considered, the similarity of user opinion representations in different explanations will be very high. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention proposes an explainable recommendation method based on aligned user emotions and opinions. Previous explainable recommendation models either use sentiment analysis or directly introduce user opinions. Compared with previous explainable recommendation models, the present invention attempts to capture user preferences for different attributes by simultaneously utilizing sentiment analysis and user opinion information mining and keeping them consistent. Specifically, the present invention uses user emotions as a prerequisite for learning opinion representation. Therefore, the present invention introduces a sentiment representation that covers user-specific preferences, and encodes the sentiment representation into the opinion representation to achieve alignment. By introducing the sentiment-opinion alignment module, the sentiment and opinion information can be kept consistent. The method of the present invention improves the performance of the explainable recommendation system, enriches the generated explanation text and solves the problems existing in the prior art.
[0006] Terminology explanation:
[0007] Sentires toolkit is a phrase-level sentiment analysis toolkit called Sentires, which is specially designed to extract product features and user emotions from large-scale text review data. The Sentires toolkit can accurately extract the "feature-opinion-sentiment" triptych from the text reviews of the product, providing strong support for product feedback analysis and market research. One of the core functions of this toolkit is the ability to detect the emotions of different feature words and opinion words in the context. Sentires can identify and analyze the collocation of specific feature words (such as "noise", "quality", etc.) and opinion words (such as "high") in the text, and accurately judge their emotional tendencies based on the context. For example, in the context of "high noise", the toolkit can recognize that this usually represents "negative emotions"; while in the expression of "high quality", it can be correctly interpreted as "positive emotions".
[0008] The technical solution of the present invention is:
[0009] A method for explainable recommendation based on user sentiment and consensus, including:
[0010] Select user historical review datasets of different sizes from the public review datasets of e-commerce websites and preprocess them to obtain original user review data;
[0011] By extracting product attributes and user opinions from the original user review data, a complete data sample is obtained, and the data sample is divided into a training set, a validation set, and a test set;
[0012] Construct a user-item-feature preference rating matrix based on the training set and map the result to the sentiment matrix;
[0013] Based on the obtained sentiment matrix, an opinion matrix of the same dimension is obtained through mapping;
[0014] Construct a rating prediction objective function and optimize the predicted rating to make it close to the true rating;
[0015] Construct an opinion alignment optimization function to keep the real user opinion information and the predicted opinion matrix consistent;
[0016] The aligned opinion matrix is introduced into the text generation module, and the aligned opinion matrix and the representation of users and items are used as the input of the text generation module;
[0017] The text generation module is based on the encoder-decoder structure, generates different text sequences with the help of the attention mechanism, and takes the sequence with the maximum generation probability as the final result;
[0018] By setting hyperparameters to weigh the weights of different parts, the optimal target model expression is obtained;
[0019] After preprocessing the data to be explained and recommended, the recommendation and explanation are realized through the optimal target model expression.
[0020] Further preferably, the collected user historical review data set includes the user's unique ID, the project's unique ID, the user's review content on the project, and the preference score.
[0021] Preferably, according to the present invention, the user historical comment data set is preprocessed; including:
[0022] Filter users and projects: remove users and projects with fewer than a certain number of interactions in the user historical review dataset;
[0023] Remove irrelevant information;
[0024] Standardize text formats; convert all text data to a unified UTF-8 encoding using character encoding, convert all text to lowercase or uppercase, and replace common abbreviations and slang with their full forms.
[0025] Preferably, according to the present invention, extracting product attributes and user opinions from original user review data includes:
[0026] Use the Sentires toolkit to extract product attributes and user opinions from raw user review data, as well as sentences used as explanations;
[0027] The extracted features and user opinions are re-analyzed lexically to ensure that the features and user opinions are nouns and adjectives, respectively.
[0028] According to the preferred embodiment of the present invention, the user-item-feature preference rating matrix is as shown in formula (I):
[0029]
[0030] Formula (I), z is the user-item-feature preference rating matrix, represents the embedding vector of the mth feature in the feature set, and is the potential representation of user u and item i, || represents the connection operation between vectors;
[0031] Map the results to the sentiment matrix; including:
[0032] After obtaining the user-item-feature preference score matrix z, use MLP, i.e., sentiment perception machine, with the user-item-feature preference score matrix z as input and the sentiment matrix S u,i As output, the user-item-feature preference rating matrix z is mapped to the sentiment matrix S u,i ; The emotion perception machine includes weights W s , bias term b s and activation function σ; for any user-item-feature preference rating matrix z, through S u,i =σ(W s z+b s ) Calculate the sentiment matrix S corresponding to z u,i .
[0033] According to the preferred embodiment of the present invention, based on the obtained sentiment matrix, an opinion matrix of the same dimension is obtained through mapping. include:
[0034] The sentiment matrix is shown in formula (II):
[0035] S u,i =σ(W s z+b s ) (II)
[0036] In formula (II), the sentiment matrix S u,i Covering the user's emotions on all aspects of the project, W s and b s is the weight matrix and bias term of the emotion sensor, σ(·) represents the sigmoid activation function;
[0037] Sentiment Matrix S u,i Convert to opinion matrix This process uses a new MLP, namely the opinion perceptron; the opinion perceptron uses the sentiment matrix S u,i As input, the opinion matrix As output, the sentiment matrix S u,i Mapping to opinion matrix The opinion perceptron includes weights W o , bias term b oand activation function σ1; for any sentiment matrix S u,i , calculate the sentiment matrix S u,i The corresponding opinion matrix As shown in formula (III):
[0038]
[0039] In formula (III), the opinion matrix represents the user's opinion on the item features, W o and b o is the weight matrix and bias term of the opinion perceptron, and σ1(·) is the nonlinear activation function ReLU.
[0040] Preferably, according to the present invention, the MSE loss function is used as the expression of the score prediction objective function, as shown in formula (IV) and formula (V):
[0041]
[0042]
[0043] In formula (IV) and formula (V), is the training set, r u,i and Represent the true rating and predicted rating respectively, W r represents the weight matrix of the rating prediction function, b r represents the bias term of the rating prediction function, Represents the rating prediction objective function, which is composed of the MSE loss of the true rating and the predicted rating.
[0044] Preferably, according to the present invention, an opinion alignment optimization function is constructed to keep the real user opinion information and the predicted opinion matrix consistent, including: using mutual information maximization in the training phase to minimize the distance between the representation of the learned opinion matrix and the real opinion representation.
[0045] Further preferably, for the opinion set Negative samples are collected to make the learned opinions Close to real opinion u,i And stay away from negative samples; opinion alignment optimization function It is defined as formula (VI):
[0046]
[0047] In formula (VI), f θ (x,y)=σ(x·W θ ·y), σ(·) represents the sigmoid activation function, It is only used during training. Represents the collected negative samples.
[0048] Preferably, according to the present invention, the aligned opinion matrix and the representations of users and items are used as inputs of the text generation module, including: reintroducing the potential representations of users and items, namely and To distinguish from the recommendation task and ensure the generation of personalized comments, the learned opinion matrix is used as the supervision signal of the generation process, as shown in formula (VII):
[0049]
[0050] In formula (VII), z g Represented by the aligned opinion matrix User potential representation Project potential representation The jointly constructed supervision signal is used as the input of the text generation module.
[0051] Preferably, according to the present invention, based on the encoder-decoder structure, the text generation module is divided into a multi-layer perceptron encoder and an attention decoder;
[0052] The text generation module uses the aligned opinion matrix as input to generate the explanatory text of the item i recommended by the system for user u; the text generation module is based on an encoder-decoder framework, including an encoder based on a multi-layer perceptron, namely a multi-layer perceptron encoder, and a decoder based on an attention mechanism, namely an attention decoder; the multi-layer perceptron encoder receives the aligned opinion matrix as input and passes the encoded output to the attention decoder; the attention decoder receives the output of the multi-layer perceptron encoder and decodes it to obtain a multi-head operation output; the probability of the word is calculated based on the integration of the multi-head operation output and the optimization of the cross entropy loss function, and the explanatory text is output based on the calculated word probability;
[0053] In the multi-layer perceptron encoder, as shown in formula (VIII):
[0054] Q enc =φ(W e z g +b e ) (VIII)
[0055] In formula (VIII), Q enc represents the output of the multilayer perceptron encoder, φ(·) is the hyperbolic tangent function, and W e represents the weight matrix of the multilayer perceptron encoder, b e Represents the bias term of the multilayer perceptron encoder;
[0056] In the attention decoder, the calculation of the attention mechanism is shown in formula (IX):
[0057]
[0058] First, the attention score of the attention decoder input is calculated as shown in formula (X) and formula (XI):
[0059]
[0060] C=Concat(H1,H2,…,H h ) (XI)
[0061] In formula (X) and formula (XI), H represents the single-head attention calculation, R is the input of the attention decoder, C represents the output of the multi-head operation, and W Q , W K , W V Represent three parameter matrices, H h is the h-th single-head representation calculated by the attention mechanism calculation formula (X);
[0062] The output of the multi-layer perceptron encoder is Q, and the output of the masked self-attention mechanism in the attention decoder is K and V, as shown in formula (XII) and formula (XIII):
[0063]
[0064]
[0065] Respectively represent and parameter matrix W Q , W K The matrix normalized to the standard normal distribution, H g Represents the normalized matrix Computed single-head attention, represents the h-th single-head representation calculated by the attention mechanism calculation formula (XII), C g Indicated by Combined multi-head operation output;
[0066] After obtaining the result processed by the attention mechanism, the multi-head operation output C g Integrate them for residual connection and layer normalization, as shown in formula (XIV):
[0067]
[0068] In formula (XIV), σ(·) is the ReLU activation function, and a multi-layer attention mechanism is used to learn more complex transformations; the interpretation text uses the cross entropy loss function to optimize the generated results, as shown in formula (XV):
[0069]
[0070] In formula (XV), g u,i ={w1,w2,...,w |g|} is the true explanation of user u and item i, |g u,i | is its length, p(y n ) represents word w n The output probability of .
[0071] According to the preferred embodiment of the present invention, the score prediction objective function in formula (V) is The opinion alignment optimization function in formula (VI) The cross entropy loss function in formula (XV) Optimize together to form end-to-end training; the joint objective function, that is, the optimal target model expression is shown in formula (XVI):
[0072]
[0073] In formula (XVI), Θ is the model parameter set, λ o ,λ g is the weight of each module in the total task, λ n are the regularization weights of all parameters; it takes the starting symbol as input and its output as the input sequence for the test phase.
[0074] Preferably, according to the present invention, the data to be explained and recommended is preprocessed and then expressed through the optimal target model to achieve recommendation and explanation; including:
[0075] Data preparation and preprocessing: preparing the data to be interpreted and recommended and performing the aforementioned preprocessing;
[0076] Sentiment and opinion alignment: Based on the preprocessed data, construct a user-item-feature preference rating matrix; map the preference rating matrix to the sentiment matrix; convert the sentiment matrix into an opinion matrix of the same dimension;
[0077] Generate recommendations and explanations: Generate a list of recommended items for a specific user using the optimal target model expression; introduce the aligned opinion matrix into the text generation module; use the attention mechanism to generate text sequences related to the recommended items; and from the generated text sequences, select the sequence with the highest generation probability as the explanation for the recommended item.
[0078] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, steps of an explainable recommendation method that is consistent with user emotions and opinions are implemented.
[0079] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of an explainable recommendation method consistent with user emotions and opinions.
[0080] An explainable recommendation system for user sentiment and consensus, including:
[0081] The sentiment matrix acquisition unit is configured to: use rating prediction as a recommendation task to obtain a learned sentiment matrix;
[0082] The opinion matrix acquisition unit is configured to: convert the sentiment matrix into an opinion matrix, and make the sentiment matrix consistent with the opinion matrix through a sentiment-opinion alignment module; wherein negative sampling is performed to ensure that the learned opinion matrix is close to the real opinion information;
[0083] The recommendation result generation unit is configured to generate explanations for the recommendation results using a model based on an attention mechanism.
[0084] The beneficial effects of the present invention are:
[0085] 1. By introducing emotion-opinion alignment, the present invention achieves effective alignment of user emotion and opinion information, significantly improving the performance of the recommendation system. This alignment not only enhances the accuracy of recommendations, but also enables the recommendation system to better understand and be close to the user's real needs and preferences, thereby providing users with more personalized recommendation services.
[0086] 2. The present invention uses a model based on the attention mechanism to generate explanations for the recommendation results, which not only improves the interpretability of the recommendation system, but also greatly enriches the content and quality of the generated explanation text. Users can more intuitively understand the reasons for the recommendation results, further improving the user experience and satisfaction.
[0087] 3. By implementing negative sampling technology, the present invention can ensure that the learned opinion matrix is closer to the real user opinion information. This technology improves the accuracy and reliability of the recommendation system, effectively solves the problems existing in the prior art, and provides users with higher quality recommendation services. At the same time, the introduction of this technology also improves the system's anti-interference ability, making the recommendation results more robust and credible. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] Figure 1 A flowchart of the explainable recommendation method consistent with user emotions and opinions of the present invention;
[0089] Figure 2 Schematic diagram for constructing sentiment-opinion alignment and generating explanatory text based on user reviews;
[0090] Figure 3Schematic diagram of the flow of the text generation module. DETAILED DESCRIPTION
[0091] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments, but the present invention is not limited thereto.
[0092] Example 1
[0093] A method for explainable recommendation based on user sentiment and consensus, including:
[0094] ST1: Select user historical review datasets of different sizes from the public review datasets of e-commerce websites and preprocess them to obtain the original user review data;
[0095] ST2: Extract product attributes and user opinions from the original user review data to obtain a complete data sample, and divide the data sample into a training set, a validation set, and a test set;
[0096] ST3: Construct a user-item-feature preference rating matrix based on the training set and map the result to the sentiment matrix S u,i ;
[0097] ST4: Based on the obtained sentiment matrix, the opinion matrix of the same dimension is obtained through mapping.
[0098] ST5: Construct a rating prediction objective function to optimize the predicted rating to make it close to the true rating;
[0099] ST6: Construct an opinion alignment optimization function to keep the real user opinion information and the predicted opinion matrix consistent;
[0100] ST7: Introduce the aligned opinion matrix into the text generation module, and use the aligned opinion matrix and the representation of users and items as the input of the text generation module;
[0101] ST8: The text generation module is based on the encoder-decoder structure. It generates different text sequences with the help of the attention mechanism and takes the sequence with the maximum generation probability as the final result. It weighs the weights of different parts by setting the hyperparameter μ to obtain the optimal target model expression. It preprocesses the data to be interpreted and recommended and uses the optimal target model expression to achieve recommendation and interpretation.
[0102] In the present invention, firstly, rating prediction is used as a recommendation task to obtain a learned sentiment matrix; secondly, the sentiment matrix is converted into an opinion matrix, and the sentiment matrix is made consistent with the opinion matrix through a sentiment-opinion alignment module; wherein negative sampling is performed to ensure that the learned opinion matrix is close to the real opinion information; finally, a model based on an attention mechanism is used to generate explanations for the recommendation results.
[0103] Example 2
[0104] A method for interpretable recommendation with consistent user emotions and opinions according to Example 1, which is characterized in that:
[0105] The collected user historical comment dataset includes user unique ID, item unique ID, user comment content on the item, and preference score.
[0106] Preprocess the user historical comment dataset; including:
[0107] Filter users and items: Remove users and items with less than a certain number of interactions (20 times) in the user historical comment dataset;
[0108] Remove irrelevant information; Delete special characters in the text, such as punctuation marks and emojis, remove advertisements, promotional slogans, non-text content (pictures, links); Remove stop words that frequently appear in the text but contribute little to the meaning of the text, such as common auxiliary words, prepositions or conjunctions like "de", "le", "zai"; Identify and delete completely duplicate data records to avoid bias in subsequent analysis.
[0109] Standardize the text format; Convert all text data to the unified UTF-8 encoding using character encoding to avoid garbled characters in subsequent processing; Convert all text to lowercase or uppercase to reduce analysis errors caused by inconsistent case; Replace common abbreviations and slang with full forms to improve the readability of the text and the accuracy of analysis.
[0110] Extract product attributes and user opinions from the original user comment data, including:
[0111] Use the Sentires toolkit to extract product attributes, user opinions, and sentences for explanation from the original user comment data;
[0112] Re-analyze the extracted features and user opinions lexically to ensure that the features and user opinions are nouns and adjectives respectively.
[0113] Preferably according to the present invention, it is fully considered that users may not have the same views on different functions. Therefore, the present invention introduces corresponding feature sets, such as price, color, and size: The user-item-feature preference score matrix is shown in formula (I):
[0114]
[0115] In formula (I), z is the user-item-feature preference score matrix, represents the embedding vector of the m-th feature in the feature set, and is the potential representation of user u and item i, || represents the connection operation between vectors;
[0116] Map the results to the sentiment matrix; including:
[0117] After obtaining the user-item-feature preference score matrix z, an MLP, namely a sentiment perception machine (multi-layer perceptron, to distinguish different MLPs, the present invention names the MLP as “sentiment perception machine”), is used to take the user-item-feature preference score matrix z as input and the sentiment matrix S u,i As output, the user-item-feature preference rating matrix z is mapped to the sentiment matrix S u,i ; The emotion perception machine includes weight W s , bias term b s and activation function σ (the present invention selects sigmoid function as activation function σ); for any user-item-feature preference score matrix z, through S u,i =σ(W s z+b s ) Calculate the sentiment matrix S corresponding to z u,i .
[0118] In order to solve the problem that the ratings cannot represent the specific preferences of users, the sentiment matrix is used as the basis for opinion representation and the two are aligned. Based on the obtained sentiment matrix, the opinion matrix of the same dimension is obtained through mapping. include:
[0119] The sentiment matrix is shown in formula (II):
[0120] S u,i =σ(W s z+b s ) (II)
[0121] In formula (II), the sentiment matrix S u,i Covering the user's emotions on all aspects of the project, W s and b s is the weight matrix and bias term of the emotion sensor, σ(·) represents the sigmoid activation function;
[0122] Sentiment Matrix S u,i Convert to opinion matrix This process uses a new MLP, namely the opinion perception machine (the present invention names the MLP as “opinion perception machine”); the opinion perception machine uses the sentiment matrix S u,i As input, the opinion matrix As output, the sentiment matrix S u,i Mapping to opinion matrix The opinion perceptron includes weights W o, bias term b o and activation function σ1 (this method uses nonlinear activation function ReLU as activation function σ1); for any sentiment matrix S u,i , calculate the sentiment matrix S u,i The corresponding opinion matrix As shown in formula (III):
[0123]
[0124] In formula (III), the opinion matrix represents the user's opinion on the item features, W o and b o is the weight matrix and bias term of the opinion perceptron, and σ1(·) is the nonlinear activation function ReLU.
[0125] The final predicted rating value is the average of the user's comprehensive ratings for all features, which should be close to the user's overall rating. The MSE loss function is used as the expression of the rating prediction objective function, as shown in Formula (IV) and Formula (V):
[0126]
[0127]
[0128] In formula (IV) and formula (V), is the training set, r u,i and Represent the true rating and predicted rating respectively, W r represents the weight matrix of the rating prediction function, b r represents the bias term of the rating prediction function, Represents the rating prediction objective function, which is composed of the MSE loss of the true rating and the predicted rating.
[0129] Since a single rating lacks detailed sentiment information, the sentiment in the generated explanation may fail to cover the user's preferences in specific aspects. The present invention uses the combination of sentiment and opinion to solve the problem.
[0130] Construct an opinion alignment optimization function to keep the real user opinion information and the predicted opinion matrix consistent, including: making the learned opinion matrix close to the real opinion, and using mutual information maximization in the training phase to minimize the distance between the representation of the learned opinion matrix and the real opinion representation.
[0131] Opinion set Negative samples are collected to make the learned opinions Close to real opinion u,i And stay away from negative samples; opinion alignment optimization function It is defined as formula (VI):
[0132]
[0133] In formula (VI), f θ (x,y)=σ(x·W θ ·y), σ(·) represents the sigmoid activation function, It is only used during training. Represents the collected negative samples.
[0134] The aligned opinion matrix and the representations of users and items are used as the input of the text generation module, including: reintroducing the latent representations of users and items, i.e. and To distinguish from the recommendation task and ensure the generation of personalized comments, the learned opinion matrix is used as the supervision signal of the generation process, as shown in formula (VII):
[0135]
[0136] In formula (VII), z g Represented by the aligned opinion matrix User potential representation Project potential representation The jointly constructed supervision signal is used as the input of the text generation module.
[0137] Based on the encoder-decoder structure, the text generation module is divided into a multi-layer perceptron encoder and an attention decoder;
[0138] The text generation module uses the aligned opinion matrix as input to generate the explanatory text of item i recommended by the system for user u; the text generation module is based on the encoder-decoder framework, including an encoder based on a multi-layer perceptron, namely a multi-layer perceptron encoder, and a decoder based on an attention mechanism, namely an attention decoder; the multi-layer perceptron encoder receives the aligned opinion matrix as input and passes the encoded output to the attention decoder; the attention decoder receives the output of the multi-layer perceptron encoder and decodes it to obtain a multi-head operation output; the probability of the word is calculated based on the integration of the multi-head operation output and the optimization of the cross entropy loss function, and the explanatory text is output based on the calculated word probability; the text generation module corresponds to the attached Figure 3 .
[0139] In the multi-layer perceptron encoder, as shown in formula (VIII):
[0140] Q enc =φ(W e z g +b e ) (VIII)
[0141] In formula (VIII), Q enc represents the output of the multilayer perceptron encoder, φ(·) is the hyperbolic tangent function, and W e represents the weight matrix of the multilayer perceptron encoder, b e Represents the bias term of the multilayer perceptron encoder;
[0142] In the attention decoder, the calculation of the attention mechanism is shown in formula (IX):
[0143]
[0144] First, the attention score of the attention decoder input is calculated as shown in formula (X) and formula (XI):
[0145]
[0146] C=Concat(H1,H2,…,H h ) (XI)
[0147] In formula (X) and formula (XI), H represents a single-head attention calculation, R is the input of the attention decoder, and since the present invention considers different contexts in a sentence from multiple aspects, a multi-head attention mechanism is adopted. C represents the output of the multi-head operation, and the residual network, Dropout, and layer normalization strategies are omitted in the equation. Q , W K , W V Represent three parameter matrices, H h is the h-th single-head representation calculated by the attention mechanism calculation formula (X);
[0148] The output of the multi-layer perceptron encoder is Q, and the output of the masked self-attention mechanism in the attention decoder is K and V, as shown in formula (XII) and formula (XIII):
[0149]
[0150]
[0151] Respectively represent and parameter matrix W Q , W K The matrix normalized to the standard normal distribution, H g Represents the normalized matrix Computed single-head attention, represents the h-th single-head representation calculated by the attention mechanism calculation formula (XII), C g Indicated by Combined multi-head operation output;
[0152] After obtaining the result processed by the attention mechanism, the multi-head operation output C g Integrate them for residual connection and layer normalization, as shown in formula (XIV):
[0153]
[0154] In formula (XIV), σ(·) is the ReLU activation function, and a multi-layer attention mechanism is used to learn more complex transformations; the interpretation text uses the cross entropy loss function to optimize the generated results, as shown in formula (XV):
[0155]
[0156] In formula (XV), g u,i ={w1,w2,...,w |g|} is the true explanation of user u and item i, |g u,i | is its length, p(y n ) represents word w n The output probability of .
[0157] The score prediction objective function in formula (V) The opinion alignment optimization function in formula (VI) The cross entropy loss function in formula (XV) Optimize together to form end-to-end training; the joint objective function, that is, the optimal target model expression is shown in formula (XVI):
[0158]
[0159] In formula (XVI), Θ is the model parameter set, λ o ,λ g is the weight of each module in the total task, λ n is the regularization weight of all parameters; it is worth noting that the attention mechanism decoder does not know the input content during the test phase. Therefore, an assumption is made about the output in advance. Specifically, the starting symbol is taken as input and its output is used as the input sequence of the test phase.
[0160] The evaluation of the recommendation model is expressed by RMSE, and its formula is as follows:
[0161]
[0162] in, represents the predicted rating of user u for item i, r u,i Represents the true score, N represents the size of the test set, and the smaller the RMSE value, the more accurate the prediction.
[0163] The evaluation of the quality of the generated model is expressed by BLEU and ROUGE, and their formulas are as follows:
[0164]
[0165] Among them, BP is the length penalty factor. In order to balance the effects of statistics of each order, the geometric mean is used to calculate the average value and then weighted. The method is uniform weighting, that is, W n =1 / N, the upper limit of N is 4, that is, only the accuracy of 4-gram is counted at most.
[0166]
[0167] Here, N refers to N-gram. The above formula can be understood as the number of N-grams that are the same between the interpretation text generated by this method and the real reference text / the total number of N-grams in the real reference text.
[0168] After preprocessing the data to be explained and recommended, the recommendation and explanation are realized through the optimal target model expression; including:
[0169] Data preparation and preprocessing: preparing the data to be interpreted and recommended and performing the aforementioned preprocessing;
[0170] Sentiment and opinion alignment: Based on the preprocessed data, a user-item-feature preference score matrix is constructed; the preference score matrix reflects the user's rating of the item and the preference of each feature. The preference score matrix is mapped to the sentiment matrix; the sentiment matrix represents the user's sentimental inclination towards the item. The sentiment matrix is converted into an opinion matrix of the same dimension; the opinion matrix predicts the user's specific opinion on the item.
[0171] Generate recommendations and explanations: Generate a list of recommended items for a specific user using the optimal target model expression; these recommended items not only meet the user's rating preferences, but also have predicted opinions that are highly consistent with the user's true opinions. The aligned opinion matrix is introduced into the text generation module; this module uses an encoder-decoder structure and uses the attention mechanism to generate text sequences related to the recommended items; from the generated text sequences, the sequence with the highest generation probability is selected as the explanation of the recommended item. These explanations will specifically explain the reasons for recommending the item, such as "This phone takes excellent photos and is suitable for users who like photography." The recommended items and their corresponding explanations are displayed to users to help them better understand the recommendation results and improve their acceptance.
[0172] Through the above steps, this method not only realizes recommendations based on user sentiment and opinion consistency, but also provides specific explanations for each recommended item, thereby improving the interpretability of the recommendation system and user satisfaction.
[0173] With the method of the present invention, when it is observed that users express opinions on various aspects of an item, only considering the overall sentiment of the user towards the item is less interpretable. Therefore, considering user preferences from multiple aspects can improve the effectiveness of the recommendation system.
[0174] Referring to the explainable recommendation method based on aligned user sentiment and opinions, the Amazon product review dataset was used for verification. Three samples with different ratings were randomly selected from the user reviews. The features and opinions extracted from each review were given. It can be observed that the generated explanation text can basically cover the user sentiment and opinions. As shown in Table 1:
[0175] Table 1
[0176]
[0177] From Table 1, it can be clearly found that the algorithm proposed in the present invention has a significant improvement in interpretable recommendation performance compared to the Neural Template Explanations Generation (NTEG) method.
[0178] Example 3
[0179] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the explainable recommendation method for consistent user emotions and opinions described in Example 1 or 2 are implemented.
[0180] Example 4
[0181] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the explainable recommendation method for consistent user emotions and opinions as described in Example 1 or 2.
[0182] Example 5
[0183] An explainable recommendation system for user sentiment and consensus, including:
[0184] The sentiment matrix acquisition unit is configured to: use rating prediction as a recommendation task to obtain a learned sentiment matrix;
[0185] The opinion matrix acquisition unit is configured to: convert the sentiment matrix into an opinion matrix, and make the sentiment matrix consistent with the opinion matrix through a sentiment-opinion alignment module; wherein negative sampling is performed to ensure that the learned opinion matrix is close to the real opinion information;
[0186] The recommendation result generation unit is configured to generate explanations for the recommendation results using a model based on an attention mechanism.
[0187] In order to solve the problems of emotional supervision and sentence flexibility in explainable recommendations, the present invention proposes a text automatic generation model based on combining user emotions and opinions, which can encode more emotional information into the recommendation reasons. The method of the present invention mainly considers that user comments contain preferences for different aspects of the project, and converts the sentiment analysis into text generation, so as to reflect the user's preferences in text form, ensuring that the user's opinions in the explanation text are consistent with the user's emotions towards the product.
Claims
1. An explainable recommendation method based on user sentiment and opinion consistency, It is characterized in that include: Select user historical review datasets of different sizes from the public review datasets of e-commerce websites and preprocess them to obtain original user review data; By extracting product attributes and user opinions from the original user review data, a complete data sample is obtained, and the data sample is divided into a training set, a validation set, and a test set; Construct a user-item-feature preference rating matrix based on the training set and map the result to the sentiment matrix; Based on the obtained sentiment matrix, an opinion matrix of the same dimension is obtained through mapping; Construct a rating prediction objective function and optimize the predicted rating to make it close to the true rating; Construct an opinion alignment optimization function to keep the real user opinion information and the predicted opinion matrix consistent; The aligned opinion matrix is introduced into the text generation module, and the aligned opinion matrix and the representation of users and items are used as the input of the text generation module; The text generation module is based on the encoder-decoder structure, generates different text sequences with the help of the attention mechanism, and takes the sequence with the maximum generation probability as the final result; By setting hyperparameters to weigh the weights of different parts, the optimal target model expression is obtained; After preprocessing the data to be explained and recommended, the recommendation and explanation are realized through the optimal target model expression.
2. According to claim 1, an explainable recommendation method based on user sentiment and opinion consistency, It is characterized in that The collected user historical review data set includes user unique ID, project unique ID, user's review content on the project, and preference rating; Preprocess the user historical review dataset; include: Filter users and projects: remove users and projects with fewer than a certain number of interactions in the user historical review dataset; Remove irrelevant information; Standardize text formats; convert all text data to a unified UTF-8 encoding using character encoding, convert all text to lowercase or uppercase, and replace common abbreviations and slang with their full forms.
3. According to claim 1, an explainable recommendation method based on user sentiment and opinion consistency, It is characterized in that Extract product attributes and user opinions from the original user review data, including: Use the Sentires toolkit to extract product attributes and user opinions from raw user review data, as well as sentences used as explanations; Re-analyze the extracted features and user opinions lexically to ensure that the features and user opinions are nouns and adjectives, respectively; Further preferably, the user-item-feature preference rating matrix is as shown in formula (I): Formula (I), z is the user-item-feature preference rating matrix, represents the embedding vector of the mth feature in the feature set, and is the potential representation of user u and item i, || represents the connection operation between vectors; Map the results to the sentiment matrix; including: After obtaining the user-item-feature preference score matrix z, use MLP, i.e., sentiment perception machine, with the user-item-feature preference score matrix z as input and the sentiment matrix S u,i As output, the user-item-feature preference rating matrix z is mapped to the sentiment matrix S u,i ; The emotion perception machine includes weight W s , bias term b s and activation function σ; for any user-item-feature preference rating matrix z, through S u,i =σ(W s z+b s ) Calculate the sentiment matrix S corresponding to z u,i .
4. According to claim 1, an explainable recommendation method based on user sentiment and opinion consistency, It is characterized in that Based on the obtained sentiment matrix, the opinion matrix of the same dimension is obtained through mapping. include: The sentiment matrix is shown in formula (II): S u,i =σ(W s with+with s ) (II) In formula (II), the sentiment matrix S u,i Covering the user's emotions on all aspects of the project, W s and b s is the weight matrix and bias term of the emotion sensor, σ(·) represents the sigmoid activation function; Sentiment Matrix S u,i Convert to opinion matrix This process uses a new MLP, namely the opinion perceptron; the opinion perceptron uses the sentiment matrix S u,i As input, the opinion matrix As output, the sentiment matrix S u,i Mapping to opinion matrix The opinion perceptron includes weights W ( , bias term b ( and activation function σ1; for any sentiment matrix S u,i , calculate the sentiment matrix S u,i The corresponding opinion matrix As shown in formula (III): In formula (III), the opinion matrix represents the user's opinion on the item features, W ( and b ( is the weight matrix and bias term of the opinion perceptron, σ1(·) is the nonlinear activation function ReLU; Further preferably, the MSE loss function is used as the expression of the score prediction objective function, as shown in formula (IV) and formula (V): In formula (IV) and formula (V), is the training set, r u,i and Represent the true rating and predicted rating respectively, W r represents the weight matrix of the rating prediction function, b r represents the bias term of the rating prediction function, Represents the rating prediction objective function, which is composed of the MSE loss of the true rating and the predicted rating.
5. According to claim 1, an explainable recommendation method based on user sentiment and opinion consistency, It is characterized in that Constructing an opinion alignment optimization function to keep the real user opinion information and the predicted opinion matrix consistent, including: using mutual information maximization in the training phase to minimize the distance between the representation of the learned opinion matrix and the real opinion representation; Further preferably, for the opinion set Negative samples are collected to make the learned opinions Close to real opinion u,i And stay away from negative samples; opinion alignment optimization function It is defined as formula (VI): In formula (VI), f θ (x,y)=σ(x·W θ ·y), σ(·) represents the sigmoid activation function, It is only used during training. Represents the collected negative samples.
6. According to claim 1, a method for interpretable recommendation based on user sentiment and opinion consistency, It is characterized in that The aligned opinion matrix and the representations of users and items are used as the input of the text generation module, including: reintroducing the latent representations of users and items, i.e. and To distinguish from the recommendation task and ensure the generation of personalized comments, the learned opinion matrix is used as the supervision signal of the generation process, as shown in formula (VII): In formula (VII), z g Represented by the aligned opinion matrix User potential representation Project potential representation The jointly constructed supervision signal is used as the input of the text generation module; Further preferably, based on the encoder-decoder structure, the text generation module is divided into a multi-layer perceptron encoder and an attention decoder; The text generation module uses the aligned opinion matrix as input to generate the explanatory text of the item i recommended by the system for user u; the text generation module is based on an encoder-decoder framework, including an encoder based on a multi-layer perceptron, namely a multi-layer perceptron encoder, and a decoder based on an attention mechanism, namely an attention decoder; the multi-layer perceptron encoder receives the aligned opinion matrix as input and passes the encoded output to the attention decoder; the attention decoder receives the output of the multi-layer perceptron encoder and decodes it to obtain a multi-head operation output; the probability of the word is calculated based on the integration of the multi-head operation output and the optimization of the cross entropy loss function, and the explanatory text is output based on the calculated word probability; In the multi-layer perceptron encoder, as shown in formula (VIII): Q enc =φ(W e With g +b e ) (VIII) In formula (VIII), Q enc represents the output of the multilayer perceptron encoder, φ(·) is the hyperbolic tangent function, and W e represents the weight matrix of the multilayer perceptron encoder, b e Represents the bias term of the multilayer perceptron encoder; In the attention decoder, the calculation of the attention mechanism is shown in formula (IX): First, the attention score of the attention decoder input is calculated as shown in formula (X) and formula (XI): C=Concat(H 1 ,H 2 ,…,H h ) (XI) In formula (X) and formula (XI), H represents the single-head attention calculation, R is the input of the attention decoder, C represents the output of the multi-head operation, and W Q , W K , W V Represent three parameter matrices, H h is the h-th single-head representation calculated by the attention mechanism calculation formula (X); The output of the multi-layer perceptron encoder is Q, and the output of the masked self-attention mechanism in the attention decoder is K and V, as shown in formula (XII) and formula (XIII): Respectively represent and parameter matrix W Q , W K The matrix normalized to the standard normal distribution, H g Represents the normalized matrix Computed single-head attention, represents the h-th single-head representation calculated by the attention mechanism calculation formula (XII), C g Indicated by Combined multi-head operation output; After obtaining the result processed by the attention mechanism, the multi-head operation output C g Integrate them for residual connection and layer normalization, as shown in formula (XIV): In formula (XIV), σ(·) is the ReLU activation function, and a multi-layer attention mechanism is used to learn more complex transformations; the interpretation text uses the cross entropy loss function to optimize the generated results, as shown in formula (XV): In formula (XV), g u,i ={w 1 ,w 2 ,...,w |J| } is the true explanation of user u and item i, |g u,i | is its length, p(y L ) represents word w L The output probability of Further preferably, the score prediction objective function in formula (V) is The opinion alignment optimization function in formula (VI) The cross entropy loss function in formula (XV) Optimize together to form end-to-end training; the joint objective function, that is, the optimal target model expression is shown in formula (XVI): In formula (XVI), Θ is the model parameter set, λ ( ,λ J is the weight of each module in the total task, λ L are the regularization weights of all parameters; it takes the starting symbol as input and its output as the input sequence for the test phase.
7. A method for interpretable recommendation with consistent user sentiment and opinion according to any one of claims 1 to 6, It is characterized in that After preprocessing the data to be explained and recommended, the recommendation and explanation are realized through the optimal target model expression; including: Data preparation and preprocessing: preparing the data to be interpreted and recommended and performing the aforementioned preprocessing; Sentiment and opinion alignment: Based on the preprocessed data, construct a user-item-feature preference rating matrix; map the preference rating matrix to the sentiment matrix; convert the sentiment matrix into an opinion matrix of the same dimension; Generate recommendations and explanations: Generate a list of recommended items for a specific user using the optimal target model expression; introduce the aligned opinion matrix into the text generation module; use the attention mechanism to generate text sequences related to the recommended items; and from the generated text sequences, select the sequence with the highest generation probability as the explanation for the recommended item.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the explainable recommendation method with consistent user emotions and opinions as described in any one of claims 1-7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the explainable recommendation method with consistent user emotions and opinions as described in any one of claims 1-7 are implemented.
10. An explainable recommendation system based on user sentiment and opinion consistency, It is characterized in that include: The sentiment matrix acquisition unit is configured to: use rating prediction as a recommendation task to obtain a learned sentiment matrix; The opinion matrix acquisition unit is configured to: convert the sentiment matrix into an opinion matrix, and make the sentiment matrix consistent with the opinion matrix through a sentiment-opinion alignment module; wherein negative sampling is performed to ensure that the learned opinion matrix is close to the real opinion information; The recommendation result generation unit is configured to generate explanations for the recommendation results using a model based on an attention mechanism.
Citation Information
Cited By
Automatic advertisement recommendation method and device based on artificial intelligence
CN119784442A
