News recommendation method and system based on knowledge enhancement and attention mechanism
By introducing knowledge graphs and graph attention networks into the news recommendation system, and combining convolutional neural networks with multiple attention mechanisms, the problem of the existing system's failure to utilize knowledge-level information and dynamic acquisition of user interests is solved, achieving a more accurate News recommendation effect.
Patent Information
- Application Number
- CN202210421741.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-21
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-04-21
AI Technical Summary
Existing news recommendation systems fail to make full use of knowledge-level information, and it is difficult to dynamically and accurately obtain user interests, resulting in poor recommendation results.
Introduce knowledge graph and graph attention network, combine with multiple convolutional neural networks based on attention mechanism, obtain entities and new entity links and association rules, calculate reachable paths between news entities, enhance text feature representation, and dynamically Get the user's current interests.
It improves the accuracy of news click-through rate, enhances the richness and dynamics of user interest expression, and improves the accuracy of recommendations.
Smart Images

Figure CN114741599B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of big data and natural language processing, and in particular to a news recommendation method and system based on knowledge enhancement and attention mechanism. 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 the Internet, users' demand for online news is gradually increasing. News platforms have a large amount of news information. If users are allowed to choose directly, it will cause great selection difficulties for users. Therefore, it is crucial for news platforms to build a personalized recommendation system that can capture users' reading interests and push relevant information. In recommendation systems, there are three main types of algorithms: content-based methods, collaborative filtering, and hybrid methods. Since collaborative filtering has the characteristics of sparse interaction information between users and items and has a cold start problem, it is not suitable for news recommendation scenarios. The mainstream news recommendation methods are usually based on content or hybrid methods.
[0004] At present, most news-based recommendation systems only learn the representation of news from the semantic layer, ignoring the knowledge-level information contained in the news itself. Most of the knowledge-level information exists in the knowledge graph, and there are few studies on combining news recommendation models with knowledge graphs. Wang et al. proposed a deep recommendation model DKN that integrates knowledge graph information. DKN first constructs a knowledge graph that is highly relevant to the task, and then integrates the entity information of the knowledge graph into the neural network based on the traditional deep neural network model, achieving the goal of integrating the semantic representation of news with the knowledge representation of entities. Although this method takes into account information at different levels, experiments have shown that it is better than the traditional method that does not add entity information, but it does not take into account the importance of neighbors in a neighborhood with a certain number of hops.
[0005] In addition, news has a certain degree of immediacy. The deep recommendation model DKN proposed by Wang et al. that integrates knowledge graph information only uses a single convolutional neural network based on the attention mechanism to obtain user interests, which cannot dynamically and accurately obtain user interests within a period of time. Summary of the invention
[0006] In order to address the deficiencies of the prior art, the present invention provides a news recommendation method and system based on knowledge enhancement and attention mechanism; introduces a knowledge graph and a graph attention network, uses the knowledge graph to obtain entities and new entity links and new association rules from the data, and on the basis of utilizing the knowledge graph, combines the graph attention network to perform a correlation search on the text features in the news title, calculates the weight of the relevant edges within a set number of steps, that is, the importance of the relationship, mainly to find the reachable path between news entities, select the reachable path between news entities, obtain additional related entities and context representations, so as to enhance the text feature representation and obtain rich news features.
[0007] In the first aspect, the present invention provides a news recommendation method based on knowledge enhancement and attention mechanism;
[0008] News recommendation methods based on knowledge enhancement and attention mechanism include:
[0009] Obtain historical click data of users on news links; obtain candidate news data;
[0010] Input the historical click data and candidate news data into the trained news recommendation model to obtain personalized news data recommended for users;
[0011] Among them, the news recommendation model constructs several user interest representations based on the user's historical click data on several news links; matches all user interest representations with each candidate news data to obtain matching results; aggregates all user interest representations using different weights to obtain aggregated results; obtains the feature vector of the news that the user is interested in based on the matching results and the aggregated results; splices the feature vector of the news that the user is interested in with the feature vector of the candidate news, predicts the splicing result, and obtains recommended candidate news; and recommends the result to the user.
[0012] In the second aspect, the present invention provides a news recommendation system based on knowledge enhancement and attention mechanism;
[0013] News recommendation system based on knowledge enhancement and attention mechanism, including:
[0014] The acquisition module is configured to: acquire historical click data of users on news links; acquire candidate news data;
[0015] The recommendation module is configured to: input the historical click data and the candidate news data into the trained news recommendation model to obtain personalized news data recommended for the user;
[0016] Among them, the news recommendation model constructs several user interest representations based on the user's historical click data on several news links; matches all user interest representations with each candidate news data to obtain matching results; aggregates all user interest representations using different weights to obtain aggregated results; obtains the feature vector of the news that the user is interested in based on the matching results and the aggregated results; splices the feature vector of the news that the user is interested in with the feature vector of the candidate news, predicts the splicing result, and obtains recommended candidate news; and recommends the result to the user.
[0017] In a third aspect, the present invention further provides an electronic device, comprising:
[0018] a memory for non-transitory storage of computer-readable instructions; and
[0019] a processor for executing the computer readable instructions,
[0020] When the computer-readable instructions are executed by the processor, the method described in the first aspect is executed.
[0021] 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.
[0022] 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.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] (1) Compared with the traditional news-based recommendation method, the present invention uses data from multiple news platforms while ensuring training efficiency, thereby more deeply exploring the interests of users and more accurately estimating the click-through rate (CTR) of news under different news data conditions, thereby improving the accuracy of the overall CTR estimation;
[0025] (2) The present invention introduces a knowledge graph and a graph attention network, and uses the knowledge graph to obtain entities and new entity links and new association rules from the data. On the basis of utilizing the knowledge graph, the graph attention network is combined to search for the relevance of text features in news titles, and the weights of related edges, that is, the importance of the relationship, are calculated within an appropriate number of steps. The main purpose is to find the reachable paths between news entities, select the reachable paths between news entities, obtain additional related entities and context representations, so as to enhance the text feature representation and obtain rich news features.
[0026] (3) The present invention introduces multiple convolutional neural networks based on the attention mechanism. The attention mechanism draws on the processing method of human vision and focuses attention on key areas. The essence of this mechanism is to select information that plays a key role in the task from a lot of information, thereby reducing the complexity of the task. The present invention dynamically obtains the user's current interest through a convolutional neural network based on the attention mechanism, that is, the user behavior is linked to the current behavior through the attention mechanism, so as to better estimate the user's real-time interest, thereby improving the prediction ability. In this way, the representation vector of the user's interest changes with different news, which improves the representation ability under limited dimensions and can better quantify the different interests of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings in the specification, 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.
[0028] Figure 1 is a flow chart of the method of embodiment 1;
[0029] Figure 2 Schematic diagram of a convolutional neural network based on an attention mechanism in Example 1;
[0030] Figure 3 Schematic diagram of an encoder according to Embodiment 1. DETAILED DESCRIPTION
[0031] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used in the present invention have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0032] 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 "include" and "have" and any of their variations 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.
[0033] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0034] In this embodiment, all data is obtained in compliance with laws and regulations and based on the user's consent, and is used legally.
[0035] Embodiment 1
[0036] This embodiment provides a news recommendation method based on knowledge enhancement and attention mechanism;
[0037] like Figure 1 As shown in the figure, the news recommendation method based on knowledge enhancement and attention mechanism includes:
[0038] S101: Obtain historical click data of users on news links; obtain candidate news data;
[0039] S102: inputting the historical click data and the candidate news data into the trained news recommendation model to obtain personalized news data recommended for the user;
[0040] Among them, the news recommendation model constructs several user interest representations based on the user's historical click data on several news links; matches all user interest representations with each candidate news data to obtain matching results; aggregates all user interest representations using different weights to obtain aggregated results; obtains the feature vector of the news that the user is interested in based on the matching results and the aggregated results; splices the feature vector of the news that the user is interested in with the feature vector of the candidate news, predicts the splicing result, and obtains recommended candidate news; and recommends the result to the user.
[0041] Furthermore, the news recommendation model includes: M first encoders and one second encoder; wherein M is a positive integer;
[0042] The first encoder is used to encode the news titles browsed by the user to obtain the user interest representation;
[0043] The second encoder is used to encode the candidate news title to obtain a feature vector of the candidate news;
[0044] The output ends of two adjacent first encoders are connected to the input ends of the corresponding first convolutional neural networks based on the attention mechanism; wherein the number of the first convolutional neural networks based on the attention mechanism is M-1;
[0045] All output ends of the first encoder and the output ends of the second encoder are connected to the input end of the second convolutional neural network based on the attention mechanism; wherein the number of the second convolutional neural network based on the attention mechanism is one;
[0046] The output end of the second attention-based convolutional neural network and the output ends of all the first attention-based convolutional neural networks are connected to the multiplier;
[0047] The multiplier outputs the feature vector of the news that the user is interested in;
[0048] The output end of the multiplier and the output end of the second encoder are both connected to the input end of the splicing unit to realize the splicing of the feature vector of the news that the user is interested in and the feature vector of the candidate news;
[0049] The output end of the splicing unit is connected to the input end of the multilayer perceptron, and the output end of the multilayer perceptron is used to output the recommended candidate news.
[0050] Furthermore, the internal structures of the first encoder and the second encoder are the same.
[0051] Furthermore, if Figure 3 As shown, the first encoder includes: an embedding layer, a graph attention network, a convolutional neural network layer and a maximum pooling layer connected in sequence.
[0052] Furthermore, the internal structure of the first convolutional neural network based on the attention mechanism is the same as the internal structure of the second convolutional neural network based on the attention mechanism.
[0053] Furthermore, if Figure 2 As shown, the first convolutional neural network based on the attention mechanism has a network structure including the following connected in sequence: attention distribution calculation layer, interest weight acquisition layer, basic weight acquisition layer, final weight acquisition layer, and aggregation feature acquisition layer.
[0054] Furthermore, the working principle of the first convolutional neural network based on the attention mechanism is:
[0055] The attention distribution calculation layer is used to convert the user's historical news click sequence into a low-dimensional real number vector through the Embedding layer to use it as an attention signal, encode the user behavior sequence, and calculate the attention distribution;
[0056] The interest weight acquisition layer is used to calculate the weighted average of attention and convert it into interest weight through the attention mechanism according to the similarity, so that the user's interests can be deeply mined;
[0057] The basic weight acquisition layer is used to perform the attention mechanism operation on the user behavior sequence again according to the vector of the recommended item to obtain the basic weight;
[0058] The final weight acquisition layer is used to average the interest weights and basic weights obtained through the attention mechanism to obtain the final weight of each item that the user has interacted with;
[0059] The aggregate feature acquisition layer is used to perform weighted fusion on the input sequence and use the obtained vector as the aggregate feature of the input sequence.
[0060] Furthermore, the method of constructing several user interest representations based on the historical click data of the user on several news links specifically includes:
[0061] (11): Using the existing knowledge graph, we extract entities from a certain historical click news title, obtain entities, the connecting edges between entities, and the association rules between entities, and then obtain the relationship construction subgraph;
[0062] (12): Use the graph attention network to perform a correlation search on each entity in the relationship construction subgraph, calculate the weight of the connecting edges between entities, and select entities whose weights are higher than the set threshold;
[0063] (13): A convolutional neural network is used to perform feature representation on the selected entities and obtain the user interest representation of the currently viewed news headlines.
[0064] Furthermore, the above (11) uses the existing knowledge graph to extract entities from a certain historical click news title, obtain entities, connection edges between entities, and association rules between entities, and then obtain a relationship construction subgraph, which specifically includes:
[0065] (111) Identify entities from news titles. After processing all news titles, we get a news entity set E. news ;
[0066] (112) According to the news entity set E news , extract a subgraph from the existing knowledge graph: for all relations in the existing knowledge graph, news The threshold of the frequency of entities with the same entity word is set to n times. When the frequency of two entities appears more than n times, a relationship between the two entities is established, and the subgraph is removed from the entities that are not connected to any e i ∈E news The nodes and corresponding edges on the path; n is a positive integer, such as 10;
[0067] (113) A knowledge representation learning method (TransE, TranslatingEmbedding) is used to map the entities and relationships in the knowledge graph subgraph into a low-dimensional vector space to obtain the feature vectors of the entities and relationships for subsequent use.
[0068] The historical clicked news of user i is in, is the title of the jth news clicked by user i, N i is the total number of news clicked by user i;
[0069] For each news title, it is composed of a series of words, i.e., t = [w1, w2, ...], each of which may be associated with an entity e in the knowledge graph;
[0070] The historical news click records of a user i are The corresponding news features are expressed as in is the title of the jth news clicked by user i, N i is the total number of news clicked by user i.
[0071] The knowledge graph is represented as a collection of entity-relationship-entity triplets: where ε and They represent the set of entities and relations respectively, and (h, r, t) indicates that there is a relation r from h to t. The entity feature is the entity vector in the news title. Each word may correspond to an entity vector in the knowledge graph. If there is no corresponding entity, it is filled with a zero vector.
[0072] It should be understood that in order to utilize the information of the knowledge graph in the model, the present invention constructs a knowledge graph that is highly relevant to the task, and uses the knowledge graph to obtain entities and new entity links and new association rules from the data.
[0073] Furthermore, the (12): using a graph attention network to perform a correlation search on each entity of the relationship construction subgraph, calculating the weight of the connecting edge between entities, and selecting entities with weights higher than a set threshold; specifically includes:
[0074] (121): Use TransE to learn embedding vectors for each entity and relation TransE embeds entities / relations on the knowledge graph and keeps the features unchanged.
[0075] let To represent the set of head entities h in the triple. An entity can be represented as:
[0076]
[0077] in: Represents vector connection, represents e h and e t is the entity vector learned from TransE. π(h,r,t) is the attention weight that controls the amount of information that neighbor nodes need to propagate to the current entity, calculated using a two-layer fully connected neural network:
[0078]
[0079]
[0080] Among them: The softmax function is used to normalize the coefficients. The graph attention network is used to enable only the neighborhood of the single-hop graph, and the TransE embedding vector is used as the node feature. The trainable parameters are {W0, W1, w2, b1, b2}.
[0081] (122): By enriching the entity representation, the relevant contextual information of the entity is enriched. The context embedding is calculated as the average of its context entities:
[0082]
[0083]
[0084] (123): This is because entity vectors and word vectors belong to different vector spaces.
[0085] First, a mapping function is introduced to map the entity vectors and into the same vector space as the text features to obtain the entity feature matrix.
[0086] g(e)=tanh(Me+b)
[0087] in: is a trainable transformation matrix, is a trainable parameter.
[0088] Then, the same mapping function as the entity feature is used to map it to the same vector space as the text feature to obtain the entity context feature matrix.
[0089] Finally, the text feature matrix, entity feature matrix, and entity context feature matrix construct a three-channel input, and through CNN, the news feature vector e(t) is extracted, where is the output of the i-th convolution kernel, and m is the number of convolution kernels:
[0090]
[0091] Exemplarily, the graph attention network is used to search for the association of each extracted entity, calculate the weight of the connecting edge between entities, and select entities with weights higher than a set threshold; based on the idea of the graph attention network GAT, a search for the association of each entity appearing in the news is performed, and the weight of the related edge, that is, the importance of the relationship, is calculated within a set number of steps. The main purpose is to find the reachable path between news entities, select the reachable path between news entities, and select entities with high importance for embedding. A richer representation of news features is obtained, and the user's real-time interest is better estimated, thereby improving the accuracy of the Click-Through-Rate (CTR) estimation.
[0092] Furthermore, the method of aggregating all user interest expressions using different weights to obtain an aggregation result specifically refers to:
[0093] The first convolutional neural network based on the attention mechanism is adopted to aggregate all user interest representations using different weights to obtain the aggregated result.
[0094] Furthermore, the method of aggregating all user interest expressions using different weights to obtain an aggregation result specifically includes:
[0095] All user interest representations are weighted and summed using different set weights to obtain the aggregated result.
[0096] Exemplarily, the method of aggregating all user interest expressions using different weights to obtain an aggregation result specifically includes:
[0097] For current candidate news j The user representation i is calculated using a convolutional neural network mechanism based on the attention mechanism to calculate the user's current interest feature representation:
[0098]
[0099] e(t j )=tanh(W t e(t j )+b t )Formula (8)
[0100]
[0101] Where: s j Is used to measure historical click news For candidate news e(t j ), m=1,…,N i In addition, {W w ,W t ,bw ,b t} is a trainable parameter, W w ,W t ∈R d×d , b w , b t ,v, d is the dimension of news embedding. Convolutional neural network based on attention mechanism Receives two news headline embeddings as input and outputs influence weights.
[0102] The calculation of user i’s dynamic interest feature e(i) is as follows:
[0103]
[0104] Furthermore, all user interest expressions are matched with each candidate news data to obtain a matching result; specifically, it means:
[0105] The second convolutional neural network based on the attention mechanism is used to match all user interest representations with each candidate news data to obtain the matching results.
[0106] Furthermore, based on the matching results and the aggregation results, the feature vector of the news that the user is interested in is obtained; specifically, the feature vector includes:
[0107] Multiply the matching result and the aggregation result to obtain the feature vector of the news that the user is interested in.
[0108] It should be understood that for the news titles that the user has browsed, the candidate news features are considered, and the convolutional neural network ANN (Attention And DNN for User Interest Extraction) based on the attention mechanism is used to match the candidate news with each clicked news, and aggregate the feature representation of the user's current interest. The present invention believes that the news clicked by the user has different effects on the candidate news. Multiple convolutional neural networks based on the attention mechanism are used in the model to automatically match each clicked news with the candidate news, and aggregate the user's current interest with different weights. Among them, ANN acts as a user interest extractor to obtain the user's current interest in the candidate news based on the historical news clicked by the user.
[0109] Furthermore, the feature vector of the news that the user is interested in is concatenated with the feature vector of the candidate news; specifically, the process includes:
[0110] Concatenate the feature vector of the news that the user is interested in with the feature vector of the candidate news.
[0111] Furthermore, the prediction of the splicing results to obtain recommended candidate news specifically includes:
[0112] Input the splicing result into the multi-layer perceptron to obtain the recommendation probability value of the recommended candidate news;
[0113] The candidate news are sorted in descending order according to the recommendation probability value, and the news with the highest ranking is recommended to the user.
[0114] It should be understood that the concatenated feature vector is used as the input of the MLP network, and the MLP network is used to extract high-order features and estimate the final result, with complementary advantages to obtain an accurate estimate of the item CTR.
[0115] Exemplarily, predicting the splicing results to obtain recommended candidate news may specifically include:
[0116] In predicting whether user i will click on candidate news title t j The user's dynamic interest characteristics and candidate news features are taken into account, and the second convolutional neural network based on the attention mechanism is used To predict the probability of a user clicking on a candidate news item, the formula is as follows:
[0117]
[0118] in, represents the network output after the softmax layer, representing sample t j The predicted probability of being clicked; select the Adam algorithm as the optimization algorithm, select the Adam optimizer as the optimizer, and use the AUC value for evaluation. The AUC value range is between 0.5 and 1. The closer the AUC value is to 1, the higher the prediction authenticity.
[0119] This application uses knowledge graphs and graph attention networks to perform relevance search on text features in news titles, obtain additional relevant entity and context representations to enhance text feature representation, and use CNN to integrate text, entity and context information; construct user feature representation: use multiple convolutional neural networks based on attention mechanisms to dynamically aggregate user interest representations, enhance the effect of extracting user interests, and then obtain user feature representations; obtain accurate CTR estimation results: concatenate user feature representations with candidate news feature representations as input to the MLP network, perform high-order feature extraction and estimate the final results through the MLP network, and obtain an accurate estimate of the CTR of candidate news.
[0120] In summary, the news recommendation method based on knowledge enhancement and attention mechanism of the present invention can recommend news that better meets the expectations or needs of users, and has a higher prediction accuracy compared with the existing news recommendation method.
[0121] Embodiment 2
[0122] This embodiment provides a news recommendation system based on knowledge enhancement and attention mechanism;
[0123] News recommendation system based on knowledge enhancement and attention mechanism, including:
[0124] The acquisition module is configured to: acquire historical click data of users on news links; acquire candidate news data;
[0125] An acquisition module is configured to: input the historical click data and the candidate news data into the trained news recommendation model to obtain news data personalized for the user;
[0126] Among them, the news recommendation model constructs several user interest representations based on the user's historical click data on several news links; matches all user interest representations with each candidate news data to obtain matching results; aggregates all user interest representations using different weights to obtain aggregated results; obtains the feature vector of the news that the user is interested in based on the matching results and the aggregated results; splices the feature vector of the news that the user is interested in with the feature vector of the candidate news, predicts the splicing result, and obtains recommended candidate news; and recommends the result to the user.
[0127] It should be noted that the acquisition module and the acquisition module above correspond to steps S101 and S102 in Embodiment 1, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in Embodiment 1 above. It should be noted that the above modules as part of the system can be executed in a computer system such as a set of computer executable instructions.
[0128] The description of each embodiment in the above embodiments has different emphases. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0129] The proposed system can be implemented in other ways. For example, the system embodiment described above is only illustrative, and the division of the modules is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0130] Embodiment 3
[0131] This embodiment also provides an electronic device, including: 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.
[0132] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf 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 the processor may also be any conventional processor, etc.
[0133] The memory may include a read-only memory and a random access memory, and provide 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.
[0134] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.
[0135] The method in the first embodiment can be directly embodied as a hardware processor, or a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
[0136] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with this embodiment can be implemented in 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. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0137] Embodiment 4
[0138] 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 completed.
[0139] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A news recommendation method based on knowledge enhancement and attention mechanism, characterized by: include: Obtain historical click data of users on news links; obtain candidate news data; Input the historical click data and candidate news data into the trained news recommendation model to obtain personalized news data recommended for users; Among them, the news recommendation model constructs several user interest representations based on the historical click data of users on several news links; matches all user interest representations with each candidate news data to obtain matching results; aggregates all user interest representations using different weights to obtain aggregated results; obtains the feature vector of the news that the user is interested in based on the matching results and the aggregated results; concatenates the feature vector of the news that the user is interested in with the feature vector of the candidate news, predicts the concatenation result, and obtains the recommended candidate news; recommends the result to the user; The news recommendation model includes: M first encoders and one second encoder; wherein M is a positive integer; The first encoder is used to encode the news titles browsed by the user to obtain the user interest representation; The second encoder is used to encode the candidate news title to obtain a feature vector of the candidate news; The output ends of two adjacent first encoders are connected to the input ends of the corresponding first convolutional neural networks based on the attention mechanism; wherein the number of the first convolutional neural networks based on the attention mechanism is M-1; All output ends of the first encoder and the output ends of the second encoder are connected to the input end of the second convolutional neural network based on the attention mechanism; wherein the number of the second convolutional neural network based on the attention mechanism is one; The output end of the second attention-based convolutional neural network and the output ends of all the first attention-based convolutional neural networks are connected to the multiplier; The multiplier outputs the feature vector of the news that the user is interested in; The output end of the multiplier and the output end of the second encoder are both connected to the input end of the splicing unit to realize the splicing of the feature vector of the news that the user is interested in and the feature vector of the candidate news; The output end of the splicing unit is connected to the input end of the multilayer perceptron, and the output end of the multilayer perceptron is used to output the recommended candidate news.
2. The news recommendation method based on knowledge enhancement and attention mechanism as claimed in claim 1, characterized in that: The first encoder includes: an embedding layer, a graph attention network, a convolutional neural network layer and a maximum pooling layer connected in sequence.
3. The news recommendation method based on knowledge enhancement and attention mechanism as claimed in claim 1, characterized in that: The method of constructing a plurality of user interest representations based on the historical click data of the user on a plurality of news links specifically includes: Using the existing knowledge graph, we extract entities from a certain historical click news title, obtain entities, the connecting edges between entities, and the association rules between entities, and then obtain the relationship construction subgraph; Using the graph attention network, we search for the association of each entity in the relationship construction subgraph, calculate the weight of the connecting edge between entities, and select entities with weights higher than the set threshold; A convolutional neural network is used to perform feature representation on the selected entities and obtain the user interest representation of the currently browsed news headlines.
4. The news recommendation method based on knowledge enhancement and attention mechanism as claimed in claim 3 is characterized in that: The existing knowledge graph is used to extract entities from a certain historical click news title, obtain entities, connection edges between entities, and association rules between entities, and then obtain a relationship construction subgraph, which specifically includes: (111) Identify entities from news titles. After processing all news titles, we get a news entity set E. news ; (112) According to the news entity set E news , extract a subgraph from the existing knowledge graph: for all relations in the existing knowledge graph, news The threshold of the frequency of entities with the same entity word is set to n times. When the frequency of two entities appears more than n times, a relationship between the two entities is established, and the subgraph is removed from the entities that are not connected to any e i ∈E news The nodes and corresponding edges on the path; n is a positive integer; (113) The knowledge representation learning method TransE is used to map the entities and relations in the knowledge graph subgraph into a low-dimensional vector space to obtain the feature vectors of the entities and relations for subsequent use.
5. The news recommendation method based on knowledge enhancement and attention mechanism as claimed in claim 3, characterized in that: Using the graph attention network, we search for the association of each entity in the relationship construction subgraph, calculate the weight of the connection edge between entities, and select entities with weights higher than the set threshold; specifically, we include: (121): Use TransE to learn embedding vectors for each entity and relation TransE embeds entities / relationships on the knowledge graph and keeps the features unchanged; let To represent the set of head entities h in the triple; an entity is represented as: in: Represents vector connection, represents e h and e t is the entity vector learned from TransE; π(h,r,t) is the attention weight that controls the amount of information that neighboring nodes need to propagate to the current entity, calculated using a two-layer fully connected neural network: Among them, the softmax function is used to normalize the coefficients; the graph attention network is used to only enable the neighborhood of the single-hop graph, and the TransE embedding vector is used as the node feature. The trainable parameters are {W0, W1, w2, b1, b2}; (122): By enriching the entity representation, the relevant contextual information of the entity is enriched; the context embedding is calculated as the average of its context entities: (123): Because entity vectors and word vectors belong to different vector spaces; First, a mapping function is introduced to map the entity vectors and into the same vector space as the text features to obtain the entity feature matrix; g(e)=tanh(Me+b) in: is a trainable transformation matrix, is a trainable parameter; Then, the same mapping function as the entity feature is used to map it to the same vector space as the text feature to obtain the entity context feature matrix; Finally, the text feature matrix, entity feature matrix, and entity context feature matrix construct a three-channel input, and through CNN, the news feature vector e(t) is extracted, where is the output of the i-th convolution kernel, and m is the number of convolution kernels:
6. The news recommendation method based on knowledge enhancement and attention mechanism as claimed in claim 1, characterized in that: The method of aggregating all user interest expressions using different weights to obtain an aggregation result specifically refers to: The first convolutional neural network based on the attention mechanism is used to aggregate all user interest representations using different weights to obtain the aggregated result; The method uses different weights to aggregate all user interest expressions to obtain an aggregation result; specifically includes: Use different set weights to perform weighted summation on all user interest representations to obtain the aggregated result; The method of matching all user interest expressions with each candidate news data to obtain a matching result specifically refers to: The second convolutional neural network based on the attention mechanism is used to match all user interest representations with each candidate news data to obtain matching results; Based on the matching results and aggregation results, the feature vector of the news that the user is interested in is obtained; specifically, it includes: Multiply the matching result and the aggregation result to obtain the feature vector of the news that the user is interested in; The feature vector of the news that the user is interested in is concatenated with the feature vector of the candidate news; specifically, it includes: Concatenate the feature vector of the news that the user is interested in with the feature vector of the candidate news; The method predicts the splicing results to obtain recommended candidate news; specifically includes: Input the splicing result into the multi-layer perceptron to obtain the recommendation probability value of the recommended candidate news; The candidate news are sorted in descending order according to the recommendation probability value, and the news with the highest ranking is recommended to the user.
7. A news recommendation system based on knowledge enhancement and attention mechanism, characterized by: include: The acquisition module is configured to: acquire historical click data of users on news links; acquire candidate news data; The recommendation module is configured to: input the historical click data and the candidate news data into the trained news recommendation model to obtain personalized news data recommended for the user; Among them, the news recommendation model constructs several user interest representations based on the historical click data of users on several news links; matches all user interest representations with each candidate news data to obtain matching results; aggregates all user interest representations using different weights to obtain aggregated results; obtains the feature vector of the news that the user is interested in based on the matching results and the aggregated results; concatenates the feature vector of the news that the user is interested in with the feature vector of the candidate news, predicts the concatenation result, and obtains the recommended candidate news; recommends the result to the user; The news recommendation model includes: M first encoders and one second encoder; wherein M is a positive integer; The first encoder is used to encode the news titles browsed by the user to obtain the user interest representation; The second encoder is used to encode the candidate news title to obtain a feature vector of the candidate news; The output ends of two adjacent first encoders are connected to the input ends of the corresponding first convolutional neural networks based on the attention mechanism; wherein the number of the first convolutional neural networks based on the attention mechanism is M-1; All output ends of the first encoder and the output ends of the second encoder are connected to the input end of the second convolutional neural network based on the attention mechanism; wherein the number of the second convolutional neural network based on the attention mechanism is one; The output end of the second attention-based convolutional neural network and the output ends of all the first attention-based convolutional neural networks are connected to the multiplier; The multiplier outputs the feature vector of the news that the user is interested in; The output end of the multiplier and the output end of the second encoder are both connected to the input end of the splicing unit to realize the splicing of the feature vector of the news that the user is interested in and the feature vector of the candidate news; The output end of the splicing unit is connected to the input end of the multilayer perceptron, and the output end of the multilayer perceptron is used to output the recommended candidate news.
8. An electronic device comprising: a memory for non-transitory storage of computer readable instructions; as well as a processor for executing the computer readable instructions, Wherein, when the computer-readable instructions are executed by the processor, the method described in any one of claims 1 to 6 is executed.
9. A storage medium non-transitorily storing 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 6 are executed.
Citation Information
Patent Citations
News recommendation method based on knowledge perception
CN111061856A
File recommendation method and device and server
CN111552835A
Content recommendation method based on domain knowledge graph
CN112559764A
News recommendation method and system based on user reading time behavior
CN113065062A
Recommendation algorithm fusing knowledge graph convolutional network and user preference
CN113934936A
