News recommendation method and system based on joint modeling of news events and news styles
By constructing a neural network structure of joint modeling of news events and styles, decoupling news representation and performing matching score calculations, the problem of inaccurate user preference modeling in the existing news recommendation methods is solved, and more efficient personalized news recommendations are achieved.
Patent Information
- Application Number
- CN202311159947.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-11
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2043-09-11
AI Technical Summary
Existing news recommendation methods cannot accurately model users’ personalized reading preferences, and cannot recommend news to users in massive news that match their interests and style preferences.
By constructing a neural network structure jointly modeled by news events and news styles, the event-style decoupler is used to decouple news representations into event features and style features, and a matching score is generated through the event matching module and the style matching module to achieve matching user preferences and candidate news.
It improves the accuracy and personalization of news recommendations, can better meet users' interests and style preferences, and improve the performance of recommendation models.
Smart Images

Figure CN117171440B_ABST
Abstract
Description
[0001] Technical issues
[0002] The present invention relates to the fields of natural language processing technology and recommendation systems, and in particular to a news recommendation method and system based on joint modeling of news events and news styles.
[0003] With the rapid development of internet technology, news websites like Toutiao, Sohu, and Sina have become the primary channels for most people to obtain news and information. These websites provide millions of users worldwide with a vast amount of news coverage daily, covering topics ranging from politics to entertainment to sports. While these news websites offer convenience, they also face a significant challenge: helping users find articles that meet their preferences within this vast amount of news. In this context, news recommendation is playing an increasingly important role as a key solution. By analyzing users' reading history, news recommendation systems enable users to access news content of interest more quickly and conveniently. Such recommendation systems not only enhance user experience but also help increase user stickiness and readership on news websites, achieving a win-win situation. Therefore, news recommendation systems hold broad application prospects and significant significance in news dissemination in the internet age.
[0004] Users' reading preferences are driven by two fundamental factors: news events and news style. On the one hand, users typically read news to learn about events relevant to their interests. For example, if a user is interested in the US election, they may read news related to that event to learn about the latest developments, candidates' views, and voter reactions. News events can trigger users' interest and curiosity, resulting in a higher tendency to read news related to these events. On the other hand, even when reporting on the same event, different news sources may write and present it in different styles. Each news organization has its own unique writing style, language style, and reporting approach. For example, one news organization may focus more on objective and neutral reporting, while another may emphasize personal commentary and opinions. In these cases, users often choose to read news that suits their style preferences.
[0005] In recent years, many neural network models have been applied to news recommendation systems, among which methods based on recurrent neural networks and attention networks have shown good performance. News recommendation methods based on recurrent neural networks regard news content data as unidirectional sequences in the time dimension, and then encode these news sequences into a single user representation. However, since users' reading preferences are usually diverse, this single user representation cannot accurately model users' complex preferences. News recommendation methods based on attention networks model news sequences as different user representations, thereby modeling users' various reading preferences. However, when encoding news, they only focus on the title, summary, and category features of the news, while ignoring the event features and style features of the news. This makes existing methods unable to accurately model users' personalized reading preferences. In summary, existing news recommendation methods cannot accurately model users' personalized preferences, making it difficult to achieve satisfactory recommendation results. Summary of the Invention
[0006] The technical task of this invention is to provide a news recommendation method and system based on the joint modeling of news events and news styles, addressing the issues of user-personalized recommendations and inaccurate recommendation results in news recommendation systems. This method and system implement a neural network structure that jointly models news events and news styles. News events help users more easily understand the main content of news, while news styles help users better select news of different styles. This invention proposes a neural network structure that jointly models news events and news styles. This structure captures the event features and style features of news from the news content read by users, and then matches candidate news with user preferences from two different perspectives: event features and style features. The core concept is to decouple each news representation into event features and style features using an event-style decoupler pair. The event features are then modeled using an event matching module to generate event-based user features, which are then matched with the event features of candidate news to obtain an event matching score. Simultaneously, the style matching module models the style features into style-based user features, which are then matched with the style features of candidate news to obtain a style matching score. This joint modeling of news events and news styles enables more accurate news recommendations that meet user preferences.
[0007] The technical task of the present invention is achieved in the following manner: a news recommendation method based on joint modeling of news events and news styles, the method comprising the following steps:
[0008] S1. Build a training dataset for the news recommendation model: First, download the publicly available news dataset from the Internet, then preprocess the dataset, and finally construct positive and negative example data to combine and generate the final training dataset.
[0009] S2. Build a news recommendation model based on joint modeling of news events and news styles: Utilize neural networks and deep learning methods to build a news recommendation model with the following architecture: news encoder, event-style decoupler, event matching module, style matching module, and candidate news prediction module.
[0010] S3. Training model: The news recommendation model constructed in step S2 is trained in the training data set obtained in step S1.
[0011] A news recommendation system based on joint modeling of news events and news styles, the system comprising:
[0012] A training data set generation unit is used to obtain user browsing history information on online news websites and then perform preprocessing operations on it to obtain user browsing history and news text content that meet training requirements;
[0013] A news recommendation model construction unit based on joint modeling of news events and news styles, which is used to construct a news encoder, an event-style decoupler, an event matching module, a style matching module, and a candidate news prediction module;
[0014] The model training unit is used to construct the loss function required in the model training process and complete the optimization training of the model.
[0015] A storage medium stores a plurality of instructions, which are loaded by a processor to execute the steps of the above-mentioned news recommendation method based on joint modeling of news events and news styles.
[0016] An electronic device comprises: the above-mentioned storage medium; and a processor for executing instructions in the storage medium.
[0017] Technical Effects
[0018] The news recommendation method and system based on joint modeling of news events and news styles of the present invention have the following advantages:
[0019] (1) The news recommendation method based on joint modeling of news events and news styles proposed in this paper mines the event features and style features in the news, and can more comprehensively model user representations, thereby improving the accuracy of news recommendations;
[0020] (2) The present invention decouples news representation through an event-style decoupler, which can effectively generate news event representation and news style representation, and ensure their independence and accuracy;
[0021] (3) The present invention matches the event-based user representation with the news event representation of the candidate news through the event matching module to generate an event matching score, thereby improving the performance of the news recommendation model;
[0022] (4) The present invention matches the style-based user representation with the news style representation of the candidate news through a style matching module to generate a style matching score, thereby improving the performance of the news recommendation model;
[0023] (5) The present invention can accurately output candidate news prediction scores based on event matching scores and style matching scores through the candidate news prediction module. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The present invention will be further described below with reference to the accompanying drawings.
[0025] Figure 1 Flowchart of the news recommendation method based on joint modeling of news events and news styles
[0026] Figure 2 Flowchart of training dataset for building news recommendation model
[0027] Figure 3 Flowchart for building a news recommendation model based on joint modeling of news events and news styles
[0028] Figure 4 Flowchart for training a news recommendation model based on joint modeling of news events and news styles
[0029] Figure 5 Schematic diagram of a news recommendation model based on joint modeling of news events and news styles
[0030] Figure 6 Schematic diagram for building an event-style decoupling module
[0031] Figure 7 Schematic diagram of the structure for building an event matching module
[0032] Figure 8 Schematic diagram of the structure of the style matching module
[0033] Figure 9 Schematic diagram of the structure of the candidate news prediction module
[0034] Figure 10 Schematic diagram of the structure of the news recommendation model based on joint modeling of news events and news styles DETAILED DESCRIPTION
[0035] The news recommendation method and system based on joint modeling of news events and news styles of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments.
[0036] Example 1:
[0037] The overall framework of the present invention is as follows Figure 5 As shown. Figure 5 It can be seen that the main framework structure of the present invention includes a news encoder, an event-style decoupler, an event matching module, a style matching module and a candidate news prediction module. Among them, the news encoder takes the title, summary, category and subcategory of the news as input through the news encoder, and generates news representation based on these features; specifically, the news encoder first uses a convolutional neural network and an additive attention network to encode the title and summary into a title representation and a summary representation, and at the same time uses a fully connected neural network to encode the category and subcategory into a category feature representation and a subcategory feature representation, and then uses a multi-view attention network to aggregate the title representation, summary representation, category feature representation and subcategory feature representation into a news representation, and pass it to the event-style decoupling module. The event-style decoupler is composed of an event-style encoder, an event decoder, a style decoder, an event classifier and an auxiliary loss; specifically, as Figure 6 As shown, the event-style encoder first encodes the news representation to obtain a high-order news representation; then, the event decoder and style decoder are used to decode the high-order news representation to generate news event representation and news style representation; then, the event classifier further encodes these two representations to obtain event-based news event distribution and style-based news event distribution; in order to better train the event-style decoupler, the decoupler constructs an auxiliary loss based on event prediction loss, reconstruction loss and adversarial loss to optimize the model parameters in the event-style encoder; in addition, an algorithm for generating a real news event distribution is designed to implement event prediction loss and adversarial loss; finally, the news event representation and event-based news event distribution are passed to the event matching module, and the news style representation is passed to the style matching module; wherein, the news event representation includes the news event representation of the historical news sequence and the news event representation of the candidate news; the event-based event distribution includes the event-based event distribution of the historical news sequence and the event-based event distribution of the candidate news; the news style representation includes the news style representation of the historical news sequence and the style event representation of the candidate news. The event matching module consists of an event channel modeling layer and a fine-grained event matching layer; specifically, Figure 7As shown in the figure, the event channel modeling layer first encodes the news event representation of the historical news sequence on different event channels to generate event-based user representations. At the same time, the news event representations of the candidate news are divided into different event channels to generate news event representations of the candidate news on different event channels. Then, the fine-grained event matching layer calculates the inner product of the event-based user representation and the news event representation of the candidate news on different event channels, generates an event matching score on each event channel, and aggregates it into an event matching score through the score attention network. Finally, the event matching score is passed to the candidate news prediction module. Style matching module, such as Figure 8 As shown in , firstly, the news style representation of the historical news sequence is encoded to generate the news style representation after the interaction of the historical news sequence; at the same time, the user ID is encoded using the user embedding layer and the fully connected neural network to generate the feature representation of the user ID; then the style attention network is used to encode the news style representation based on the interaction of the historical news sequence and the feature representation of the user ID to generate a style-based user representation; finally, the inner product of the style-based user representation and the news style representation of the candidate news is calculated to obtain the style matching score, which is then passed to the candidate news prediction module. The news prediction module, such as Figure 9 As shown, the event matching score and style matching score in the event matching module are further weighted and summed to obtain the candidate news prediction score.
[0038] Example 2:
[0039] As attached Figure 1 As shown, the news recommendation method based on joint modeling of news events and news styles of the present invention includes the following steps:
[0040] S1. Constructing a training dataset for the news recommendation model: First, download the publicly available news dataset from the Internet, then preprocess the dataset, and finally construct positive and negative data to combine and generate the final training dataset. The news dataset contains two parts of data files: user browsing history and news text content. Among them, user browsing history contains user ID, time, historical news sequence, and interaction behavior sequence; news text content contains news ID, category, subcategory, title, summary, and entity. The user behavior data of the historical news sequence and interaction behavior sequence in the user browsing record are selected to construct the training dataset, and the news text data of the news text content, such as title, category, subcategory, and summary, are selected to construct the training dataset. The specific method for constructing the training dataset is as follows:
[0041] S101. Build a news dataset or select a publicly available news dataset: Download the MIND news dataset that Microsoft has made public online and use it as the raw data for news recommendations. MIND is currently the largest English news recommendation system dataset, containing 876,956 users and 130,379 news items, divided into training, validation, and test sets. To accelerate training, the present invention randomly selects 500,000 users to build a small version of the dataset, MIND-500K, and divides the MIND validation set into a new validation set and test set in a 1:1 ratio.
[0042] For example, the MIND dataset provides detailed information about the content of news text. Each news item has a news number, link, title, summary, category, and entity:
[0043]
[0044]
[0045] In addition, the dataset also provides user browsing records. Each record contains the user ID, time, historical news sequence, and interaction behavior sequence:
[0046]
[0047] Among them, the user number represents the unique number of each user on the news platform; the time represents the start time when the user clicks to browse a series of news; the historical news sequence represents the sequence of a series of news numbers browsed by the user; the interaction behavior sequence represents the user's actual interaction behavior on a series of candidate news recommended by the system, 1 represents click, and 0 represents no click.
[0048] S102. Preprocessing the news data set: Preprocessing each news text in the news data set, removing stop words and special characters in the news data set; extracting the title, category, subcategory and summary information of each news text.
[0049] S103, constructing positive training examples: using the historical news sequence in the user's browsing history and the numbers of candidate news items labeled 1 in the interaction behavior sequence, i.e., the numbers of candidate news items clicked by the user, to construct positive training examples;
[0050] For example: for the news instance displayed in step S101, the constructed positive example data is formalized as: (N29038, N15201, N8018, N32012, N30859, N26552, N25930), where the last number is the number of the candidate news clicked by the user.
[0051] S104, constructing negative training examples: using the numbers of candidate news with a label of 0 in the historical news sequence and the interaction behavior sequence in the user's browsing history, that is, the numbers of candidate news that have not been clicked by the user, to construct negative training examples;
[0052] For example: for the news instance displayed in step S101, the constructed negative example data is formalized as: (N29038, N15201, N8018, N32012, N30859, N26552, N17825), where the last number is the number of the candidate news that has not been clicked by the user.
[0053] S105, constructing a training data set: combining all the positive and negative data obtained after the operations of step S103 and step S104, and disrupting their order to construct a final training data set.
[0054] S2. Build a news recommendation model based on joint modeling of news events and news styles: as shown in the attached Figure 3 As shown in Figure 1, the news recommendation model includes a news encoder, an event-style decoupler, an event matching module, a style matching module, and a candidate news prediction module:
[0055] S201: Build a news encoder that takes the title, summary, category, and subcategory as input and generates news representation based on the above information. Specifically:
[0056] First, a word mapping table is constructed based on each word in the dataset, and each word in the table is mapped to a unique digital identifier. The mapping rule is: starting with the number 1, and then sorting each word in the order in which it is entered into the word mapping table in ascending order, thereby forming a word mapping conversion table; similarly, a news category mapping table and a news subcategory mapping table are constructed, and the categories and subcategories are converted into corresponding digital identifiers respectively. The mapping rules are similar to those of the word mapping conversion table and will not be repeated here;
[0057] Then, use the word embedding layer to convert the title and summary into title embedding representation and summary embedding representation The subscripts N and M represent the length of the title and abstract respectively; the category and subcategory are converted into category embedding representations using the category embedding layer and subcategory embedding layer. c and subcategory embedding representation e sc ;
[0058] Furthermore, for the title embedding representation, a convolutional neural network is used for encoding to generate a convolutional title representation, and then the convolutional title representation is further encoded using an additive attention network to generate a title representation; the specific implementation of the convolutional neural network is shown in the following formula:
[0059]
[0060] Where iw represents the i-th word in the title; w is the size of the convolutional neural network sliding window, which is set to 3 here; represents the embedding representation of the (iw-w)th word to the (iw+w)th word in the title embedding representation; F t and b t is the parameter of the convolutional neural network; ReLU is the activation function; is the title representation after convolution;
[0061] For example, in the PyTorch framework, the code implementation corresponding to the above description is as follows: self.title_conv = Conv1D(300,400,3)
[0062] title_c=self.dropout_(self.title_conv(title_w.permute(0,2,1)).permute(0,2,1))
[0063] Among them, Conv1D represents the convolutional neural network; title_w is the title embedding representation; self.dropout_ is the dropout method;
[0064] The convolutional title representation is further encoded using the additive attention network to generate the title representation; the specific implementation is shown in the following formula:
[0065]
[0066] Among them, V at 、v at is a trainable parameter; is the title representation after convolution, from formula (1); is the similarity between words in the news title; tanh is the activation function; is the attention weight between words in the news title; r t is the title representation; N is the length of the title;
[0067] For example, in the PyTorch framework, the code implementation corresponding to the content described above is as follows: self.title_attention = Attention(400,200)
[0068] title_representation=self.title_attention(title_c)
[0069] Among them, Attention represents the additive attention network, and the specific implementation code is as follows:
[0070]
[0071] For the summary embedding representation, similar operations are used to process it as the title embedding representation to generate the summary representation r b , I will not elaborate on this here;
[0072] For category embedding representation and subcategory embedding representation, the category and subcategory of the news are converted into category embedding representation using the category embedding layer and the subcategory embedding layer. c and subcategory embedding representation e sc ; For the category embedding representation and subcategory embedding representation, a fully connected neural network is used to encode them and generate the category feature representation r c and subcategory feature representation r sc ; For specific implementation, see the following formula:
[0073]
[0074] Among them, V c 、V sc 、v c and v sc is the parameter of the fully connected neural network; e c 、e sc are category embedding representation and subcategory embedding representation respectively; r c 、r sc They are category feature representation and subcategory feature representation respectively;
[0075] For example, in the PyTorch framework, the code implementation of the above description is as follows: self.category_affine = nn.Linear(in_features = 50, out_features = 400, bias = True) self.subCategory_affine = nn.Linear(in_features = 50, out_features = 400, bias = True)
[0076] category_representation=F.relu(self.category_affine(e_category),inplace=True)subCategory_representation=F.relu(self.subCategory_affine(e_subCategory),inplace=True)
[0077] Among them, e_category and subCategory represent the category embedding representation and subcategory embedding representation respectively; category_representation and subCategory_representation represent the category feature representation and subcategory feature representation respectively;
[0078] Furthermore, a multi-view attention network is used to fuse the title representation, summary representation, category feature representation, and subcategory feature representation; specifically, the attention weights corresponding to the above information are set to α t , α b , α c and α sc , the calculation methods of these four attention weights are similar; for the sake of convenience, only α is introduced here. t The implementation method of the other three attention weights is similar to this. The specific implementation method is shown in the following formula:
[0079]
[0080] Among them, U v 、u v and q v is a trainable parameter; a t is the similarity between words in the title, and similar operations are used to obtain the similarity between words in the summary, category, and subcategory. b 、a c and a sc ; α t is the attention weight of the title, and similar operations are used to obtain the attention weights α of the summary, category, and subcategory b , α c and α sc ;
[0081] The news representation n is obtained by weighted summation of attention weights. The specific implementation method is shown in the following formula:
[0082] n=α c r c +α sc r sc +α t r t +α b r b . (5)
[0083] Among them, α t , α b , α c and α sc are the attention weights of title, summary, category, and subcategory, respectively, from formula (4); n is the news representation;
[0084] In addition, since the input of the news encoder consists of two parts: historical news sequence and candidate news, the news representation includes the news representation of the historical news sequence and the news representation of the candidate news; according to formula (5), it can be expressed as: [n1,...,n i ,...,n N ;n C ]; where n1,...,n i ,...,n N News representation of historical news sequence; n C News representation for candidate news;
[0085] For example, in the pytorch framework, the code implementation corresponding to the content described above is as follows: self.affine1 = nn.Linear(in_features = 400, out_features = 200, bias = True) self.affine2 = nn.Linear(in_features = 200, out_features = 1, bias = False) feature = torch.stack([title_representation, content_representation, category_representation, subCategory_representation], dim = 2) alpha = F.softmax(self.affine2(torch.tanh(self.affine1(feature))), dim = 2) news_representation = (feature*alpha).sum(dim = 2, keepdim = False)
[0086] Among them, news_representation is the news representation obtained by weighted summation.
[0087] S202. Build an event-style decoupler, as shown in the attached Figure 6 As shown, the decoupler takes the news representation obtained in step S201 as input, first encodes the news representation through the event-style encoder to obtain a high-level news representation; then uses the event decoder and style decoder to extract the news event representation and news style representation from the high-level news representation respectively; then uses the event classifier to further encode these two representations to obtain event-based news event distribution and style-based news event distribution; at the same time, in order to optimize the event-style decoupler, the event prediction loss, reconstruction loss and adversarial loss are designed to construct the final auxiliary loss to assist model training;
[0088] Specifically, the event-style encoder consists of a three-layer fully connected neural network, using the ReLU function as the activation function. In addition, a residual network is also added to the event-style encoder to alleviate the problem of information loss. For the representation of news events in the historical news sequence, the specific implementation method of the news encoder is shown in the following formula:
[0089]
[0090] Among them, n i is the news representation of the i-th browsed news in the historical news sequence; ReLU is the activation function; Dense is the fully connected neural network; [;] is the connection operation; The news representation after encoding by the fully connected neural network; h i is the high-level news representation of the i-th browsed news in the historical news sequence;
[0091] For example, in the PyTorch framework, the code implementation corresponding to the above description is as follows:
[0092] self.e1 = nn.Linear(400,400)
[0093] self.e2=nn.Linear(400*2,400)
[0094] self.e3=nn.Linear(400*2,400)
[0095] ehidden1=self.dropout(F.relu(self.e1(news_rep)))
[0096] ehidden2=self.dropout(F.relu(self.e2(torch.cat([news_rep,ehidden1],dim=-1))))
[0097] ehidden3=F.relu(self.e3(torch.cat([news_rep,ehidden2],dim=-1)))
[0098] Among them, news_rep is the news representation of the historical news sequence; F.relu is the activation function; self.e1, self.e2, and self.e3 are fully connected neural networks; ehidden1 and ehidden2 are the news representations after encoding by the fully connected neural network; ehidden3 is the high-level news representation after encoding;
[0099] Furthermore, the high-level news representation is passed to the event decoder and style decoder for decoding to generate news event representation and news style representation. Specifically, the event decoder and style decoder have similar structures, both consisting of a three-layer fully connected neural network equipped with a residual network. The specific implementation method of the event decoder is shown in the following formula:
[0100]
[0101] Among them, h i is the high-level news representation of the i-th browsed news in the historical news sequence, which comes from formula (6); Both are high-level news representations encoded by fully connected neural networks; e i is the news event representation of the i-th browsed news in the historical news sequence; the style decoder obtains the news style representation t by similar operations. i , the code implementation of this decoder is similar to that of formula (7), which will not be repeated here;
[0102] Furthermore, with the news event representation and news style representation as input, the event classifier further encodes the news event representation and news style representation to obtain event-based news event distribution and style-based news event distribution; the event classifier consists of a fully connected neural network with a softmax activation function. The specific implementation method is shown in the following formula:
[0103]
[0104] Among them, e i is the news event representation of the i-th browsed news in the historical news sequence, which comes from formula (7); softmax is the activation function; is the event-based news event distribution of the i-th browsed news in the historical news sequence; similar operations are used to obtain the style-based news event distribution
[0105] Furthermore, to better assist model training, we need to construct a distribution based on real news events. However, this label is not provided in the dataset, so we design an algorithm to construct a real news event distribution. Specifically, we first use TF-IDF to extract keywords for each news item, then use BERT to encode the keywords into keyword word vector representations. K-means is then used to cluster the keywords into K categories, i.e., K event channels. For the i-th browsed news item in the historical news sequence, the news event distribution on the j-th event channel is calculated as shown in the following formula:
[0106]
[0107] Among them, |NKij | represents the number of keywords belonging to the jth event channel in the i-th browsed news in the historical news sequence; |NK| represents the number of all keywords in the news; p e,ij is the real news event distribution of the i-th browsed news on the j-th event channel in the historical news sequence; p e,i =[p e,i1 ,p e,i2 ,...,p e,iK ] is the real news event distribution based on events of the i-th browsing news in the historical news sequence; K is the number of event channels, which is set to 17;
[0108] To better train the event-style decoupler, three loss functions are designed: reconstruction loss, event prediction loss, and adversarial loss, to optimize model parameters. The reconstruction loss is used to alleviate the information loss problem caused by the decoupling process. Specifically, the news event representation and the news style representation are concatenated and then encoded using a fully connected neural network to obtain the reconstructed news representation. Finally, the MSE function is used to constrain the news representation and the reconstructed news representation. The specific implementation method is shown in the following formula:
[0109]
[0110] Among them, e i , t i are the news event representation and news style representation of the i-th browsed news in the historical news sequence, both of which come from formula (7); n i is the news representation of the i-th browsed news in the historical news sequence, from formula (6); MSE is the mean square error function; is the reconstruction loss;
[0111] For example, in the PyTorch framework, the code implementation corresponding to the above description is as follows:
[0112] self.event_classifer=nn.Linear(400,17)
[0113] channel_softmax=self.softmax(self.event_classifer(event_decoder))
[0114] style_softmax=self.softmax(self.event_classifer(style_decoder))
[0115] all_feature=self.concat_classifer(torch.cat([event_decoder,style_decoder],dim=-1))
[0116] loss2=F.mse_loss(all_feature,news_rep)
[0117] Among them, news_rep is the news representation of the historical news sequence; event_decoder is the news event representation; style_decoder is the news style representation;
[0118] Event prediction loss is used to narrow the gap between the event-based news event distribution and the real news event distribution; the specific implementation method is shown in the following formula:
[0119]
[0120] in, is the event-based news event distribution of the i-th browsed news in the historical news sequence, from formula (8); p e,i is the real news event distribution based on events of the i-th browsed news in the historical news sequence, which comes from formula (9); predicting losses for events;
[0121] For example, in the PyTorch framework, the code implementation corresponding to the above description is as follows:
[0122] hidden_softmax=torch.cat([his_softmax,cdd_softmax],dim=1).view(-1,17)
[0123] event_softmax=torch.cat([user_event_type,news_event_type],dim=1).view(-1,17)
[0124] event_loss=F.mse_loss(hidden_softmax,event_softmax)
[0125] Among them, his_softmax and cdd_softmax are the news event distribution based on events in historical news; user_event_type and news_event_type are the real news event distribution based on events in historical news;
[0126] The adversarial loss takes the news style representation as input, obtains the style-based news event distribution through the event classifier (i.e., formula (8)), and increases the distance between it and the real news event distribution. The specific implementation method is shown in the following formula:
[0127]
[0128] in, is the style-based news event distribution of the i-th browsed news on the j-th event channel in the historical news sequence, from formula (8); p e,ij is the news event distribution based on style truth of the i-th browsed news on the j-th event channel in the historical news sequence, which comes from formula (9); To combat losses;
[0129] Finally, the auxiliary loss is composed of the three losses mentioned above; the specific implementation method is shown in the following formula:
[0130]
[0131] in, They are reconstruction loss, event prediction loss, and adversarial loss, which come from formula (10), formula (11), and formula (12).
[0132] S203, build event matching module, as shown in the attached Figure 7 As shown, the event matching module takes the news event representation output by formula (7) and the event-based event distribution output by formula (8) as input respectively, wherein the news event representation includes the news event representation of the historical news sequence and the news event representation of the candidate news; similarly, the event-based news event distribution includes the event-based news event distribution of the historical news sequence and the event-based news event distribution of the candidate news; the event channel modeling layer is used to encode the news event representation of the historical news sequence on different event channels to generate event-based user representations; the news event representation of the candidate news is divided according to different event channels to generate news event representations of the candidate news on different event channels; the fine-grained event matching layer is used to calculate the inner product of the event-based user representation and the news event representation of the candidate news on different event channels to obtain the event matching scores of the candidate news on different event channels; finally, the event matching scores of each event channel are aggregated through the score attention network to generate a fine-grained event matching score; the construction steps of the event matching module are as follows:
[0133] S20301. Build the event channel modeling layer
[0134] The event channel modeling layer takes the news event representation of the historical news sequence, the news event representation of the candidate news, the event-based news event distribution of the historical news sequence, and the event-based news event distribution of the candidate news as input. First, the news event representation of the historical news sequence and the news event representation of the candidate news are divided into different event channels according to the event-based news event distribution of the historical news sequence and the event-based news event distribution of the candidate news. For the news event representation of the i-th browsed news in the historical news sequence, the specific description of its division method is as follows:
[0135]
[0136] in, is the event-based news event distribution of the i-th browsed news in the historical news sequence, from formula (8); e i is the news event representation of the i-th browsed news in the historical news sequence, which comes from formula (7); is the news event representation of the i-th browsed news in the historical news sequence on different event channels; specifically, in is the news event representation of the i-th browsed news in the historical news sequence on the first event channel; K is the number of event channels;
[0137] Similarly, for the news event representation of candidate news, the same method is used to divide it into different event channels to generate news event representations of candidate news on different event channels. Where subscript c represents candidate news; j represents the jth event channel;
[0138] Furthermore, in order to generate event-based user representation on each channel, this layer uses a channel attention network for encoding on each event channel; specifically, for the event-based user representation on the j-th event channel, its specific implementation method is shown in the following formula:
[0139]
[0140] in, is the news event representation of the i-th browsed news on the j-th event channel in the historical news sequence, from formula (14); q j 、V j and v j is the parameter of channel attention; is the similarity of the i-th browsed news on the j-th event channel; is the attention weight of the i-th browsing news on the j-th event channel; is the event-based user representation on the j-th event channel; is the event-based user representation; l is the length of the historical news sequence, which is set to 50;
[0141] For example, in the PyTorch framework, the code implementation corresponding to the above description is as follows:
[0142]
[0143] Among them, AdditiveAttention1 represents additive attention, news_embedding_dim represents the embedding dimension of news, and his_ur represents the news event representation of the historical news sequence.
[0144] S20302. Build a fine-grained event matching layer
[0145] This layer takes the event-based user representation obtained in step S20302 and the news event representation of the candidate news on different event channels as input, generates an event matching score on each event channel, and aggregates it into an event matching score through score attention. Specifically, the event matching score calculation method for the j-th event channel is shown in the following formula:
[0146]
[0147] in, is the event-based user representation on the j-th event channel, from formula (15); is the news event representation of the candidate news on the jth event channel, which comes from formula (14); is the event matching score of the jth event channel;
[0148] Furthermore, this layer aggregates the event matching scores of each event channel through a scoring attention network to generate a fine-grained event matching score. Since the event-based news event distribution of candidate news has a certain influence on the scoring attention, the construction of scoring attention should take this factor into consideration. Specifically, the event-based news event distribution of candidate news is firstly Mapping is performed; is the event-based news event distribution of the candidate news, from formula (8); is the discrete vector of the event-based news event distribution of the candidate news; then the discrete vector of the event-based news event distribution of the candidate news is converted into the candidate news event distribution representation through a fully connected neural network The specific implementation method is shown in the following formula:
[0149]
[0150] in, is the discrete vector of event-based news event distribution of the candidate news; for Embedded representation of is the distribution representation of candidate news events;
[0151] Finally, based on the candidate news event distribution representation Construct score attention on different event channels and calculate event matching scores. The specific implementation method is shown in the following formula:
[0152]
[0153] in, is the news event distribution representation of the candidate news on the jth event channel, from formula (17); q s 、V s and v s are the parameters of the score attention network; is the similarity of the candidate news on the jth event channel; is the attention weight of the candidate news on the jth event channel; s f is the event matching score; K is the number of event channels
[0154] For example, in the PyTorch framework, the code implementation corresponding to the above description is as follows:
[0155] u_rep_k=u_channel.unsqueeze(-2)
[0156] score=torch.matmul(u_rep_k,cdd_vector).squeeze(-1)
[0157] u_rep_k=u_rep_k.squeeze(-2)
[0158] channel_weight1=torch.cat([u_rep_k,channel_weight],dim=-1)
[0159] temp=torch.tanh(self.linear(channel_weight1))
[0160] candidate_weights=F.softmax(torch.matmul(temp,self.attention_query_vector),dim=1).unsqueeze(dim=1)
[0161] scores=torch.matmul(candidate_weights,score).squeeze(-1)
[0162] Among them, cdd_vector is the news event representation of candidate news on different event channels; channel_weight is the distribution representation of candidate news events.
[0163] S204. Constructing a style matching module
[0164] As attached Figure 8 As shown, the style matching model takes the user ID and the news style representation in step S203 as input, where the news style representation includes the news style representation of the historical news sequence and the news style representation of the candidate news. The method for obtaining the news style representation is similar to the news event representation of the historical news sequence and the news event representation of the candidate news in step S203, and will not be repeated here.
[0165] The style matching module first uses multi-head attention to encode the news style representation of the historical news sequence to capture the interactions in the news and generate the news style representation after the interaction of the historical news sequence; the specific implementation method is shown in the following formula:
[0166] [t'1,t'2,…,t' l ]=MultiHeadAttention(T), (19)
[0167] Where T=[t1,t2,...,t l ] is the news style representation of the historical news sequence; t1 and t'1 are the news style representation of the first news in the historical news sequence and the news style representation after the first news in the historical news sequence is interacted, respectively; other symbols are similar to this and will not be repeated here;
[0168] Furthermore, for the news style representation after the interaction of historical news sequences, style attention network encoding is used to generate style-based user representation; the specific implementation method is shown in the following formula:
[0169]
[0170] Among them, u d Represents the embedded representation of the user ID; u' d Represents the feature representation of user ID; q t 、V t 、V d and v are model parameters; t' i is the news style representation of the i-th news after interaction in the historical news sequence; is the similarity between news style representations after interaction of historical news sequences; is the style attention weight; u t for style-based user representation;
[0171] Furthermore, the inner product of the style-based user representation and the news style representation of the candidate news is calculated to generate a style matching score. The specific implementation method is shown in the following formula:
[0172]
[0173] Among them, u t is the style-based user representation, from formula (20); t c is the news style representation of the candidate news; t Score the representative style match;
[0174] For example, in the PyTorch framework, the code implementation corresponding to the above description is as follows:
[0175] self.user_dense=nn.Linear(in_features=50, out_features=200, bias=True)
[0176] self.personalizedAttention=StyleAttention(400,200,200)
[0177] self.multiheadAttention=MultiHeadAttention(20,400,50,50,20,20)
[0178] self.affine=nn.Linear(in_features=400, out_features=400, bias=True)
[0179] h=self.multiheadAttention(his_style_decoder,his_style_decoder,his_style_decoder)
[0180] h=F.relu(F.dropout(self.affine(h),training=self.training,inplace=True),inplace=True)
[0181] q_d=F.relu(self.user_dense(user_embedding),inplace=True)
[0182] his_style=self.personalizedAttention(h,q_d).unsqueeze(dim=1)
[0183] score3=torch.matmul(his_style,cdd_style_decoder.transpose(-1,-2)).squeeze(1)
[0184] Among them, StyleAttention represents style attention; MultiHeadAttention represents multi-head attention; his_style_decoder represents the news style representation of the historical news sequence; cdd_style_decoder represents the news style representation of the candidate news; user_embedding represents the embedding representation of the user ID.
[0185] S205: Constructing a candidate news prediction module
[0186] The candidate news prediction module takes the event matching score in step S203 and the style matching score in step S204 as input, and obtains the recommendation probability of the candidate news by weighted addition. The specific implementation method is shown in the following formula.
[0187] s=s f +βs t (twenty two)
[0188] Among them, s f is the event matching score, from formula (18); s t is the style matching score, which comes from formula (21); s is the predicted score of the candidate news; β is the weight, which is set to 1.9.
[0189] S3. Training model: as attached Figure 4 As shown, the details are as follows:
[0190] S301. Construct loss function: Using negative sampling technology, define a candidate news item clicked by a user as a positive sample, and a candidate news item not clicked by a user as a negative sample, and calculate the click prediction probability p of the positive sample. i The specific implementation method is shown in the following formula:
[0191]
[0192] in, is the click rate of the jth negative example relative to the ith positive example in the same click sequence; is the i-th positive example; G is the number of negative examples;
[0193] The loss function of the model is the negative log-likelihood function of all positive examples. The specific implementation method is shown in the following formula:
[0194]
[0195] Among them, p i is the predicted click probability of the positive sample; is the set of positive examples;
[0196] Furthermore, the overall loss function is defined as in, is the auxiliary loss, which comes from formula (13); γ is a hyperparameter, which is set to 1.6 here;
[0197] S302. Optimize the model: Use the Adam algorithm as the optimization function of the model; the learning rate parameter is set to 0.0001, and other hyperparameters use the default values in PyTorch.
[0198] In the experiment, the present invention selects the area under the ROC curve AUC, the mean reciprocal rank MRR, and the cumulative gain nDCG as evaluation indicators.
[0199] For example, the optimization function described above is represented in PyTorch using the code: optimizer = torch.optim.Adam (model.parameters(), lr = learning_rate)
[0200] Among them, torch.optim.Adam is the Adam optimization function embedded in pytorch; model.parameters() is the parameter set for model training; learning_rate is the learning rate.
[0201] The model of the present invention was tested on the MIND public dataset. To accelerate the training process, the present invention randomly selected half of the user behavior records from MIND as a new dataset MIND-500K. The experiments showed that the model of the present invention achieved better results than the existing models. The comparison of the experimental results is shown in the table below:
[0202]
[0203] Comparisons between our model and existing models show that our method outperforms other methods. NPA is from the paper "NPA: Neural News Recommendation with Personalized Attention," and NAML is from the paper "Neural News Recommendation with Attentive Multi-View Learning."
[0204] Example 3:
[0205] Based on Example 2, a news recommendation system based on joint modeling of news events and news styles is constructed, which includes:
[0206] The training dataset generation unit, the news recommendation model construction unit based on the joint modeling of news events and news styles, and the model training unit respectively implement the functions of steps S1, S2, and S3 in the news recommendation method based on the joint modeling of news events and news styles. The specific functions of each unit are as follows:
[0207] The training data set generation unit is used to obtain user browsing history information on online news websites and then perform preprocessing operations on it to obtain user browsing history and news text content that meet training requirements.
[0208] The news recommendation model construction unit based on the joint modeling of news events and news styles is used to construct a news encoding module, an event-style decoupling module, an event matching module, a style matching module, and a candidate news prediction module.
[0209] The model training unit is used to construct the loss function required in the model training process and complete the optimization training of the model.
[0210] Example 4:
[0211] Based on the storage medium of Example 3, multiple instructions are stored therein, and the instructions are loaded by a processor to execute the steps of the news recommendation method based on joint modeling of news events and news styles in Example 3.
[0212] Example 5:
[0213] Based on the electronic device of embodiment 4, the electronic device includes: the storage medium of embodiment 4; and a processor for executing instructions in the storage medium of embodiment 4.
[0214] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A news recommendation method based on joint modeling of news events and news styles, characterized by: The method comprises the following steps: S1. Build a training dataset for the news recommendation model: First, download the publicly available news dataset from the Internet, then preprocess the dataset, and finally construct positive and negative example data to combine and generate the final training dataset. S2. Construct a news recommendation model based on the joint modeling of news events and news styles: Use neural networks and deep learning methods to construct a news recommendation model. The model architecture is as follows: news encoder, event-style decoupler, event matching module, style matching module, candidate news prediction module; the specific steps of the event-style decoupler are as follows: take the news representation as input, first encode the news representation through the event-style encoder to obtain a high-order news representation, then use the event decoder and style decoder to extract the news event representation and news style representation from the high-order news representation, and further use the event classifier to further encode these two representations to obtain event-based news event distribution and style-based news event distribution, where the event classifier consists of a layer of The model is constructed using a fully connected neural network with a softmax activation function. To better assist model training, a realistic news event distribution needs to be constructed. TF-IDF is used to extract keywords for each news item. BERT is then used to encode the keywords into keyword word vector representations. K-means is then used to cluster the keywords into K event channels. To optimize the event-style decoupler, an event prediction loss, a reconstruction loss, and an adversarial loss are designed to construct the final auxiliary loss to assist model training. The reconstruction loss is used to mitigate information loss during the extraction of high-order news representations. The event prediction loss is used to narrow the gap between the event-based news event distribution and the real news event distribution. The adversarial loss further distances the event from the real news event distribution. S3. Training model: The news recommendation model constructed in step S2 is trained in the training data set obtained in step S1.
2. The news recommendation method based on joint modeling of news events and news styles according to claim 1 is characterized in that: The specific steps of constructing the news encoder of the news recommendation model based on the joint modeling of news events and news styles in step S2 are as follows: Taking the news title, summary, category, and subcategory as input, the news encoding module is used to construct a mapping table, generate a title representation, generate a summary representation, generate a category feature representation, and generate a subcategory feature representation, and then obtain a news representation based on this information; the details are as follows: Construct a mapping table: Build a word mapping table based on each word in the dataset, and map each word in the table to a unique numeric identifier. The mapping rule is: start with the number 1, and then sort each word in the order in which it is entered into the word mapping table, thereby forming a word mapping conversion table. Similarly, construct a news category mapping table and a news subcategory mapping table, and convert the category and subcategory into corresponding numeric identifiers respectively. The mapping rules are similar to those of the word mapping conversion table. Generate title representation: Use word embedding layer to encode the title of the news into title embedding representation The subscript N represents the length of the title. For the title embedding representation, a convolutional neural network is used to encode and generate the convolutional title representation. The specific implementation of the convolutional neural network is shown in the following formula: Where iw is the i-th word in the title; w is the size of the convolutional neural network sliding window, which is set to 3; is the embedding representation of the (iw-w)th word to the (iw+w)th word in the title embedding representation; F t and b t is the parameter of the convolutional neural network; ReLU is the activation function; is the title representation after convolution; The convolutional title representation is further encoded using the additive attention network to generate the title representation; the specific implementation is shown in the following formula: Among them, V at 、v at is a trainable parameter; is the title representation after convolution, from formula (1); is the similarity between words in the news title; tanh is the activation function; is the attention weight between words in the news title; r t is the title representation; N is the length of the title; Generate summary representation: Use word embedding layer to convert the summary of the news into summary embedding representation The subscript M represents the length of the summary. For the summary embedding representation, similar operations are used to process it as the title embedding representation to generate the summary representation r b ; Generate category feature representation and subcategory feature representation: Use category embedding layer and subcategory embedding layer to convert the category and subcategory of news into category embedding representation c and subcategory embedding representation e sc ; For the category embedding representation and subcategory embedding representation, a fully connected neural network is used to encode them and generate the category feature representation r c and subcategory feature representation r sc ; For specific implementation, see the following formula: r c =ReLU(V c ×e c +v c ), r sc =ReLU(V sc ×e sc +v sc ), (3) Among them, V c 、V sc 、v c and v sc is the parameter of the fully connected neural network; e c 、e sc are category embedding representation and subcategory embedding representation respectively; r c 、r sc They are category feature representation and subcategory feature representation respectively; Generate news representation: Use a multi-view attention network to fuse title representation, summary representation, category feature representation, and subcategory feature representation; set the attention weights corresponding to the above information to be α t , α b , α c and α sc , the calculation methods of these four attention weights are similar; only α is introduced here t The calculation method of the other three attention weights is similar to this. The specific implementation method is shown in the following formula: Among them, U v 、u v and q v is a trainable parameter; a t is the similarity between words in the title, and similar operations are performed to obtain the similarity between words in the summary, category, and subcategory. b 、a c and a sc ; α t is the attention weight of the title, and similar operations are used to obtain the attention weights α of the summary, category, and subcategory b , α c and α sc ; Finally, the news representation n is obtained by weighted summation based on the attention weights. The specific implementation method is shown in the following formula: n=α c r c +α sc r sc +α t r t +α b r b . (5) Among them, α t , α b , α c and α sc are the attention weights of title, summary, category, and subcategory, respectively, from formula (4); n is the news representation; Since the input of the news encoder consists of two parts: historical news sequence and candidate news, the news representation includes the news representation of the historical news sequence and the news representation of the candidate news; according to formula (5), it can be expressed as: [n1,...,n i ,...,n N ;n C ]; where n1,...,n i ,...,n N News representation of historical news sequence; n C This is the news representation of the candidate news.
3. The news recommendation method based on joint modeling of news events and news styles according to claim 1 is characterized in that: The specific steps of constructing the news recommendation model event-style decoupler based on the joint modeling of news events and news styles in step S2 are as follows: Taking news representation as input, the news representation is first encoded using an event-style encoder to obtain a high-level news representation. Then, an event decoder and a style decoder are used to extract news event representation and news style representation from the high-level news representation, respectively. These two representations are then further encoded using an event classifier to obtain event-based news event distribution and style-based news event distribution. To optimize the event-style decoupler, an event prediction loss, a reconstruction loss, and an adversarial loss are designed to construct the final auxiliary loss to assist in model training. Event-style encoder: takes news representation as input, news representation n1,...,n of historical news sequence i ,...,n N Pass it to the event-style encoder for encoding to obtain a high-level news representation; The event-style encoder consists of a three-layer fully connected neural network, using the ReLU function as the activation function. A residual network is also added to the event-style encoder to alleviate the problem of information loss. For the representation of news events in the historical news sequence, the specific implementation method of the news encoder is shown in the following formula: Among them, n i is the news representation of the i-th browsed news in the historical news sequence; ReLU is the activation function; Dense is the fully connected neural network; [;] is the connection operation; The news representation after encoding by the fully connected neural network; h i is the high-level news representation of the i-th browsed news in the historical news sequence; Event decoder and style decoder: The high-level news representation is input and passed to the event decoder and style decoder for decoding, resulting in news event representation and news style representation. The event decoder and style decoder are similar in structure, both consisting of a three-layer fully connected neural network equipped with a residual network. The specific implementation method of the event decoder is shown in the following formula: Among them, h i is the high-level news representation of the i-th browsed news in the historical news sequence, which comes from formula (6); Both are high-level news representations encoded by fully connected neural networks; e i is the news event representation of the i-th browsed news in the historical news sequence; the style decoder obtains the news style representation t by similar operations. i , the code implementation of this decoder is similar to the code implementation of formula (7); Event Classifier: Taking news event representation and news style representation as input, the event classifier further encodes the news event representation and news style representation to obtain event-based news event distribution and style-based news event distribution. The event classifier consists of a fully connected neural network with a softmax activation function. The specific implementation method is shown in the following formula: p e,i =softmax(Dense(e i )), (8) Among them, e i is the news event representation of the i-th browsed news in the historical news sequence, from formula (7); softmax is the activation function; p e,i is the event-based news event distribution of the i-th browsed news in the historical news sequence; similar operations are used to obtain the style-based news event distribution p t,i ; To better assist model training, we need to construct a realistic news event distribution. However, this label is not provided in the dataset. Therefore, we design an algorithm to construct a realistic news event distribution. We first use TF-IDF to extract keywords for each news item. Then, we use BERT to encode the keywords into keyword word vectors. We further use K-means to cluster the keywords into K categories, i.e., K event channels. For the i-th browsed news item in the historical news sequence, the news event distribution on the j-th event channel is calculated as shown in the following formula: Among them, |NK ij | represents the number of keywords belonging to the jth event channel in the i-th browsed news in the historical news sequence; |NK| represents the number of all keywords in the news; p e,ij is the real news event distribution of the i-th browsed news on the j-th event channel in the historical news sequence; p e,i =[p e,i1 ,p e,i2 ,...,p e,iK ] is the real news event distribution based on events of the i-th browsing news in the historical news sequence; K is the number of event channels, which is set to 17; Constructing auxiliary losses: To optimize the event-style decoupling module, three loss functions are designed: reconstruction loss, event prediction loss, and adversarial loss. The reconstruction loss is used to alleviate the information loss problem caused by the decoupling process. The news event representation and news style representation are connected and then encoded using a fully connected neural network to obtain the reconstructed news representation. Finally, the MSE function is used to constrain the news representation and the reconstructed news representation. The specific implementation method is shown in the following formula: Among them, e i , t i are the news event representation and news style representation of the i-th browsed news in the historical news sequence, both of which come from formula (7); n i is the news representation of the i-th browsed news in the historical news sequence, from formula (6); MSE is the mean square error function; is the reconstruction loss; Event prediction loss is used to narrow the gap between the event-based news event distribution and the real news event distribution; the specific implementation method is shown in the following formula: Among them, p e,i is the event-based news event distribution of the i-th browsed news in the historical news sequence, from formula (8); p e,i is the real news event distribution based on events of the i-th browsed news in the historical news sequence, which comes from formula (9); predicting losses for events; The adversarial loss takes the news style representation as input, obtains the style-based news event distribution through the event classifier, and increases the distance between it and the real news event distribution. The specific implementation method is shown in the following formula: Among them, p t,ij is the style-based news event distribution of the i-th browsed news on the j-th event channel in the historical news sequence, from formula (8); p e,ij is the news event distribution based on style truth of the i-th browsed news on the j-th event channel in the historical news sequence, which comes from formula (9); To combat losses; Finally, the auxiliary loss is composed of the three losses mentioned above; the specific implementation method is shown in the following formula: in, They are reconstruction loss, event prediction loss, and adversarial loss, which come from formula (10), formula (11), and formula (12).
4. The news recommendation method based on joint modeling of news events and news styles according to claim 1 is characterized in that: The specific steps of constructing the news recommendation model event matching module based on the joint modeling of news events and news styles in step S2 are as follows: The news event representation output by formula (7) and the event-based event distribution output by formula (8) are respectively used as inputs; wherein, the news event representation includes the news event representation of the historical news sequence and the news event representation of the candidate news; similarly, the event-based news event distribution includes the event-based news event distribution of the historical news sequence and the event-based news event distribution of the candidate news; the event channel modeling layer is used to encode the news event representation of the historical news sequence on different event channels to generate event-based user representations; the news event representation of the candidate news is divided according to different event channels to generate news event representations of the candidate news on different event channels; the fine-grained event matching layer is used to calculate the inner product of the event-based user representation and the news event representation of the candidate news on different event channels to obtain the event matching scores of the candidate news on different event channels; finally, the event matching scores of each event channel are aggregated through the score attention network to generate a fine-grained event matching score; the construction steps of the event matching module are as follows: Constructing the event channel modeling layer: Taking the news event representation of the historical news sequence, the news event representation of the candidate news, the event-based news event distribution of the historical news sequence, and the event-based news event distribution of the candidate news as input, first divide the news event representation of the historical news sequence and the news event representation of the candidate news into different event channels according to the event-based news event distribution of the historical news sequence and the event-based news event distribution of the candidate news. For the news event representation of the i-th browsed news in the historical news sequence, the specific description of its division method is as follows: Among them, p e,i is the event-based news event distribution of the i-th browsed news in the historical news sequence, from formula (8); e i is the news event representation of the i-th browsed news in the historical news sequence, which comes from formula (7); is the news event representation of the i-th browsed news in the historical news sequence on different event channels; in is the news event representation of the i-th browsed news in the historical news sequence on the first event channel; K is the number of event channels; Similarly, for the news event representation of candidate news, the same method is used to divide it into different event channels to generate news event representations of candidate news on different event channels. Where subscript c represents candidate news; j represents the jth event channel; Furthermore, in order to generate event-based user representation on each channel, this layer uses a channel attention network for encoding on each event channel; for the event-based user representation on the j-th event channel, its specific implementation method is shown in the following formula: in, is the news event representation of the i-th browsed news on the j-th event channel in the historical news sequence, from formula (14); q j 、V j and v j is the parameter of channel attention; is the similarity of the i-th browsed news on the j-th event channel; is the attention weight of the i-th browsing news on the j-th event channel; is the event-based user representation on the j-th event channel; is the event-based user representation; l is the length of the historical news sequence, which is set to 50; Construct a fine-grained event matching layer: Using the event-based user representations obtained by the event channel modeling layer and the news event representations of candidate news on different event channels as input, generate event matching scores on each event channel, and aggregate them into event matching scores through score attention. The event matching score calculation method for the j-th event channel is shown in the following formula: in, is the event-based user representation on the j-th event channel, from formula (15); is the news event representation of the candidate news on the jth event channel, which comes from formula (14); is the event matching score of the jth event channel; This layer aggregates the event matching scores of each event channel through a score attention network to generate a fine-grained event matching score. Since the event-based news event distribution of candidate news has a certain influence on the score attention, the construction of the score attention should take this factor into consideration. The event-based news event distribution of candidate news is firstly Mapping; where p e,c is the event-based news event distribution of the candidate news, from formula (8); is the discrete vector of event-based news event distribution of the candidate news; Then, the discrete vector of the event-based news event distribution of the candidate news is converted into the candidate news event distribution representation P" through a fully connected neural network e,c The specific implementation method is shown in the following formula: in, is the discrete vector of event-based news event distribution of candidate news; P' e,c for Embedded representation of P” e,c is the distribution representation of candidate news events; Finally, based on the candidate news event distribution, we express P" e,c Construct score attention on different event channels and calculate event matching scores. The specific implementation method is shown in the following formula: Among them, P e,cj is the news event distribution representation of the candidate news on the jth event channel, from formula (17); q s 、V s and v s are the parameters of the score attention network; is the similarity of the candidate news on the jth event channel; is the attention weight of the candidate news on the jth event channel; s f is the event matching score; K is the number of event channels.
5. The news recommendation method based on joint modeling of news events and news styles according to claim 4 is characterized in that: The specific steps of constructing the news recommendation model style matching module based on the joint modeling of news events and news styles in step S2 are as follows: Taking the user ID and the news style representation described in claim 4 as input, wherein the news style representation includes the news style representation of the historical news sequence and the news style representation of the candidate news, and the acquisition method thereof is similar to the news event representation of the historical news sequence and the news event representation of the candidate news described in claim 4; The style matching module first uses multi-head attention to encode the news style representation of the historical news sequence to capture the interactions in the news and generate the news style representation after the interaction of the historical news sequence; the specific implementation method is shown in the following formula: [t'1,t'2,…,t' l ]=MultiHeadAttention(T), (19) Where T=[t1,t2,...,t l ] is the news style representation of the historical news sequence; t1 and t'1 are the news style representation of the first news in the historical news sequence and the news style representation after the interaction of the first news in the historical news sequence respectively; other symbols are similar to this; For the news style representation after the interaction of historical news sequences, style attention network encoding is used to generate style-based user representation; the specific implementation method is shown in the following formula: Among them, u d Represents the embedded representation of the user ID; u' d Represents the feature representation of user ID; q t 、V t 、V d and v are model parameters; t' i is the news style representation of the i-th news after interaction in the historical news sequence; is the similarity between news style representations after interaction of historical news sequences; is the style attention weight; u t for style-based user representation; Furthermore, the inner product of the style-based user representation and the news style representation of the candidate news is calculated to generate a style matching score. The specific implementation method is shown in the following formula: Among them, u t is the style-based user representation, from formula (20); t c is the news style representation of the candidate news; t is the representative style matching score.
6. The news recommendation method based on joint modeling of news events and news styles according to claim 4 or 5, characterized in that: The specific steps of constructing the candidate news prediction module of the news recommendation model based on the joint modeling of news events and news styles in step S2 are as follows: The candidate news prediction module takes the event matching score described in claim 4 and the style matching score described in claim 5 as input, and obtains the prediction score of the candidate news by weighted addition. The specific implementation method is shown in the following formula: s=s f +βs t (22) Among them, s f is the event matching score, from formula (18); s t is the style matching score, which comes from formula (21); s is the predicted score of the candidate news; β is the weight, which is set to 1.
9.
7. The news recommendation method based on joint modeling of news events and news styles according to claim 1 is characterized in that: In step S3, the news recommendation model constructed in step S2 is trained in the training data set obtained in step S1. The specific steps are as follows: Construct loss function: Using negative sampling technology, define a candidate news that is clicked by the user as a positive sample, and a candidate news that is not clicked by the user as a negative sample, and calculate the click prediction probability p of the positive sample i The specific implementation method is shown in the following formula: in, is the click rate of the jth negative example relative to the ith positive example in the same click sequence; is the i-th positive example; G is the number of negative examples; The loss function of the model is the negative log-likelihood function of all positive examples. The specific implementation method is shown in the following formula: Among them, p i is the predicted click probability of the positive sample; is the set of positive examples; Furthermore, the overall loss function is defined as in, is the auxiliary loss, which comes from formula (13); γ is a hyperparameter, which is set to 1.6 here; Optimize the model: Use the Adam algorithm as the optimization function of the model; the learning rate parameter is set to 0.0001, and other hyperparameters use the default values in PyTorch; When the model of this method has not been fully trained, it needs to be trained on the training data set to optimize the model parameters; when the model training is completed, the candidate news prediction module can predict the prediction score of each candidate news and recommend suitable news to the current user based on the score.
8. A news recommendation system based on joint modeling of news events and news styles, characterized by: The system includes a training data set generation unit, a news recommendation model construction unit based on joint modeling of news events and news styles, and a model training unit, each of which implements the news recommendation method based on joint modeling of news events and news styles described in any one of claims 1 to 7, specifically: A training data set generation unit is used to obtain user browsing history information on online news websites and then perform preprocessing operations on it to obtain user browsing history and news text content that meet training requirements; A news recommendation model construction unit based on joint modeling of news events and news styles, which is used to construct a news encoder, an event-style decoupler, an event matching module, a style matching module, and a candidate news prediction module; The model training unit is used to construct the loss function required in the model training process and complete the optimization training of the model.
9. A storage medium storing a plurality of instructions, characterized in that: The instructions are loaded by the processor to execute the steps of the news recommendation method based on joint modeling of news events and news styles as described in any one of claims 1-7.
10. An electronic device, characterized in that: The electronic device comprises: the storage medium according to claim 9; and a processor for executing instructions in the storage medium.
Citation Information
Patent Citations
Recommendation method and system based on adaptive dynamic knowledge graph in heterogeneous network
CN115329215A
Multi-modal news recommendation method and apparatus based on multi-head self-attention neural mechanism
WO2023065618A1