Product recommendation method and system
By using the RoBERTa model and multi-layer CNN network for dynamic word vector embedding and feature extraction, combined with attention mechanism and MLP interactive network, the problem of insufficient static encoding and feature interaction in the existing recommendation algorithm is solved, and the accuracy and interpretability of product recommendations are improved.
Patent Information
- Application Number
- CN202210813884.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-12
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-07-12
AI Technical Summary
When processing comment texts, existing recommendation algorithms have problems such as static encoding that cannot accurately express word ambiguousness and contextual differences, ignoring user comment characteristics, and insufficient feature interaction, resulting in insufficient recommendation performance.
The RoBERTa model is used for pre-training dynamic word vector embedding, combined with multi-layer CNN network for feature extraction, and an interactive network based on attention mechanism and MLP is built to improve the feature interaction capabilities of users and product reviews.
It improves the comment expression ability and interpretability of the recommendation system, improves the accuracy of score prediction, solves the limitations of static encoding and insufficient feature interaction, and achieves more accurate product recommendations.
Smart Images

Figure CN115187340B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of product recommendation, and in particular to a product recommendation method and system. Background Art
[0002] The statements in this section merely mention background art related to the present invention and do not necessarily constitute prior art.
[0003] With the rapid development of internet technology, our lives have undergone tremendous changes. Data in many areas of life, such as healthcare, shopping, and entertainment, has exploded exponentially. Faced with this vast amount of data, how to quickly and accurately obtain effective data and utilize it to facilitate users' lives has become a hot research topic. The emergence of recommender systems addresses this issue by filtering data based on user behavior history and preferences, providing users with precise, personalized recommendations.
[0004] Among traditional recommendation algorithms, collaborative filtering (CF) is the most widely used and once dominated. It models user preferences and item attributes based on historical user behavior. By learning the explicit and implicit interactions between users and items, it analyzes user preferences and provides recommendations based on group preferences. Its principles are now also widely used. Matrix factorization (MF) maps user preferences and item attributes into two low-rank matrices, representing them as latent factor vectors in a latent space. The derived PMF model leverages the principles of matrix factorization and combines it with Gaussian probability functions to derive the difference between predicted and actual values. While matrix factorization and its derivatives have achieved some success in recommendation systems, they suffer from limitations in low-order features and lack the ability to extract interactions with higher-order features, resulting in limited recommendation performance.
[0005] Most traditional recommendation algorithms focus on rating data, but a large amount of derivative information is generated during the user's online behavior. This derivative information can well reflect the user's preferences. Effective use of this information can improve the interpretability of the recommendation system, alleviate data sparsity and cold start problems, thereby greatly improving the performance of the recommendation system and making accurate recommendations for users. Among them, review text information is the most common derivative information, which contains a large amount of semantic content that is full of user emotional preferences, including different users' preferences for different products, greatly improving the interpretability of the recommendation system.
[0006] Recommendation algorithms that use review text can explain the reasons behind recommendations. The LDA model is an influential model that leverages topic distribution to capture relevant information about users and items, thereby improving the performance of recommendation systems. However, this approach only focuses on topic distribution and ignores the specific semantic content. HFT, an early model that combines reviews and ratings for recommendation, takes user and item review data as input, interacts with rating data, and fuses latent factors to produce a result.
[0007] With the rapid development of deep learning in recent years, it has achieved great success in various fields such as image processing and natural language processing. Especially in natural language processing, taking advantage of its advantages in text mining and processing, applying its technology to review-based recommendation systems has also become a research hotspot. CNN, RNN, attention mechanism, and in recent years, Transformer, BERT and its various variants have been applied to review-based recommendation systems due to their advantages in processing text, and have achieved certain results. ConvMF (convolution matrix factorization) proposed by Kim et al. integrates convolutional networks and matrix decomposition models, uses convolutional networks to extract text features, and uses matrix models for multi-rating prediction. The disadvantage of this model is that it only uses the review information of items and ignores the review information of users, and often ignores the user's preferences.
[0008] DeepCoNN is a model proposed by Zheng in 2017. It uses CNN to extract features of users and items, and uses FM to make rating recommendations after interaction. The dual-tower network proposed by this model has a great influence on subsequent models. The NARRE model proposed by Chen et al. is based on the DeepCoNN model. It introduces an attention mechanism to capture important features in text reviews, and finally uses evidence decomposition to obtain ratings. This model greatly improves the recommendation performance. The HAUP model uses a bidirectional gated recurrent network (Bi-GRU) to process long texts, mine the relationship between text information, and obtain good recommendation performance. The CARP model proposed by Li et al. uses capsule networks to analyze user emotions and understand user preferences to improve the interpretability of recommendations. However, the above work also has some limitations:
[0009] Most previous work used static encoding to represent text embedding vectors when encoding text. For example, static encoding technologies such as glove and word2vec are widely used for pre-training in deep learning models such as Conv and DeepCoNN. These technologies cannot accurately express the meaning of the same word in different contexts and have limited ability to convey word polysemy, resulting in deviations in expressing the meaning of sentences and thus deviations in the recommendation process, affecting the performance of the recommendation model.
[0010] In the process of text feature extraction, many models regard the extraction of user and item reviews as equivalent. In fact, user reviews should be mined more deeply than item reviews, and attribute information should be extracted from item reviews, while the ability to extract features of user preferences is limited.
[0011] Most review-based recommendation systems using dual-channel parallel models directly predict ratings after simple concatenation after feature extraction, ignoring the sufficiency of the interaction between user and item features and the degree of feature contribution. Summary of the Invention
[0012] To address the shortcomings of the existing technology, the present invention provides a product recommendation method and system. This method uses the dynamic word vector pre-training model RoBERTa to preprocess user and item review text, converting the text data into word vectors. A multi-layer CNN network is then used to extract features at different scales. An interactive network based on an attention mechanism and MLP is then used to further interact and connect features, highlighting important information in the text and suppressing noise. Finally, a regression model is used to predict ratings and demonstrate the model's performance. This method not only dynamically learns relevant information about reviews but also achieves superior performance in feature extraction and interaction.
[0013] In a first aspect, the present invention provides a product recommendation method;
[0014] A product recommendation method, comprising:
[0015] Get user reviews and product reviews;
[0016] User reviews and product reviews are input into the trained product recommendation model to output product recommendation results. The working principle of the trained product recommendation model includes the following:
[0017] Encode user comments and product reviews respectively to obtain user comment encoding results and product comment encoding results;
[0018] Perform feature extraction on the encoding results of user comments and product comments respectively to obtain user comment features and product comment features;
[0019] Perform weighted interactive fusion on user review features and product review features, and extract the concatenation vector of user reviews and item reviews from the fusion results;
[0020] Predict the score of the concatenated vector, sort the products in descending order of score, and output a list of recommended products.
[0021] In a second aspect, the present invention provides a product recommendation system;
[0022] A product recommendation system, comprising:
[0023] An acquisition module is configured to: acquire user comments and product reviews;
[0024] The recommendation module is configured to input user reviews and product reviews into a trained product recommendation model and output product recommendation results. The trained product recommendation model operates as follows:
[0025] Encode user comments and product reviews respectively to obtain user comment encoding results and product comment encoding results;
[0026] Perform feature extraction on the encoding results of user comments and product comments respectively to obtain user comment features and product comment features;
[0027] Perform weighted interactive fusion on user review features and product review features, and extract the concatenation vector of user reviews and item reviews from the fusion results;
[0028] Predict the score of the concatenated vector, sort the products in descending order of score, and output a list of recommended products.
[0029] In a third aspect, the present invention further provides an electronic device, comprising:
[0030] a memory for non-transitory storage of computer-readable instructions; and
[0031] a processor for executing said computer-readable instructions,
[0032] When the computer-readable instructions are executed by the processor, the method described in the first aspect is executed.
[0033] In a fourth aspect, the present invention further provides a storage medium that non-temporarily stores computer-readable instructions, wherein when the non-temporary computer-readable instructions are executed by a computer, the instructions of the method described in the first aspect are executed.
[0034] In a fifth aspect, the present invention further provides a computer program product, comprising a computer program, wherein the computer program is used to implement the method described in the first aspect when running on one or more processors.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] 1. Use the RoBERTa model for pre-training to obtain comment embeddings, accurately capture the semantics of words in different contexts, solve problems such as polysemy and contextual expression limitations in different contexts, and improve the expressiveness and interpretability of comments.
[0037] 2. Use CNN networks of different scales for feature extraction and representation. A single-layer CNN is used to extract item attribute information for item reviews, while a multi-scale CNN is used to extract features of different periods for user reviews, making the extraction of review text more reasonable and effective.
[0038] 3. Considering the insufficient interaction between user and item features during parallel feature concatenation and the importance of words in review texts, we proposed an interaction network based on the attention mechanism and MLP to capture the varying importance between users and items, fully utilizing the interaction between features to improve model performance and enhance rating prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0040] Figure 1 This is a flow chart of the method of embodiment 1;
[0041] Figure 2 This is a comparison diagram of the MSE between the various models in Example 1;
[0042] FIG3( a ) is a schematic diagram of convolutional layers of five different scales for extracting features from user comments in Example 1;
[0043] FIG3( b ) is a schematic diagram of a single convolutional layer for extracting features from item reviews in Example 1. DETAILED DESCRIPTION
[0044] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.
[0045] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0046] In the absence of conflict, the embodiments of the present invention and the features thereof may be combined with each other.
[0047] All data in this embodiment is obtained in compliance with laws and regulations and based on the consent of the user, and is used legally.
[0048] Example 1
[0049] This embodiment provides a product recommendation method;
[0050] like Figure 1 As shown, a product recommendation method includes:
[0051] S101: Obtain user reviews and product reviews;
[0052] S102: Input user comments and product reviews into the trained product recommendation model and output product recommendation results. The working principle of the trained product recommendation model includes:
[0053] Encode user comments and product reviews respectively to obtain user comment encoding results and product comment encoding results;
[0054] Perform feature extraction on the encoding results of user comments and product comments respectively to obtain user comment features and product comment features;
[0055] Perform weighted interactive fusion on user review features and product review features, and extract the concatenation vector of user reviews and item reviews from the fusion results;
[0056] Predict the score of the concatenated vector, sort the products in descending order of score, and output a list of recommended products.
[0057] Furthermore, the network structure of the product recommendation model includes:
[0058] Two parallel branches;
[0059] The first branch includes a first encoder, a first feature extractor, and a first multilayer perceptron connected in sequence;
[0060] The second branch includes a second encoder, a second feature extractor, and a second multilayer perceptron connected in sequence;
[0061] The output end of the first multilayer perceptron and the output end of the second multilayer perceptron are both connected to the input end of the attention mechanism layer;
[0062] The output end of the first multilayer perceptron, the output end of the second multilayer perceptron, and the output end of the attention mechanism layer are all connected to the input end of the adder;
[0063] An output terminal of the adder is connected to an input terminal of the third multilayer perceptron;
[0064] The output end of the third multilayer perceptron is connected to the input end of the loss function layer, and the output end of the loss function layer is connected to the output layer.
[0065] Furthermore, the first encoder and the second encoder are both implemented using the RoBERTa model.
[0066] RoBERTa is an improved version of BERT. It is a text pre-training model and a robustly optimized BERT pre-training model.
[0067] Furthermore, the first feature extractor includes five parallel convolutional layers; the user representation is obtained by splicing the results captured by five CNNs of different scales; and the convolution kernel sizes of the five parallel convolutional layers are different.
[0068] The convolution kernel sizes of the five convolutional layers are 1*1, 3*1, 5*1, 7*1, and 10*1, respectively.
[0069] Furthermore, the second feature extractor is implemented using a single-layer convolutional neural network. A single-layer convolutional neural network has only one convolutional layer.
[0070] Furthermore, the user comments and product reviews are encoded respectively to obtain user comment encoding results and product comment encoding results; specifically including:
[0071] Use the RoBERTa model to encode user comments and obtain the user comment encoding results;
[0072] The RoBERTa model is used to encode product reviews and obtain the product review encoding results.
[0073] For example, we read the review information in the dataset, perform some preprocessing on the read information, filter out useless symbols in the reviews, supplement and extract the words in each review, and aggregate the user reviews u and the item reviews p to construct the user review text dataset D. u =(u1, u2, ..., u n ), and the item review text dataset D p =(p1, p2, ..., p k ). Where u1 represents a comment on an item by a user, n represents the number of comments in the comment set, p1 represents the comment on the item, and k represents the maximum number of comments on the same item. The present invention retains the original comment, does not delete stop words, and uses the RoBERTa model for encoding. Compared with traditional encoding technology, RoBERTa adopts a dynamic masking method to generate a new masking pattern for each sequence input to the model. In this way, in the process of continuous input of a large amount of data, the model will use different masking strategies, learn different language features, and be able to express the comment text more accurately. The output matrix W∈R d×|V| , where d represents the maximum number of reviews and |V| is the hidden size of the RoBERTa model.
[0074] Furthermore, the feature extraction is performed on the user comment encoding results and the product comment encoding results respectively to obtain user comment features and product comment features; specifically including:
[0075] Using the first feature extractor, extract features from the user comment encoding results to obtain user comment features;
[0076] The second feature extractor is used to extract features from the product review encoding results to obtain product review features.
[0077] Furthermore, the first feature extractor is used to extract features from the encoded results of the user comments to obtain user comment features; specifically including:
[0078] Five parallel convolutional layers are used to extract features from the encoded results of user comments. The convolution kernel sizes of the five parallel convolutional layers are different.
[0079] Each convolutional layer outputs a user comment sub-feature, and a total of five user comment sub-features are output. The five user comment sub-features are concatenated to obtain the user comment feature.
[0080] For example, as shown in Figure 3(a), after obtaining the user's feature embedding, a multi-scale five-layer CNN network is used to capture the preferences of each period with kernel sizes of 1*1, 3*1, 5*1, 7*1, and 10*1. The user representation is obtained through the above processing. The user feature input is u∈R n×|V| , the convolution operation is
[0081] Conv(u)=f(∑ i,j u i,j *k i,j +b),
[0082] where u i,j is the sub-region of the input feature vector size i*j, f(x) represents the activation function, k i,j is a kernel of size i*j, k and b represent the trainable kernel bias respectively. Multi-scale CNN uses different values of i and j to extract contextual feature information, thus obtaining the user representation f u ∈R r×|V| Get: f u =stack[Conv1(u);Conv2(u);Conv3(u);Conv4(u);Conv5(u)];
[0083] Among them, stack means splicing the convolutional network results of different dimensions.
[0084] Exemplarily, a second feature extractor is used to extract features from the product review encoding results to obtain product review features; specifically, the following steps are included:
[0085] The feature representation of items is relatively simple, and the attributes of items are fixed. Therefore, as shown in Figure 3(b), a single-layer CNN network is used to extract the features of item reviews and used as the representation of items. Given an item embedding p∈R n×|V| , the item feature f obtained by a layer of CNN network p =Conv(p).
[0086] Furthermore, the weighted interactive fusion of user review features and product review features is performed, and a concatenation vector of user reviews and product reviews is extracted from the fusion result; specifically, the process includes:
[0087] Extract user comment representation from user comment features;
[0088] Extract product review representation from product review features;
[0089] Use the attention mechanism layer to process the user comment representation and obtain the attention distribution of the user comments;
[0090] Use the attention mechanism layer to process the product review representation and obtain the attention distribution of the product reviews;
[0091] Calculate the product of the user comment representation and the attention distribution of the user comment to obtain the first product;
[0092] Calculate the product of the attention distribution of the product review in the product review representation domain to obtain a second product;
[0093] The user review features, product review features, the first product and the second product are concatenated, and the concatenated result is input into the third multi-layer perceptron, which outputs the concatenated vector of the user review and the item review.
[0094] Exemplarily, the weighted interactive fusion of user review features and product review features, and extracting a concatenation vector of user reviews and product reviews from the fusion result, includes:
[0095] The attention mechanism is used to model the interaction layer to estimate the different importance of input items and user features. The user is represented by f u and the representation of items p , input into different multi-layer perceptrons (MLP), and then obtain the representation of user and item importance matrix.
[0096]
[0097] M=tanh(YX T )
[0098] Where W is the trainable matrix, b is the bias, X and Y represent user and item representations.
[0099]
[0100] Among them, Tanh(x) is the activation function.
[0101] Then the attention mechanism is used to calculate the importance of users and items.
[0102]
[0103]
[0104] where Z u,j , Z p,j It is called attention distribution, the numerator is the attention scoring function, and finally the user's final representation F is calculated u and the final representation of the object F p .
[0105] F u =Z u,j X
[0106] F P =Z p,j Y
[0107] Among them F u , F P ∈R n×|V|
[0108] Using the residual network to add an additional interaction component before the prediction layer to obtain the interaction layer;
[0109] c=MLP(concat[f u ;f i ; F u ; F P ])
[0110] where f u ,f i ,F u ,F P They represent the user and item representations before and after the attention mechanism, respectively.
[0111] c is the result of an MLP of user and item representations before and after the attention mechanism.
[0112] Furthermore, the training process of the trained product recommendation model includes:
[0113] Constructing a training set; the training set includes user reviews and product reviews of a known product recommendation list; user reviews refer to reviews of different products by a single user; and product reviews refer to all reviews under a single product;
[0114] Input the training set into the product recommendation model and train the model. When the loss function value of the model reaches the minimum value or the number of iterations exceeds the set number, stop training to obtain the trained product recommendation model; the loss function is selected as the cross entropy loss function;
[0115] The trained product recommendation model is evaluated, and the model whose evaluation index meets the set threshold is used as the final trained product recommendation model; the model whose evaluation index does not meet the set threshold is retrained.
[0116] Use the rating prediction module to predict ratings for users and products. This module uses the recommendation indicator MSE, which is commonly used in review recommendation. MSE is generally used to detect the deviation between the model's predicted value and the true value. The experiment of this model uses the Amazon product review public dataset, covering four different fields, to verify the effectiveness of the method. Each dataset is divided into a training set and a test set at a ratio of 8:2, and preprocessed in a 5-dimensional manner (that is, each user and item contains at least 5 reviews). Each review is used to construct the expression of the user and item. The rating prediction layer is a regression model. The smaller the value of MSE, the smaller the gap between the model's review learning results and the true value, and the predicted value is closer to the true value, indicating that the model effect is better. This layer first converts the input vector into a probability distribution of the rating. Given the user-item rating vector c, the predicted rating is obtained.
[0117]
[0118] The MSE expression formula is as follows:
[0119]
[0120] First, the present invention uses the currently advanced dynamic word embedding training model RoBERTa to pre-process the input text. Compared with the BERT model, it performs strong optimization, and significantly improves performance by training the model for a longer time, using larger batches on more data, removing the next sentence prediction target, training longer sequences, and dynamically changing the masking mode applied to the training data. It can effectively solve the problems of sparsity and cold start, and fully mine user and item information. Secondly, we use convolution and different five-layer CNN networks for user comments to realize feature extraction of different dimensions of user comment text, and use a single-layer CNN network to extract item attributes for item comments; finally, a feature interaction network based on attention mechanism and MLP is built to enable full interaction between user and item features to obtain predicted scores. The final representation comparison experiment of the model is shown in Table 1. It can be seen that the present invention has achieved good results compared with the baseline model on various data sets. The MSE comparison effect diagram between each model is shown in the figure below. Figure 2 As shown;
[0121] Table 1 MSE comparison between models
[0122]
[0123] This invention belongs to the field of recommender systems and designs a user review recommendation method based on RoBERTa. The method primarily comprises the following steps: using RoBERTa technology to dynamically embed review text into word vectors; using CNN networks of varying scales to extract and represent user and item features; and constructing a feature interaction splicing layer based on an attention network and an MLP network. Compared to existing methods, this method utilizes dynamic encoding to address the issues of static encoding technology, such as the single word representation and limited context-sensitive representation capabilities, while also optimizing BERT's issues of insufficient pre-training and data duplication detection. Furthermore, it achieves a more rational extraction of user and item features. A five-layer CNN network is used to extract user features at varying scales, better capturing their sentiment and preferences. A single-layer CNN network is used to extract the invariant attributes of items. An interactive network based on an attention mechanism and MLP is employed to fully analyze the contribution and interaction of different features, further summarizing contextual interaction information, thereby improving model performance. This method has achieved excellent results in recommendation tasks using reviews.
[0124] Example 2
[0125] This embodiment provides a product recommendation system;
[0126] A product recommendation system, comprising:
[0127] An acquisition module is configured to: acquire user comments and product reviews;
[0128] The recommendation module is configured to input user reviews and product reviews into a trained product recommendation model and output product recommendation results. The trained product recommendation model operates as follows:
[0129] Encode user comments and product reviews respectively to obtain user comment encoding results and product comment encoding results;
[0130] Perform feature extraction on the encoding results of user comments and product comments respectively to obtain user comment features and product comment features;
[0131] Perform weighted interactive fusion on user review features and product review features, and extract the concatenation vector of user reviews and item reviews from the fusion results;
[0132] Predict the score of the concatenated vector, sort the products in descending order of score, and output a list of recommended products.
[0133] It should be noted that the acquisition module and recommendation module described above correspond to steps S101 to S102 in Example 1. The examples and application scenarios implemented by the modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the modules described above, as part of a system, can be executed in a computer system, such as a set of computer-executable instructions.
[0134] The descriptions of the various embodiments in the above embodiments have different focuses. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0135] The proposed system can be implemented in other ways. For example, the system embodiment described above is merely illustrative. For example, the above module division is only a logical function division. In actual implementation, other division methods may be used. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not implemented.
[0136] Example 3
[0137] This embodiment also provides an electronic device, comprising: one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are stored in the memory. When the electronic device is running, the processor executes the one or more computer programs stored in the memory, so that the electronic device executes the method described in the above embodiment one.
[0138] It should be understood that in this embodiment, the processor may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), off-the-shelf field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0139] The memory may include a read-only memory and a random access memory, and provides instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0140] During implementation, each step of the above method may be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software.
[0141] The method in Example 1 can be directly implemented as being executed by a hardware processor, or by a combination of hardware and software modules within the processor. The software module can be located in a storage medium well-established in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, a detailed description is not given here.
[0142] Those skilled in the art will appreciate that the units and algorithm steps of the various examples described in conjunction with this embodiment can be implemented using electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0143] Example 4
[0144] This embodiment further provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the method described in the first embodiment is performed.
[0145] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A product recommendation method, characterized in that: include: Get user reviews and product reviews; User reviews and product reviews are input into the trained product recommendation model to output product recommendation results. The working principle of the trained product recommendation model includes the following: Use the RoBERTa model to encode user comments and obtain the user comment encoding results; Use the RoBERTa model to encode product reviews and obtain the product review encoding results; Using the first feature extractor, extract features from the user comment encoding results to obtain user comment features; Using the second feature extractor, extract features from the product review encoding results to obtain product review features; Perform weighted interactive fusion on user review features and product review features, and extract the concatenation vector of user reviews and item reviews from the fusion results; Predict the score of the concatenated vector, sort the products in descending order of score, and output a list of recommended products; The network structure of the product recommendation model includes: two parallel branches; The first branch includes a first encoder, a first feature extractor, and a first multilayer perceptron connected in sequence; The second branch includes a second encoder, a second feature extractor, and a second multilayer perceptron connected in sequence; The output end of the first multilayer perceptron and the output end of the second multilayer perceptron are both connected to the input end of the attention mechanism layer; The output end of the first multilayer perceptron, the output end of the second multilayer perceptron, and the output end of the attention mechanism layer are all connected to the input end of the adder; An output terminal of the adder is connected to an input terminal of the third multilayer perceptron; The output end of the third multilayer perceptron is connected to the input end of the loss function layer, and the output end of the loss function layer is connected to the output layer; The first feature extractor is used to extract features from the encoded results of the user comments to obtain user comment features; specifically, the first feature extractor includes: Five parallel convolutional layers are used to extract features from the encoded results of user comments. The convolution kernel sizes of the five parallel convolutional layers are different. Each convolutional layer outputs a user comment sub-feature, and a total of five user comment sub-features are output. The five user comment sub-features are concatenated to obtain the user comment feature.
2. A product recommendation method according to claim 1, characterized in that: The weighted interactive fusion of user review features and product review features is performed, and the concatenation vector of user reviews and product reviews is extracted from the fusion result. Specifically, the method includes: Extract user comment representation from user comment features; Extract product review representation from product review features; Use the attention mechanism layer to process the user comment representation and obtain the attention distribution of the user comments; Use the attention mechanism layer to process the product review representation and obtain the attention distribution of the product reviews; Calculate the product of the user comment representation and the attention distribution of the user comment to obtain the first product; Calculate the product of the attention distribution of the product review in the product review representation domain to obtain a second product; The user review features, product review features, the first product and the second product are concatenated, and the concatenated result is input into the third multi-layer perceptron, which outputs the concatenated vector of the user review and the item review.
3. A product recommendation method according to claim 1, characterized in that: The trained product recommendation model; The training process includes: Constructing a training set; the training set includes user reviews and product reviews of a known product recommendation list; user reviews refer to reviews of different products by a single user; and product reviews refer to all reviews under a single product; Input the training set into the product recommendation model and train the model. When the loss function value of the model reaches the minimum value or the number of iterations exceeds the set number, stop training to obtain the trained product recommendation model; the loss function is selected as the cross entropy loss function; The trained product recommendation model is evaluated, and the model whose evaluation index meets the set threshold is used as the final trained product recommendation model; the model whose evaluation index does not meet the set threshold is retrained.
4. A product recommendation system, characterized in that: include: An acquisition module is configured to: acquire user comments and product reviews; The recommendation module is configured to input user reviews and product reviews into a trained product recommendation model and output product recommendation results. The trained product recommendation model operates as follows: Use the RoBERTa model to encode user comments and obtain the user comment encoding results; Use the RoBERTa model to encode product reviews and obtain the product review encoding results; Using the first feature extractor, extract features from the user comment encoding results to obtain user comment features; Using the second feature extractor, extract features from the product review encoding results to obtain product review features; Perform weighted interactive fusion on user review features and product review features, and extract the concatenation vector of user reviews and item reviews from the fusion results; Predict the score of the concatenated vector, sort the products in descending order of score, and output a list of recommended products; The network structure of the product recommendation model includes: two parallel branches; The first branch includes a first encoder, a first feature extractor, and a first multilayer perceptron connected in sequence; The second branch includes a second encoder, a second feature extractor, and a second multilayer perceptron connected in sequence; The output end of the first multilayer perceptron and the output end of the second multilayer perceptron are both connected to the input end of the attention mechanism layer; The output end of the first multilayer perceptron, the output end of the second multilayer perceptron, and the output end of the attention mechanism layer are all connected to the input end of the adder; The output terminal of the adder is connected to the input terminal of the third multilayer perceptron; The output end of the third multilayer perceptron is connected to the input end of the loss function layer, and the output end of the loss function layer is connected to the output layer; The first feature extractor is used to extract features from the encoded results of the user comments to obtain user comment features; specifically, the first feature extractor includes: Five parallel convolutional layers are used to extract features from the encoded results of user comments. The convolution kernel sizes of the five parallel convolutional layers are different. Each convolutional layer outputs a user comment sub-feature, and a total of five user comment sub-features are output. The five user comment sub-features are concatenated to obtain the user comment feature.
5. An electronic device, comprising: a memory for non-transitory storage of computer-readable instructions; as well as a processor for executing said computer-readable instructions, When the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 3 is executed.
6. A storage medium, characterized by non-transitory storage of computer-readable instructions, wherein: When the non-transitory computer-readable instructions are executed by a computer, the instructions of the method according to any one of claims 1 to 3 are executed.
Citation Information
Patent Citations
Multi-granularity interactive recommendation method and system fusing dynamic interests of users
CN113570154A
Deep learning interpretable recommendation method based on BERT and user comments
CN113836392A