An explanation recommendation method, device and equipment based on sentiment analysis
Through a sentiment analysis-based method, the item and user feature vectors are generated and the user's interaction with items is simulated in the shared space, the problem that existing recommendation solutions do not use emotional information is solved, achieving higher quality interpreted recommendations and more accurate item recommendations.
Patent Information
- Application Number
- CN202111535085.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2041-12-15
AI Technical Summary
Existing recommendation solutions are usually based on templates or short sentences to generate interpreted sentences, and do not use emotions or comment information, resulting in low quality of interpretable recommendations and inability to accurately filter recommendation information that meets user needs.
Determine the target item by responding to the item selection command input by the user; generate the item feature vector based on multiple comment information of the target item; generate the user feature vector based on multiple comment information of the user; project the item feature vector and the user feature vector to the shared space to determine the shared hidden vector of the target item; generate recommendation information based on the comment preference score, user preference score and shared hidden vector.
Effectively utilize emotional information in item reviews and user reviews to improve the generation quality of interpretation recommendations and enhance the accuracy of item recommendations.
Smart Images

Figure CN114219530B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of explainable recommendation technology, and in particular to a sentiment analysis-based explanation recommendation method, device and equipment. Background Art
[0002] The explosive growth of information on the Internet provides a wealth of information, but it also brings about the problem of information overload. Recommendation systems are an important way to solve the problem of information overload. They can automatically extract useful information and then recommend information that users may want to accept. Recommendation systems are widely used in e-commerce, music, movies, and mobile applications, where users can express their opinions in terms of ratings and comments.
[0003] Many existing recommendation methods are mainly based on collaborative filtering, which recommends items by analyzing the historical interaction records between users and items. However, the items used by users are often very limited, which makes the interaction matrix between users and items quite sparse, resulting in unsatisfactory recommendation accuracy.
[0004] To this end, some researchers have proposed using the comments written by users for items to make up for this shortcoming. The comments written by the same user on various items express the user's preferences, feelings and suggestions. On the other hand, the comments written by multiple users on the same item reflect the advantages and disadvantages of the item in various aspects, providing more reference information for the item. However, the above schemes usually generate explanation sentences based on templates or short sentences, and do not use sentiment or comment information, resulting in low quality of the generated explainable recommendations and failure to accurately screen out recommendation information that meets user needs. Summary of the invention
[0005] The present invention provides an explanation recommendation method, device and equipment based on sentiment analysis, which solves the technical problem that existing recommendation schemes usually generate explanation sentences based on templates or short sentences, and do not utilize sentiment or comment information, resulting in low quality of generated explainable recommendations and inability to accurately screen out recommendation information that meets user needs.
[0006] The first aspect of the present invention provides an explanation recommendation method based on sentiment analysis, comprising:
[0007] In response to an item selection instruction input by a user, determining a target item selected by the user;
[0008] Generate a corresponding item feature vector according to multiple item review information for the target item;
[0009] Generate a corresponding user feature vector according to the multiple pieces of user comment information associated with the user;
[0010] Projecting the item feature vector and the user feature vector into a shared space to determine a shared hidden vector corresponding to the target item;
[0011] Determining an item review preference score and a user review preference score, respectively, according to the item review information and the user review information;
[0012] Based on the item review preference score, the user review preference score and the shared hidden vector, recommendation information corresponding to the target item is determined.
[0013] Optionally, the step of generating a corresponding item feature vector according to the plurality of item review information for the target item includes:
[0014] Determine the item unique-hot vector corresponding to the target item according to the position of the page where the target item is located;
[0015] Generate a corresponding item embedding vector based on the item one-hot vector and a preset item embedding layer weight matrix;
[0016] Using a plurality of preset convolution kernels to encode and convert all the item review words in all the item review information of the target item, and then concatenate them to obtain a corresponding item review vector;
[0017] The item embedding vector and the item review vector are connected to obtain an item feature vector corresponding to the target item.
[0018] Optionally, the step of using a plurality of preset convolution kernels to perform encoding conversion on all the item review words in all the item review information of the target item and then concatenating them to obtain a corresponding item review vector includes:
[0019] Encoding the multiple item review words included in each item review information for the target item respectively to obtain multiple item review word embedding vectors;
[0020] Using all the item review word embedding vectors to construct an item review word embedding matrix;
[0021] The item review word embedding matrix is transformed by using a plurality of preset convolution kernels and a maximum pooling operation is performed to obtain a plurality of item review embedding vectors corresponding to the item review word embedding matrix;
[0022] Connect all the item review embedding vectors to obtain the item review vector corresponding to the target item.
[0023] Optionally, the step of generating a corresponding user feature vector according to the multiple pieces of user comment information associated with the user includes:
[0024] According to the preset user identifier corresponding to the user, construct a user one-hot vector corresponding to the user;
[0025] Based on the user one-hot vector and a preset user embedding layer weight matrix, generating a corresponding user embedding vector;
[0026] Using a plurality of preset convolution kernels, all user comment words in all user comment information associated with the user are respectively converted by encoding and then connected to obtain corresponding user comment vectors;
[0027] The user embedding vector and the user comment vector are connected to obtain a user feature vector corresponding to the user.
[0028] Optionally, the step of using a plurality of preset convolution kernels to encode and convert all user comment words in all user comment information associated with the user and then concatenate them to obtain corresponding user comment vectors includes:
[0029] Encoding the plurality of user comment words included in each of the user comment information associated with the user respectively to obtain a plurality of user comment word embedding vectors;
[0030] Constructing a user comment word embedding matrix using all of the user comment word embedding vectors;
[0031] The user comment word embedding matrix is transformed by using a plurality of preset convolution kernels and a maximum pooling operation is performed to obtain a plurality of user comment embedding vectors corresponding to the user comment word embedding matrix;
[0032] Connect all the user comment embedding vectors to obtain the user comment vector corresponding to the user.
[0033] Optionally, the step of determining the item review preference score and the user review preference score respectively according to the item review information and the user review information comprises:
[0034] Calculate the sentiment score of the item review corresponding to each item review information by using the preset TextBlob function;
[0035] Calculate the user comment sentiment score corresponding to each piece of the user comment information by using the TextBlob function;
[0036] Calculate the average of all the sentiment scores of the item reviews to obtain the item review preference score;
[0037] The average of all the user comment sentiment scores is calculated to obtain the user comment preference score.
[0038] Optionally, the recommendation information includes a recommendation score and a recommendation explanation; the step of determining the recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector comprises:
[0039] Calculating a shared vector product between a preset weight matrix and the shared hidden vector;
[0040] Calculating the sum of the shared vector product, the item review preference score, and the user review preference score to obtain a recommendation score corresponding to the target item;
[0041] sequentially connecting the user feature vector, the item feature vector, the user review preference score, the item review preference score and the shared hidden vector to obtain an initial hidden state;
[0042] By combining the preset long short-term memory network model with the initial hidden state, multiple predicted words are selected from the preset corpus to generate recommended explanations.
[0043] Optionally, the step of selecting a plurality of predicted words from a preset corpus to generate a recommended explanation by combining a preset long short-term memory network model with the initial hidden state comprises:
[0044] By combining the initial hidden state with the preset long short-term memory network model, multiple candidate words are selected from the preset corpus at each time step;
[0045] Calculate the probability of occurrence of each candidate word at each time step;
[0046] The candidate word with the highest occurrence probability in each time step is selected as the predicted word to generate a recommended explanation.
[0047] A second aspect of the present invention provides an explanation recommendation device based on sentiment analysis, comprising:
[0048] A target item selection module, configured to determine a target item selected by the user in response to an item selection instruction input by the user;
[0049] An item feature vector generation module, used to generate a corresponding item feature vector according to a plurality of item review information for the target item;
[0050] A user feature vector generation module, used to generate a corresponding user feature vector according to a plurality of user comment information associated with the user;
[0051] A shared hidden vector determination module, used to project the item feature vector and the user feature vector into a shared space to determine a shared hidden vector corresponding to the target item;
[0052] A preference score determination module, used to determine an item review preference score and a user review preference score, respectively, based on the item review information and the user review information;
[0053] A recommendation information generation module is used to determine the recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector.
[0054] The third aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the interpretation and recommendation method based on sentiment analysis as described in any one of the first aspect of the present invention.
[0055] It can be seen from the above technical solutions that the present invention has the following advantages:
[0056] The present invention determines the target item selected by the user in response to the item selection instruction input by the user; generates a corresponding item feature vector according to multiple item review information for the target item; generates a corresponding user feature vector according to multiple user review information associated with the user; projects the item feature vector and the user feature vector to a shared space to determine the shared hidden vector corresponding to the target item; determines the item review preference score and the user review preference score respectively according to the item review information and the user review information; and determines the recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector. Thus, the effective use of item reviews and user reviews is achieved, and the emotional information involved is integrated into the generation process of the recommendation information, thereby more effectively improving the generation quality of the explanation recommendation and improving the accuracy of the item recommendation. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0058] Figure 1 A flowchart of a method for explaining and recommending based on sentiment analysis provided in the first embodiment of the present invention;
[0059] Figure 2 A flowchart of a method for explaining and recommending based on sentiment analysis provided in the second embodiment of the present invention;
[0060] Figure 3An overall framework diagram of an explanation recommendation method based on sentiment analysis provided by an embodiment of the present invention;
[0061] Figure 4 This is a structural block diagram of an explanation recommendation device based on sentiment analysis provided in Example 3 of the present invention. DETAILED DESCRIPTION
[0062] Research on existing technologies usually focuses on how to provide competitive model prediction performance, but rarely considers improving user experience and trust. However, some researchers have realized the shortcomings of work in this field and proposed to use attention mechanisms, multi-modal, multi-view learning, multi-task learning and other technologies, combined with user ratings, comments or image information, to generate appropriate explanations for users' recommendation lists. However, although the above work has shown its effectiveness, it usually does not use sentiment or frequency information, and directly extracting comments from users' existing comments is prone to copyright issues, making it difficult to achieve diverse explainable recommendations under a fixed framework.
[0063] To this end, an embodiment of the present invention provides an explanation recommendation method, device and equipment based on sentiment analysis, which is used to solve the technical problem that existing recommendation schemes usually generate explanation sentences based on templates or short sentences, and do not utilize sentiment or comment information, resulting in low quality of generated explainable recommendations and inability to accurately screen out recommendation information that meets user needs.
[0064] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] See also Figure 1 , Figure 1 A flowchart of the steps of an explanation recommendation method based on sentiment analysis provided in Example 1 of the present invention.
[0066] The present invention provides an explanation recommendation method based on sentiment analysis, comprising the following steps:
[0067] Step 101, in response to an item selection instruction input by a user, determining a target item selected by the user;
[0068] The item selection instruction refers to the selection instruction generated when the user inputs a trigger instruction such as clicking or touching the multiple items displayed on the display screen into the interpretation and recommendation device based on sentiment analysis.
[0069] In the embodiment of the present invention, when the device receives an item selection instruction input by a user, it responds to the item selection instruction to determine the target item selected on the current display screen.
[0070] Step 102, generating a corresponding item feature vector according to multiple item review information for the target item;
[0071] Since users usually express their feelings or opinions about the item by writing reviews, and there may be multiple reviews for the same target item, it is difficult to quickly obtain the subsequent recommendation score if we process them one by one.
[0072] In order to improve the subsequent recommendation rate, after determining the target item selected by the user, we can further obtain multiple item review information about the target item, use multiple convolution kernels to analyze each item review information in the word dimension, extract features of the item review information from multiple angles, and perform aggregation connection to generate the item feature vector corresponding to the target item.
[0073] Step 103, generating a corresponding user feature vector according to multiple pieces of user comment information associated with the user;
[0074] At the same time, after the user selects the target item, based on the user ID corresponding to the user, multiple user comment information associated with the user can be obtained, and each user comment information can be analyzed according to the word dimension based on multiple convolution kernels to obtain the user feature vector corresponding to the user's associated comments from multiple angles.
[0075] Step 104, projecting the item feature vector and the user feature vector into a shared space to determine a shared hidden vector corresponding to the target item;
[0076] After obtaining the item feature vector and the user feature vector, in order to realize the interaction between the user and the item, both the item feature vector and the user feature vector can be projected into the shared space to simulate the interaction between the user and the item in the shared space, thereby determining the shared hidden vector corresponding to the target item.
[0077] Step 105, determining an item review preference score and a user review preference score respectively according to the item review information and the user review information;
[0078] In the specific implementation, comments will not only reflect the user's attention to the item, but also convey the user's emotional preferences. In order to obtain a more accurate description of the user's emotional preferences and item quality, the sentiment analysis function can be used to combine the item review information and the user review information to calculate the corresponding item review preference scores and user review preference scores respectively.
[0079] Step 106: Determine the recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector.
[0080] After obtaining the item review preference score, user review preference score and shared hidden vector, the recommendation score corresponding to the target item can be further calculated based on the above quantities, and the long short-term memory network can be combined based on the above quantities to generate a recommendation explanation corresponding to the recommendation score.
[0081] In the embodiment of the present invention, in response to the item selection instruction input by the user, the target item selected by the user is determined; according to multiple item review information for the target item, a corresponding item feature vector is generated; according to multiple user review information associated with the user, a corresponding user feature vector is generated; the item feature vector and the user feature vector are projected to a shared space to determine the shared hidden vector corresponding to the target item; according to the item review information and the user review information, the item review preference score and the user review preference score are determined respectively; based on the item review preference score, the user review preference score and the shared hidden vector, the recommendation information corresponding to the target item is determined. In this way, the effective use of item reviews and user reviews is achieved, so that the emotional information involved is integrated into the generation process of the recommendation information, thereby more effectively improving the generation quality of the explanation recommendation and improving the accuracy of the item recommendation.
[0082] See also Figure 2 , Figure 2 A flowchart of the steps of an explanation recommendation method based on sentiment analysis provided in Example 2 of the present invention.
[0083] The present invention provides an explanation recommendation method based on sentiment analysis, comprising:
[0084] Step 201, in response to an item selection instruction input by a user, determining a target item selected by the user;
[0085] In the embodiment of the present invention, the specific implementation process of step 201 is similar to step 101 and will not be repeated here.
[0086] Step 202, generating a corresponding item feature vector according to multiple item review information for the target item;
[0087] Optionally, step 202 may include the following sub-steps S11-S14:
[0088] S11, according to the position of the target item on the page, determine the item unique hot vector corresponding to the target item;
[0089] In the embodiment of the present invention, after receiving the item selection instruction input by the user, a unique hot vector of the item of corresponding specifications can be constructed according to the position of the target item on the current page.
[0090] For example, the current page includes 5 items, and the target item is in the third position, then the corresponding item unique hot vector can be constructed as [0, 0, 1, 0, 0].
[0091] S12, generating a corresponding item embedding vector based on the item unique hot vector and a preset item embedding layer weight matrix;
[0092] After obtaining the item one-hot vector, the item one-hot vector can be multiplied by the preset item embedding layer weight matrix to convert the item one-hot vector into the corresponding item embedding vector.
[0093] It should be noted that the weight matrix of the object embedding layer can be continuously updated and converged by performing network training in advance, and the specific value is not limited in the embodiment of the present invention.
[0094] For example, the item embedding layer weight vector W b for Item one-hot vector θ v is [0,0,1,0,0], then we can combine the corresponding conversion formula:
[0095] p v =W b ·θ v
[0096] Thus, the corresponding item embedding vector p is generated v is [0.5,1.0,0.9].
[0097] S13, using multiple preset convolution kernels to encode and convert all the item review words in all the item review information of the target item, and then concatenate them to obtain a corresponding item review vector;
[0098] Furthermore, S13 may include the following sub-steps:
[0099] Encode multiple item review words included in each item review information of the target item respectively to obtain multiple item review word embedding vectors;
[0100] Use all item review word embedding vectors to build the item review word embedding matrix;
[0101] The item review word embedding matrix is transformed and the maximum pooling operation is performed through a variety of preset convolution kernels to obtain multiple item review embedding vectors corresponding to the item review word embedding matrix;
[0102] Connect all item review embedding vectors to get the item review vector corresponding to the target item.
[0103] In an embodiment of the present invention, the target item usually has multiple item review information, each item review information includes multiple item review words. After obtaining multiple item review information of the target item, the item review words included in all the item review information can be encoded respectively to obtain multiple item review word embedding vectors. Then, the corresponding item review word embedding matrix is constructed using all the item review word embedding vectors; the item review word embedding matrix is transformed and the maximum pooling operation is performed respectively through multiple different convolution kernels to obtain the most important and representative multiple item review embedding vectors of the item review word embedding matrix from different angles of multiple convolution kernels, and finally all the item review embedding vectors are connected to obtain the item review vector corresponding to the target item.
[0104] In the specific implementation, the same item can be reviewed by multiple users. In order to obtain the overall preference of the item, the item review information corresponding to the target item can be processed by models such as TextCNN:
[0105]
[0106] Among them, ReLU is the activation function, M is the number of item review information corresponding to the target item v, * is the convolution operation, K j is the jth convolution kernel, is the item review word embedding matrix composed of the item review word embedding vectors converted from all item review words corresponding to the target item v, b j is the preset bias, c j is the item review embedding vector of the jth convolution kernel without the maximum pooling operation.
[0107] The maximum pooling operation is performed on the comment embedding vector of the jth convolution kernel to capture the most important and representative features, which can be as follows:
[0108]
[0109] in, is the item review embedding vector after the max pooling operation.
[0110] Target item v Final item review vector r v It is the concatenation of all the item review embedding vectors output from the maximum pooling layer of its n convolution kernels:
[0111]
[0112] Among them, ; represents the connection operation between feature vectors.
[0113] S14. Connect the item embedding vector and the item comment vector to obtain the item feature vector corresponding to the target item.
[0114] In the embodiment of the present invention, in order to better represent the quality of the target item, the item embedding vector and the item review vector may be connected to obtain a corresponding item feature vector.
[0115] Specifically, the item feature vector f v It can be expressed as: v =[p v ; r v ].
[0116] Step 203, generating a corresponding user feature vector according to multiple pieces of user comment information associated with the user;
[0117] Optionally, step 203 may include the following sub-steps S21-S24:
[0118] S21. Construct a user unique hot vector corresponding to the user according to a preset user identifier corresponding to the user;
[0119] In an example of the present invention, when a user logs in, a preset user identifier corresponding to the user may be obtained, and a user unique hot vector corresponding to the user may be constructed based on the position of the preset user identifier.
[0120] In the specific implementation, the user ID can also be grouped into 5 users. When receiving the user login, the user's group and position are determined. Assuming there are 5 users, the user with ID 2 can be represented by a one-hot vector θ u =[0,1,0,0,0], with a length of 5.
[0121] S22, generating a corresponding user embedding vector based on the user one-hot vector and a preset user embedding layer weight matrix;
[0122] After obtaining the user one-hot vector, it can be further combined with the user embedding layer weight matrix for matrix multiplication to generate the corresponding user embedding vector.
[0123] For example, the item embedding layer weight vector W a for Item one-hot vector θ u =[0,1,0,0,0], then we can combine the corresponding conversion formula:
[0124] p u =Wa ·θ u
[0125] Thus, the corresponding item embedding vector p is generated u is [0.2,0.2,0.8].
[0126] S23, using a plurality of preset convolution kernels to encode and convert all user comment words in all user comment information associated with the user, and then concatenate them to obtain corresponding user comment vectors;
[0127] Further, S23 may include the following sub-steps:
[0128] Encode multiple user comment words included in each user comment information associated with the user respectively to obtain multiple user comment word embedding vectors;
[0129] Use all user comment word embedding vectors to build a user comment word embedding matrix;
[0130] The user comment word embedding matrix is transformed by a variety of preset convolution kernels and the maximum pooling operation is performed to obtain multiple user comment embedding vectors corresponding to the user comment word embedding matrix;
[0131] Connect all user comment embedding vectors to get the user comment vector corresponding to the user.
[0132] In the embodiment of the present invention, the same user can usually be associated with multiple user comment information, each of which includes multiple user comment words. After obtaining multiple user comment information of the target user, the user comment words included in all the user comment information can be encoded respectively to obtain multiple user comment word embedding vectors. Then all the user comment word embedding vectors are used to construct the corresponding user comment word embedding matrix; the user comment word embedding matrix is transformed by multiple different convolution kernels and the maximum pooling operation is performed to obtain the most important and representative multiple user comment embedding vectors of the user comment word embedding matrix from different angles of multiple convolution kernels, and finally all the user comment embedding vectors are connected to obtain the user comment vector corresponding to the target user.
[0133] In the specific implementation, the same user can comment on multiple items separately. In order to obtain the overall preference of the user, the user comment information corresponding to the user can be processed by models such as TextCNN:
[0134]
[0135] Among them, ReLU is the activation function, M is the number of user comments corresponding to user v, * is the convolution operation, K j is the jth convolution kernel, is the user comment word embedding matrix composed of the user comment word embedding vectors converted from all user comment words corresponding to user u, b j is the preset bias, c j is the user comment embedding vector of the jth convolution kernel without the maximum pooling operation.
[0136] Perform a maximum pooling operation on the user review embedding vector of the jth convolution kernel to capture the most important and representative features, as follows:
[0137]
[0138] in, is the user comment embedding vector after the maximum pooling operation.
[0139] The final user comment vector r of user u u It is the concatenation of all the user comment embedding vectors output from the maximum pooling layer of its n convolution kernels:
[0140]
[0141] Among them, ; represents the connection operation between feature vectors.
[0142] S24. Connect the user embedding vector and the user comment vector to obtain the user feature vector corresponding to the user.
[0143] In the embodiment of the present invention, in order to better represent user preferences, the user embedding vector and the user comment vector may be connected to obtain a corresponding user feature vector.
[0144] Specifically, the user feature vector f u It can be expressed as: u =[p u ; r u ].
[0145] Step 204, projecting the item feature vector and the user feature vector into a shared space to determine a shared hidden vector corresponding to the target item;
[0146] Optionally, step 204 may include the following sub-steps:
[0147] Project item feature vectors and user feature vectors into a shared space;
[0148] Calculate the item vector product between the preset item weight matrix and the item feature vector;
[0149] Calculate the user vector product between the preset user weight matrix and the user feature vector;
[0150] The interaction vector sum is determined by using the item vector product, the user vector product and the preset bias matrix;
[0151] The interaction vectors and are mapped using a preset activation function to determine the shared hidden vector corresponding to the target item.
[0152] In one example of the present invention, in order to simulate the interaction between a user and a target item, the above-mentioned item feature vector and user feature vector can be projected into a shared space, and the item vector product between a preset item weight matrix and the item feature vector is calculated, as well as the user vector product between a preset user weight matrix and the user feature vector is calculated. Then, the item vector product, the user vector product and the preset bias matrix are used to determine the interaction vector sum; finally, the preset activation function is used to map the interaction vector sum to determine the shared hidden vector corresponding to the target item.
[0153] In a specific implementation, both the user feature vector and the item feature vector can be projected into a shared latent space, and the interaction between the user and the target item can be simulated in the space:
[0154] f uv =ReLU(W u ·f u +W v ·f v +b a )
[0155] Among them, W u is the user weight matrix, W v is the item weight matrix, b a is the preset bias matrix, f uv is the shared hidden vector.
[0156] Step 205, calculating the sentiment score of the item review corresponding to each item review information by using a preset TextBlob function;
[0157] Step 206, calculating the user comment sentiment score corresponding to each piece of user comment information by using the TextBlob function;
[0158] In the embodiment of the present invention, the item review word embedding matrix can be Divide to obtain the item review information matrix r corresponding to each item review information vi , similarly for the user comment word embedding matrix Divide and obtain the user comment information matrix r corresponding to each user comment information ui . Then use the TextBlob function to calculate the sentiment scores of the item reviews and user reviews for each item review and each user review:
[0159] s vi =F(r vi )
[0160] s ui =F(r ui )
[0161] Among them, s vi is the sentiment score of the item review corresponding to the i-th item review information, s ui is the user comment sentiment score corresponding to the i-th user comment information, and the function F can be any function that can be used to analyze the sentiment polarity in each comment to obtain the sentiment score, such as the TextBlob function.
[0162] Step 207, calculating the mean of all item review sentiment scores to obtain an item review preference score;
[0163] In the embodiment of the present invention, in order to comprehensively analyze the preferences and opinions of different users in the review information of the target item, the average of the sentiment scores of all item reviews can be calculated to obtain the item review preference score s v :
[0164]
[0165] Where n is the total number of item review information.
[0166] Step 208, calculating the mean of all user comment sentiment scores to obtain user comment preference scores;
[0167] In the embodiment of the present invention, in order to determine a more accurate description of the user's emotional preference and the quality of the item, the average of the emotional scores of all user comments can be calculated to obtain the user comment preference score s u :
[0168]
[0169] Where n is the total number of user comments.
[0170] s u is the average sentiment score of all comments written by user u, a floating point value in [-1.0, 1.0].
[0171] Step 209: Determine the recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector.
[0172] Optionally, the recommendation information includes a recommendation score and a recommendation explanation; step 209 may include the following sub-steps S31-S34:
[0173] S31, calculating the shared vector product between the preset weight matrix and the shared hidden vector;
[0174] S32, calculating the sum of the shared vector product, the item review preference score, and the user review preference score to obtain a recommendation score corresponding to the target item;
[0175] In one example of the present invention, in order to indicate the preference between the target item and the user, a recommendation score may be used. It is expressed in the form of:
[0176]
[0177] in, is the recommendation score, W uv is the preset weight matrix.
[0178] S33, sequentially connect the user feature vector, the item feature vector, the user review preference score, the item review preference score and the shared hidden vector to obtain an initial hidden state;
[0179] In the embodiment of the present invention, the initial hidden state may be as follows:
[0180] h0=[f u ;f v ;s u ;s v ;f uv ]
[0181] S34. By combining the preset long short-term memory network model with the initial hidden state, multiple predicted words are selected from the preset corpus to generate recommended explanations.
[0182] Further, S34 may include the following sub-steps:
[0183] Through the preset long short-term memory network model combined with the initial hidden state, multiple candidate words are selected from the preset corpus at each time step;
[0184] Calculate the probability of each candidate word appearing at each time step;
[0185] The candidate word with the highest probability of appearing in each time step is selected as the predicted word to generate a recommended explanation.
[0186] In a specific implementation, the generation process of the recommended explanation can be as follows:
[0187] For the explanation generation task, in addition to the identity features of users / items, sentiment preferences, and comment information, the shared hidden vector is also taken into account because it provides contextual information for explanation generation. Here, the explanation generation task is built on the widely used long short-term memory network (LSTM), which includes input gates, output gates, forget gates, and cell states. The implementation of LSTM is based on the following formula:
[0188] i t =sigmoid(W ix x t +W ih h t-1 +b i )
[0189] i t =sigmoid(W ix x t +W ih h t-1 +b i )
[0190] o t =sigmoid(W ox x t +W oh h t-1 +b o )
[0191] c t =f t ⊙c t-1 +i t ⊙tanh(W cx x t +W ch h t-1 +b c )
[0192] h t =o t ⊙tanh(c t )
[0193] Among them, i t 、f t 、c t and t are the hidden vectors of the input gate, forget gate, cell state, and output gate at the t-th time step, respectively.
[0194] W * and b * is the weight matrix and bias. sigmoid and tanh are activation functions, x t and h t are the input and hidden state at the t-th time step, and ⊙ is the dot product of the elements.
[0195] z t =W zt o t +b zt
[0196]
[0197]
[0198] Here, D refers to the corpus, which consists of words that appear more than 10 times in all reviews in the training set. t represents the output of the t-th LSTM unit after a linear layer, and d is the vocabulary size of corpus D. Indicates that in the tth time step, when the input x t The probability of the word j appearing is represents the word predicted at the tth time step, and Corresponding to the output z t The embedding representation of the word at the kth and jth positions, b zt , Wzt is the bias and weight matrix of this layer; is the tth word predicted by the neural network.
[0199] Optionally, in another example of the present invention, before the present invention is used, multiple preset weight matrices may be trained and converged to obtain more accurate weights. The specific process may be as follows:
[0200] Smooth L1 can be used as the loss function, which has the characteristics of fast convergence, insensitivity to outliers, and relatively small gradient changes.
[0201]
[0202] where (u,v) is the user-item pair in the training set, and y uv is the true label of the rating, L r is the loss function for the rating prediction task. For the explanation generation task, the negative log-likelihood function is used as the loss function:
[0203]
[0204] Among them, L g is the loss function of the explanation generation task, Ω is the training dataset, and e uv is the true explanation sentence (i.e., the review of item v written by user u). The final objective function of the model is the weighted sum of the loss functions in the two tasks:
[0205]
[0206] Where J is the final loss function of the model. λ is the weight of the explanation generation task. Θ represents all learnable parameters of the model, such as the item embedding layer weight matrix, the user embedding layer weight matrix, the convolution kernel, the activation function, the preset bias, the item weight matrix, the user weight matrix, the preset bias matrix, and the preset weight matrix. u and P v are the embedding matrices of users and items respectively. Θ ,λ u and λ v is the weight of the regularization term. During model learning and inference, the rating prediction and explanation generation tasks are integrated into an overall framework for joint learning, which can exploit the correlation between the two tasks.
[0207] Given a training set Ω = [user set U, item set V, corresponding rating Y, corresponding comment E] and a learning rate η, first randomly initialize all parameters Θ, load the pre-trained word vector sentence to encode all comments E as vectors. Get a mini-batch of data B in Ω, and calculate the loss L of the rating prediction task according to the above formula r and the loss L for the explanation generation task g , and the loss J of the final model is obtained. Back propagation is performed through the Adam optimization algorithm, and the data are repeatedly trained. By continuously correcting the weight matrix and bias of each layer, the loss J is minimized by gradient descent until convergence, that is, no obvious changes occur, and the training ends.
[0208] After the training is completed, the learnable parameters of the model will no longer change. The unique hot vector of the ID of user u and item v is used as the input of the model. After the model calculation, the predicted score can be obtained. and the corresponding recommended explanation
[0209] In the embodiment of the present invention, in response to the item selection instruction input by the user, the target item selected by the user is determined; according to multiple item review information for the target item, a corresponding item feature vector is generated; according to multiple user review information associated with the user, a corresponding user feature vector is generated; the item feature vector and the user feature vector are projected to a shared space to determine the shared hidden vector corresponding to the target item; according to the item review information and the user review information, the item review preference score and the user review preference score are determined respectively; based on the item review preference score, the user review preference score and the shared hidden vector, the recommendation information corresponding to the target item is determined. In this way, the effective use of item reviews and user reviews is achieved, so that the emotional information involved is integrated into the generation process of the recommendation information, thereby more effectively improving the generation quality of the explanation recommendation and improving the accuracy of the item recommendation.
[0210] See also Figure 3 , Figure 3 An overall framework diagram of an explanation recommendation method based on sentiment analysis provided in an embodiment of the present invention.
[0211] In the embodiment of the present invention, in the encoder layer, when user u selects the target item v, the corresponding user comment information and item comment information are obtained; the user comment information is converted into a one-to-one corresponding user comment sentiment score s at the encoder layer. ui and user review information matrix r ui , after conversion through the TextCNN model, the corresponding user comment vector r is obtained u ;
[0212] In the shared layer, u The user embedding vector p corresponding to the user u After the connection, we get the user feature vector f u ; The processing process for the item review information associated with the target item is similar, and the item feature vector f is obtained v ; injected by activation function, i.e. f uv =ReLU(W u ·f u +W v ·f v +b a ), the shared hidden vector f is obtained at the decoder layer uv , and compare it with the user review preference score s u and item review preference score s v Input the perceptron and get the recommendation score
[0213] For the recommended explanation, f uv Combining all the parameters in the shared layer, the initial hidden state h0 is constructed, combined with the input STR, and after LSTM processing, the recommended explanation "its dishes are very distinctive" is obtained.
[0214] See also Figure 4 , Figure 4 This is a structural block diagram of an explanation recommendation device based on sentiment analysis provided in Example 3 of the present invention.
[0215] The embodiment of the present invention provides an explanation recommendation device based on sentiment analysis, comprising:
[0216] The target item selection module 401 is used to determine the target item selected by the user in response to the item selection instruction input by the user;
[0217] An item feature vector generating module 402 is used to generate a corresponding item feature vector according to a plurality of item review information for a target item;
[0218] A user feature vector generation module 403 is used to generate a corresponding user feature vector according to multiple user comment information associated with the user;
[0219] A shared hidden vector determination module 404 is used to project the item feature vector and the user feature vector into a shared space to determine a shared hidden vector corresponding to the target item;
[0220] A preference score determination module 405, for determining an item review preference score and a user review preference score, respectively, based on the item review information and the user review information;
[0221] The recommendation information generating module 406 is used to determine the recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector.
[0222] Optionally, the item feature vector generation module 402 includes:
[0223] The item one-hot vector construction submodule is used to determine the item one-hot vector corresponding to the target item according to the position of the page where the target item is located;
[0224] The item embedding vector generation submodule is used to generate the corresponding item embedding vector based on the item one-hot vector and the preset item embedding layer weight matrix;
[0225] The item convolution kernel processing submodule is used to use a variety of preset convolution kernels to encode and convert all item review words in all item review information of the target item, and then connect them to obtain the corresponding item review vector;
[0226] The item feature vector connection submodule is used to connect the item embedding vector and the item comment vector to obtain the item feature vector corresponding to the target item.
[0227] Optionally, the item convolution kernel processing submodule is specifically used for:
[0228] Encode multiple item review words included in each item review information of the target item respectively to obtain multiple item review word embedding vectors;
[0229] Use all item review word embedding vectors to build the item review word embedding matrix;
[0230] The item review word embedding matrix is transformed and the maximum pooling operation is performed through a variety of preset convolution kernels to obtain multiple item review embedding vectors corresponding to the item review word embedding matrix;
[0231] Connect all item review embedding vectors to get the item review vector corresponding to the target item.
[0232] Optionally, the user feature vector generating module 403 includes:
[0233] A user one-hot vector construction submodule is used to construct a user one-hot vector corresponding to the user according to a preset user identifier corresponding to the user;
[0234] A user embedding vector generation submodule is used to generate a corresponding user embedding vector based on the user one-hot vector and a preset user embedding layer weight matrix;
[0235] The user convolution kernel processing submodule is used to use a variety of preset convolution kernels to encode and convert all user comment words in all user comment information associated with the user, and then connect them to obtain the corresponding user comment vector;
[0236] The user feature vector connection submodule is used to connect the user embedding vector and the user comment vector to obtain the user feature vector corresponding to the user.
[0237] Optionally, the user convolution kernel processing submodule is specifically used for:
[0238] Encode multiple user comment words included in each user comment information associated with the user respectively to obtain multiple user comment word embedding vectors;
[0239] Use all user comment word embedding vectors to build a user comment word embedding matrix;
[0240] The user comment word embedding matrix is transformed by a variety of preset convolution kernels and the maximum pooling operation is performed to obtain multiple user comment embedding vectors corresponding to the user comment word embedding matrix;
[0241] Connect all user comment embedding vectors to get the user comment vector corresponding to the user.
[0242] Optionally, the preference score determination module 405 includes:
[0243] The item review sentiment score calculation submodule is used to calculate the item review sentiment score corresponding to each item review information through the preset TextBlob function;
[0244] The user comment sentiment score calculation submodule is used to calculate the user comment sentiment score corresponding to each user comment information through the TextBlob function;
[0245] The item review preference score calculation submodule is used to calculate the mean of all item review sentiment scores to obtain the item review preference score;
[0246] The user review preference score calculation submodule is used to calculate the mean of all user review sentiment scores to obtain the user review preference score.
[0247] Optionally, the recommendation information includes a recommendation score and a recommendation explanation; the recommendation information generation module 406 includes:
[0248] A shared vector product calculation submodule, used to calculate the shared vector product between a preset weight matrix and a shared hidden vector;
[0249] The recommendation score calculation submodule is used to calculate the sum of the shared vector product, the item review preference score and the user review preference score to obtain the recommendation score corresponding to the target item;
[0250] The initial hidden state construction submodule is used to sequentially connect the user feature vector, the item feature vector, the user review preference score, the item review preference score and the shared hidden vector to obtain the initial hidden state;
[0251] The recommended explanation generation submodule is used to generate recommended explanations by selecting multiple predicted words from a preset corpus through a preset long short-term memory network model combined with an initial hidden state.
[0252] Optionally, the recommended explanation generation submodule is specifically used for:
[0253] Through the preset long short-term memory network model combined with the initial hidden state, multiple candidate words are selected from the preset corpus at each time step;
[0254] Calculate the probability of each candidate word appearing at each time step;
[0255] The candidate word with the highest probability of appearing in each time step is selected as the predicted word to generate a recommended explanation.
[0256] An embodiment of the present invention provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the interpretation recommendation method based on sentiment analysis as described in any embodiment of the present invention.
[0257] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0258] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0259] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0260] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0261] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An explanation recommendation method based on sentiment analysis, characterized in that: include: In response to an item selection instruction input by a user, determining a target item selected by the user; Generate a corresponding item feature vector according to multiple item review information for the target item; Generate a corresponding user feature vector according to the multiple pieces of user comment information associated with the user; Projecting the item feature vector and the user feature vector into a shared space to determine a shared hidden vector corresponding to the target item; Determining an item review preference score and a user review preference score, respectively, according to the item review information and the user review information; Determining recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector; The projecting the item feature vector and the user feature vector to a shared space to determine a shared hidden vector corresponding to the target item includes: f uv =ReLU(W u ·f u +W v ·f v +b a ) Among them, f u is the user feature vector, f v is the item feature vector, W u is the preset user weight matrix, W v is the preset item weight matrix, b a is the preset bias matrix, f uv is the shared hidden vector; The shared hidden vector refers to a vector that simulates the interaction between the user and the target object in the shared space; The step of determining the item review preference score and the user review preference score respectively according to the item review information and the user review information comprises: Calculate the sentiment score of the item review corresponding to each item review information by using the preset TextBlob function; Calculate the user comment sentiment score corresponding to each piece of the user comment information by using the TextBlob function; Calculate the average of all the sentiment scores of the item reviews to obtain the item review preference score; The average of all the user comment sentiment scores is calculated to obtain the user comment preference score.
2. The method according to claim 1, characterized in that: The step of generating a corresponding item feature vector according to the plurality of item review information for the target item comprises: Determine the item unique-hot vector corresponding to the target item according to the position of the page where the target item is located; Generate a corresponding item embedding vector based on the item one-hot vector and a preset item embedding layer weight matrix; Using a plurality of preset convolution kernels to encode and convert all the item review words in all the item review information of the target item, and then concatenate them to obtain a corresponding item review vector; The item embedding vector and the item review vector are connected to obtain an item feature vector corresponding to the target item.
3. The method according to claim 2, characterized in that The step of using a plurality of preset convolution kernels to encode and convert all the item review words in all the item review information of the target item and then concatenate them to obtain the corresponding item review vector includes: Encoding the multiple item review words included in each item review information for the target item respectively to obtain multiple item review word embedding vectors; Using all the item review word embedding vectors to construct an item review word embedding matrix; The item review word embedding matrix is transformed by using a plurality of preset convolution kernels and a maximum pooling operation is performed to obtain a plurality of item review embedding vectors corresponding to the item review word embedding matrix; Connect all the item review embedding vectors to obtain the item review vector corresponding to the target item.
4. The method according to claim 1, characterized in that The step of generating a corresponding user feature vector according to the plurality of user comment information associated with the user comprises: According to the preset user identifier corresponding to the user, construct a user one-hot vector corresponding to the user; Based on the user one-hot vector and a preset user embedding layer weight matrix, generating a corresponding user embedding vector; Using a plurality of preset convolution kernels, all user comment words in all user comment information associated with the user are respectively converted by encoding and then connected to obtain corresponding user comment vectors; The user embedding vector and the user comment vector are connected to obtain a user feature vector corresponding to the user.
5. The method according to claim 4, characterized in that The step of using a plurality of preset convolution kernels to encode and convert all user comment words in all user comment information associated with the user and then connect them to obtain corresponding user comment vectors includes: Encoding the plurality of user comment words included in each of the user comment information associated with the user respectively to obtain a plurality of user comment word embedding vectors; Constructing a user comment word embedding matrix using all of the user comment word embedding vectors; The user comment word embedding matrix is transformed by using a plurality of preset convolution kernels and a maximum pooling operation is performed to obtain a plurality of user comment embedding vectors corresponding to the user comment word embedding matrix; Connect all the user comment embedding vectors to obtain the user comment vector corresponding to the user.
6. The method according to claim 1, characterized in that The recommendation information includes a recommendation score and a recommendation explanation; the step of determining the recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector includes: Calculating a shared vector product between a preset weight matrix and the shared hidden vector; Calculating the sum of the shared vector product, the item review preference score, and the user review preference score to obtain a recommendation score corresponding to the target item; sequentially connecting the user feature vector, the item feature vector, the user review preference score, the item review preference score and the shared hidden vector to obtain an initial hidden state; By combining the preset long short-term memory network model with the initial hidden state, multiple predicted words are selected from the preset corpus to generate recommended explanations.
7. The method according to claim 6, characterized in that The step of selecting a plurality of predicted words from a preset corpus to generate a recommended explanation by combining the preset long short-term memory network model with the initial hidden state includes: By combining the initial hidden state with the preset long short-term memory network model, multiple candidate words are selected from the preset corpus at each time step; Calculate the probability of occurrence of each candidate word at each time step; The candidate word with the highest occurrence probability in each time step is selected as the predicted word to generate a recommended explanation.
8. An explanation recommendation device based on sentiment analysis, characterized in that: include: A target item selection module, configured to determine a target item selected by the user in response to an item selection instruction input by the user; An item feature vector generation module, used to generate a corresponding item feature vector according to a plurality of item review information for the target item; A user feature vector generation module, used to generate a corresponding user feature vector according to a plurality of user comment information associated with the user; A shared hidden vector determination module, used to project the item feature vector and the user feature vector into a shared space to determine a shared hidden vector corresponding to the target item; A preference score determination module, used to determine an item review preference score and a user review preference score, respectively, based on the item review information and the user review information; A recommendation information generating module, configured to determine the recommendation information corresponding to the target item based on the item review preference score, the user review preference score and the shared hidden vector; The projecting the item feature vector and the user feature vector to a shared space to determine a shared hidden vector corresponding to the target item includes: f uv =ReLU(W u ·f u +W v ·f v +b a ) Among them, f u is the user feature vector, f v is the item feature vector, W u is the preset user weight matrix, W v is the preset item weight matrix, b a is the preset bias matrix, f uv is the shared hidden vector; The shared hidden vector refers to a vector that simulates the interaction between the user and the target object in the shared space; The preference score determination module comprises: The item review sentiment score calculation submodule is used to calculate the item review sentiment score corresponding to each item review information by using a preset TextBlob function; A user comment sentiment score calculation submodule, used to calculate the user comment sentiment score corresponding to each piece of the user comment information through the TextBlob function; The item review preference score calculation submodule is used to calculate the average of all the item review sentiment scores to obtain the item review preference score; The user review preference score calculation submodule is used to calculate the mean of all the user review sentiment scores to obtain the user review preference score.
9. An electronic device, characterized in that: It comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the interpretation recommendation method based on sentiment analysis as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Commodity recommendation method and commodity recommendation device based on comment text sentiment analysis
CN110517121A
Information recommendation method and system based on convolutional neural network and noise reduction auto-encoder
CN111127146A