A conversation recommendation method and system based on graph neural network and knowledge graph

By using graph neural network and knowledge graph in the session recommendation system, the session graph is constructed and graph convolution operations are performed, combining time and popularity weights, the problem that existing systems are difficult to capture long-term preferences and current interests is solved, and more accurate Recommended effect.

CN115017275BActive Publication Date: 2025-02-11HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210167706.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-23
Publication Date
2025-02-11
Estimated Expiration
2042-02-23

AI Technical Summary

Technical Problem

The existing session recommendation system lacks consideration of dependencies between items and between sessions, and difficult to capture long-term preferences and current interests, resulting in low recommendation accuracy.

Method used

Using a session recommendation method based on graph neural network and knowledge graph, a dynamic global embedding vector of the session is obtained by constructing a session graph and using graph convolution neural network to perform graph convolution operations, combining time and popularity weights. At the same time, the graph attention network is used to aggregate the k-hop neighborhood of the item entity in the knowledge graph, obtain the local embedding vector, and finally combine the two to generate the final session mixed embedding vector for recommendation.

Benefits of technology

By comprehensively considering the popularity and time weight of items, the dynamic global relationship between session items is encoded to improve the accuracy of recommendations. Combining dynamic global embedding and static local embedding, more comprehensive and accurate recommendations are achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115017275B_ABST
    Figure CN115017275B_ABST
Patent Text Reader

Abstract

The present invention discloses a conversation recommendation method and system based on graph neural network and knowledge graph, the method comprising: modeling all conversation sets consisting of items as conversation graphs; processing the conversation graphs through graph convolutional networks and assigning time and popularity weights to obtain an embedding vector of each item node in the current conversation; using an attention mechanism to obtain an embedding representation S of the entire conversation g ; Use the graph attention network to aggregate the k-hop neighborhood of the item entity in the item knowledge graph and obtain the local embedding representation S of the last item in the current session l ; Combined dynamic global embedding S g and local embedding S l Generate the final session mixture embedding S emb , embed the mixed session into S emb The inner product calculation is performed with the embedding of each item, so that the softmax function obtains the final click probability of each item, and the one with the highest probability is used as the recommendation result. This method is simple and easy to implement, with high accuracy, and has broad application prospects in social networking, online shopping, news and other fields.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a recommendation system, and in particular to a conversation recommendation method and a conversation recommendation system based on a graph neural network and a knowledge graph. Background Art

[0002] Recommendation systems have developed into a basic tool for people to make quick and effective choices and decisions. They have penetrated into every aspect of our daily lives, including life, work, study, entertainment, social interaction, and business operations. The role of recommendation systems is particularly important in the digital economy and in an era of increasing information overload, because users usually need to choose what they need from a large and rapidly growing amount of content, products, and services (collectively referred to as items).

[0003] Session-based recommender system (SBRS) is emerging as a new paradigm of recommendation system. Session-based recommender system mines and learns user preferences from session data generated by users during transactions. Each session contains multiple "user-item interaction behaviors" that occur within a continuous period of time. For example, a user purchases a basket of goods in a transaction session (such as the period from logging into an e-commerce platform account to logging out of the account). Session-based recommender system (also referred to as session recommender system in this article) takes each session as the most basic input data unit, and can capture the user's short-term preferences from his most recent session, so as to make more accurate and real-time recommendations.

[0004] The current mainstream conversational recommendation system is based on a recursive neural network structure, and its main idea is to capture the short-term preference information displayed by users in the current session to complete the recommendation. However, as a special form of data in the recommendation field, it is often difficult to model conversational data through traditional recommendation methods. Although some scholars have solved the problem of conversational modeling by improving traditional recommendation methods, the effect of conversational recommendation systems is limited by many problems in the model structure. Existing conversational recommendation systems lack consideration of the dependencies between items and between sessions, and lack the capture of long-term preferences and current interests, resulting in low recommendation accuracy. Therefore, it is necessary to make substantial improvements to traditional conversation-based recommendation systems in many aspects to improve the accuracy of recommendations. Summary of the invention

[0005] Purpose of the invention: The purpose of the present invention is to provide a conversation recommendation method and recommendation system based on graph neural network and knowledge graph, which can make full use of item information by modeling the conversation graph, capture long-term preferences and current interests, and improve the accuracy of recommendations.

[0006] Technical solution: In order to achieve the above invention objectives, the present invention adopts the following technical solution:

[0007] According to a first aspect of the present invention, a conversation recommendation method based on a graph neural network and a knowledge graph is provided, comprising the following steps:

[0008] Step S1: Model all conversation sets S consisting of item sets V as conversation graph G s , traverse the session graph to obtain the adjacency matrix A and degree matrix D of the session graph, and set a randomly initialized feature matrix X for the set of item nodes in the session graph, perform a linear transformation on the feature matrix X, and obtain the transformed feature matrix H (0) ;

[0009] Step S2: H (0) , adjacency matrix A and degree matrix D are used as the input of the graph convolutional neural network. The graph convolutional neural network is used to perform graph convolution operations on the session graph, and time and popularity weights are assigned to obtain the embedding vector of each item node in the current session. The dynamic global embedding vector S of the session is obtained using the attention mechanism. g ;

[0010] Step S3: Use the graph attention network to aggregate the k-hop neighborhood of the item entity in the item knowledge graph and obtain the local embedding vector S of the last item in the current session. l ;

[0011] Step S4: Combine the dynamic global embedding vector S g and the local embedding vector S l , generate the final session mixed embedding vector S emb ;

[0012] Step S5: embed the session mixture vector S emb The inner product is calculated with the embedding of each item, and the softmax function is used to obtain the click probability of each item, that is, the probability that each candidate item will be interacted with in the next step. According to probability Get the final recommendation result.

[0013] According to a second aspect of the present invention, a conversation recommendation system based on a graph neural network and a knowledge graph is provided, comprising:

[0014] The session graph building module is used to model all the session sets S consisting of the item set V as a session graph G. s , traverse the session graph to obtain the adjacency matrix A and degree matrix D of the session graph, and set a randomly initialized feature matrix X for the set of item nodes in the session graph, perform a linear transformation on the feature matrix X, and obtain the transformed feature matrix H (0) ;

[0015] The graph convolution operation module is used to transform H (0) , adjacency matrix A and degree matrix D are used as the input of the graph convolutional neural network. The graph convolutional neural network is used to perform graph convolution operations on the session graph, and time and popularity weights are assigned to obtain the embedding vector of each item node in the current session. The dynamic global embedding vector S of the session is obtained using the attention mechanism. g ;

[0016] The knowledge graph aggregation module is used to aggregate the k-hop neighborhood of item entities in the item knowledge graph using the graph attention network to obtain the local embedding vector S of the last item in the current session. l ;

[0017] Embedding combination module, used to combine dynamic global embedding vector S g and the local embedding vector S l , generate the final session mixed embedding vector S emb ;

[0018] The recommendation probability output module is used to embed the session mixture vector S emb The inner product is calculated with the embedding of each item, and the softmax function is used to obtain the click probability of each item, that is, the probability that each candidate item will be interacted with in the next step. According to probability Get the final recommendation result.

[0019] According to a third aspect of the present invention, a computer device is provided, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the programs are executed by the processors, the steps of the conversation recommendation method based on graph neural network and knowledge graph as described in the first aspect of the present invention are implemented.

[0020] According to a fourth aspect of the present invention, there is provided a computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the conversation recommendation method based on graph neural network and knowledge graph as described in the first aspect of the present invention are implemented.

[0021] Beneficial effects: The present invention proposes a conversation recommendation method and system based on graph convolutional neural network and knowledge graph. The method comprehensively considers the popularity weight and time weight of the items to jointly obtain a global embedding representation of the conversation. This novel representation mechanism encodes the dynamic global relationship between conversation items, which helps to improve the accuracy of recommendations. At the same time, the present invention obtains the neighbor semantic knowledge of the kth hop by associating the item entity in the knowledge graph with the last conversation item, thereby realizing conversation-based recommendations using the most advanced knowledge graph attention network on external knowledge. The present invention combines dynamic global knowledge and static local knowledge, and learns them simultaneously in a unified model, which can achieve more comprehensive and accurate recommendations. In addition, the method of the present invention is simple and easy to implement, and has broad application prospects in the fields of social networking, online shopping, news, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a flowchart of a conversation recommendation method based on a graph convolutional neural network and a knowledge graph according to an embodiment of the present invention.

[0023] Figure 2 The figure is a schematic diagram of the processing process of a conversation recommendation system based on a graph convolutional neural network and a knowledge graph according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar concepts, objects, elements, etc. or concepts, objects, elements, etc. with the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0025] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the field to which the present invention belongs and related fields. It should also be understood that terms such as those defined in common dictionaries should be understood to have the same meaning as in the context of the prior art, and will not be interpreted with an idealized or overly formal meaning unless defined as herein.

[0026] The present invention provides a conversation recommendation method and recommendation system based on graph neural network and knowledge graph. Graph neural network is a branch of graph representation learning, which aims to represent the nodes in the graph with low-dimensional dense vectors while retaining the structural information formed between the nodes in the graph to facilitate subsequent tasks. Inspired by the great success of convolutional networks in the field of computer vision, many methods have recently emerged to redefine the concept of convolution for graph data. These methods belong to the category of graph convolutional network (GCN). Bruna et al. proposed the first graph convolutional neural network. They defined graph convolution in spectral space based on the convolution theorem based on spectral graph theory. This is also the origin of spectral methods in the field of graph convolution. Since spectral methods usually process the entire graph at the same time and are difficult to parallelize or expand to large graphs, space-based graph convolutional networks have begun to develop rapidly. These methods perform convolution directly on the graph structure by aggregating information from neighboring nodes. In an embodiment of the present invention, the graph neural network uses a graph convolutional network, also known as a graph convolutional neural network.

[0027] The knowledge graph contains rich semantic associations between entities, providing a potential source of auxiliary information for the recommendation system. In the field of recommendation systems, people often focus on the connection between users and items, but lack consideration of the connections between users and users, items and items, etc. Using knowledge graphs in recommendation systems to connect users with users, users with items, and items with items is expected to enhance the semantic information of the data, thereby further improving the accuracy of recommendations. In the following, we will describe in detail how to obtain local embedded representations in conversations through knowledge graphs in the recommendation system of graph neural networks, so as to achieve more comprehensive and accurate recommendations.

[0028] like Figure 1 As shown, the conversation recommendation method based on graph neural network and knowledge graph proposed in the embodiment of the present invention includes the following steps S1 to S5:

[0029] Step S1: Model all conversation sets S consisting of item sets V as conversation graph G s , based on the session graph G s Get the feature matrix H (0) ;

[0030] In the embodiments of the present invention, an item refers to an object recommended to a user, such as a movie, music, book, news, commodity, etc. The reference to music-related content in the examples described below does not mean that the technical solution of the present invention is limited to the recommendation of music data. The present invention does not limit this.

[0031] A session refers to one or more interactions between users and items that occur within a continuous period of time. For example, if user USER1 listens to the three songs "Listen to Mom", "Sunny Day", and "A Thousand Miles Away" in chronological order during a session (e.g., from logging into a music platform account to logging out of the account), then these three songs are arranged in chronological order to form a sequence, i.e., a session {"Listen to Mom", "Sunny Day", "A Thousand Miles Away"}.

[0032] A session set is a set of all sessions. For example, if user USER1 listened to the three songs "Listen to Mom", "Sunny Day", and "A Thousand Miles Away" in chronological order in one session, and user USER1 listened to the two songs "Rice Fragrance" and "Coral Sea" in chronological order in another session, then the session set consists of all these sessions: {{"Listen to Mom", "Sunny Day", "A Thousand Miles Away"}, {"Rice Fragrance", "Coral Sea"}}.

[0033] The session set is obtained based on the session data set. The session data set is formed by multiple users' multiple interactions with items, such as clicks, purchases, etc., and the session data set contains timestamps. The fields of the session data set include "user ID", "item ID", and "timestamp". For example, the data set is sorted from the earliest to the latest timestamp, and the data of each user ID within a consecutive week of timestamp is created as a session. The session is represented in the order of the "item ID" value. The set formed by all sessions of the entire data set is called a session set.

[0034] The item set is the set of items that have appeared in all sessions. The item set is a set of unique values ​​obtained by deduplicating all values ​​in the field "item ID" using code. There is no need for a strict order. For example, the music dataset Last.FM: This dataset can be obtained on the website https: / / grouplens.org / datasets / hetrec-2011 / and contains 3846 different music works. In this case, the item set is a set of 3846 music works.

[0035] In step S1, all conversation sets S consisting of item sets V are modeled as conversation graph G s , traverse the conversation graph G s Get the adjacency matrix A and degree matrix D of the conversation graph, then set a randomly initialized feature matrix X for the set of item nodes in the conversation graph, perform a linear transformation on the feature matrix X, and get the transformed feature matrix H (0) Specifically, step S1 includes:

[0036] Step S1-1: Let V = {v1 ,v 2 ,...v m ,...,v p} represents the total set of items contained in all sessions, where v m represents the mth item, p represents the total number of items; let S = {s1, s2, ...s i ...,s q} represents the total set of all sessions, where s i represents the i-th session, q represents the total number of sessions; a session s i It consists of multiple items, which are sorted by timestamp as a representation of a session: in Indicates that the user is in session s i In and items Interacted, 1≤j≤n, n represents the user in session s i There are n interactions in total.

[0037] Step S1-2: Model the session set S as a session graph G s =(V s ,E s ), where V s Represents the set of session graph nodes, E s Represents a set of edges in a session graph, where each node represents an item A session node is also called an item node. Each edge Indicates that the user is in a session i Zhongxian and items Interacted with the item An interaction occurred; taking the above song conversation set as an example, in {"Listen to mother's words", "Sunny day", "Thousands of miles away"}, there is an edge between "Listen to mother's words" and "Sunny day", there is an edge between "Sunny day" and "Thousands of miles away", there is no edge between "Listen to mother's words" and "Thousands of miles away", and there is no edge between these three and "Rice Fragrance" and "Coral Sea".

[0038] Step S1-3: traverse the session graph to obtain the adjacency matrix A and degree matrix D of the session graph;

[0039] The adjacency matrix is ​​a matrix that represents the adjacent relationship between vertices. It is a two-dimensional array, and each row and column represents a vertex in the graph. The value stored in the cell at the intersection of row v and column w indicates whether there is an edge from vertex v to vertex w. Session graph G s =(V s ,E s ) has |V s | vertices, the adjacency matrix A is defined as Degree matrix means that the degree matrix is ​​a diagonal matrix, and the elements on the diagonal are the degrees of each vertex. The degree of a vertex represents the number of edges associated with the vertex. The purpose of obtaining the adjacency matrix and degree matrix is ​​to convert the graph into a mathematical form that can be processed by the computer.

[0040] Step S1-4: Set a randomly initialized feature matrix X for the set of item nodes in the conversation graph, also called the feature vector of the node

[0041] Step S1-5: Perform a linear transformation on the randomly initialized feature vector X to obtain the transformed feature matrix, denoted as H (0) , H (0) =WX+b, where W represents the parameter matrix and b represents the bias vector.

[0042] Step S2: Use the graph convolution layer to build a graph convolutional neural network and transform H (0) , adjacency matrix A and degree matrix D are used as the input of the graph convolutional neural network. The graph convolutional neural network is used to perform graph convolution operations on the session graph, and time and popularity weights are assigned to obtain the embedded representation of each item node in the current session. The attention mechanism is used to obtain the embedded representation S of the entire session. g ;

[0043] Embedding, also known as embedding vector expression, refers to the use of a vector to represent an object, which can be a word, a sentence, a sequence, a product, an action, a book, a movie, etc. As used in this article, the terms embedding representation, embedding vector, embedding representation vector, embedding or vector are used interchangeably. For example, global embedding representation and global embedding can also be replaced by global embedding vector or global vector, and local embedding representation and local embedding can also be replaced by local embedding vector or local vector.

[0044] The step S2 further comprises:

[0045] Step S2-1: H obtained in the previous step (0) , adjacency matrix A and degree matrix D are used as inputs of graph convolutional neural network (GCN) through formula Conduct dissemination learning, including Where I is the identity matrix, W (l) H represents the weight matrix of the lth layer, and σ represents the nonlinear activation function. (l+1) Represents the item node vector (i.e. H (0) ) propagates the result of layer l+1 in the graph convolutional neural network, H (l+1) It also means the final feature matrix obtained after learning The initialization embedding representation vector of the jth item node in the i-th session is defined as:

[0046] Step S2-2: Calculate the popularity weight of the item node based on the frequency of occurrence of each node in the conversation graph

[0047]

[0048] in, Represents a single item node v j The item popularity weight, Represents the total number of times the item node appears in all sessions.

[0049] Step S2-3: Calculate the time weight of the item node based on the timestamp of each node in the session graph

[0050]

[0051] in, Represents a single item node v j The time weight, Represents the timestamp of the item node in the current session.

[0052] Step S2-4: Multiply the obtained popularity weight and time weight of the session node by the initialized node embedding representation to obtain the embedding representation of the item node with the total weight:

[0053]

[0054] in, Represents the embedding representation of the item node assigned a total weight value.

[0055] Step S2-5: Use the attention mechanism to obtain the entire session s i The embedding representation S g :

[0056]

[0057]

[0058] Among them, W1, W2, and c are parameters that control the item embedding vector, both of which are trainable parameters. iRepresents the weight value calculated in the attention mechanism. The attention mechanism was first proposed in the field of visual images to focus on the important parts of the image. Its essence is a set of weight coefficients learned autonomously by the network, and a mechanism that emphasizes the area of ​​interest while suppressing irrelevant background areas in a "dynamically weighted" manner. It is used in the present invention to focus on the different importance of different items in the conversation. i Represents the weight value calculated in the attention mechanism, that is, the importance value of different items in the attention mechanism.

[0059] Step S3: Use the graph attention network to aggregate the k-hop neighborhood of the item entity in the item knowledge graph, thereby obtaining the local embedding representation S of the last item in the current session. l ;

[0060] The knowledge graph is defined as where ε is the entity set, It is a relationship set. The triple in the knowledge graph is represented by (h, r, t), where h and t represent the head entity and the tail entity respectively, and r represents the relationship between the head entity and the tail entity. In the item knowledge graph, h represents the item, t represents the item different from h, and can also represent the attribute information of the item. This attribute information is determined when the knowledge graph is constructed, or it is built into the open source knowledge graph when using an open source knowledge graph. The entity pointed to by the relationship arrow in the knowledge graph is the tail entity, and the other side of the arrow is the head entity. The specific relationship of r is given in the knowledge graph, and these various relationships are collectively referred to as relationship r. The method for constructing a knowledge graph is not the core of the present invention and will not be repeated here. The knowledge graph in the embodiment of the present invention is obtained from an open source data set. For example, the item knowledge graph of the music data set can be obtained on the website https: / / github.com / xiangwang1223 / knowledge_graph_attention_network / tree / master / Data / Last.FM. The knowledge graph data set contains 9366 entities, 60 relations, 15518 triples, and a sparsity of 3.704%.

[0061] Step S3 further comprises:

[0062] Step S3-1: Use the TransR model to represent the head entity h and tail entity t in the item knowledge graph, as well as the relationship r between them, as initial embedding vectors: The embedding of the head entity is represented as e h , the embedding of the tail entity is represented as e t , the embedding of the relation is represented as e r The header entity h in the entire S3 step refers to the entity in the current session s i The last item

[0063] Step S3-2: The first step of the multi-layer attention embedding propagation operation: Based on the knowledge-based attention mechanism, the weight π(h, r, t) in the information propagation is obtained:

[0064] π(h,r,t)=(W r e r ) T tanh((W r e h +e r ))

[0065] Among them, W r is a parameter matrix, and tanh represents a nonlinear activation function.

[0066] Step S3-3: Perform the second step of the multi-layer attention embedding propagation operation: message propagation to obtain a further embedding representation of the head entity h

[0067]

[0068] Wherein, π(h,r,t) represents the weight of the neighbor entity, obtained by step S3-2. h Indicates the neighbors of the head entity.

[0069] Step S3-4: The third step of the multi-layer attention embedding propagation operation: information aggregation, obtain the embedding representation e of the head entity h after aggregating neighbor information h (k) .

[0070] The step S3-4 further comprises:

[0071] The number of layers of embedded information aggregation (k) is used as the loop variable of the control loop, its initial value is 1, its termination value is k, the incremental step is 1, and the following steps are repeated k times:

[0072] Step S3-4-1: Refer to the paper KGAT, "Xiang Wang, Xiangnan He, Yixin Cao, Meng Liu, and Tat-Seng Chua. 2019. KGAT: Knowledge Graph Attention Network for Recommendation. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD 2019, Anchorage, AK, USA, August 4-8, 2019, Ankur Teredesai, Vipin Kumar, Ying Li, Rómer Rosales, Emilia Terzi, and George Karypis (Eds.). ACM, 950–958. https: / / doi.org / 10.1145 / 3292500.3330989", select the bidirectional interaction aggregator in the aggregator function, and proceed to the next step, denoted as f:

[0073]

[0074] Among them, W f1 , W f2 Represents the weight matrix. LeakyReLU is the activation function, which introduces a small slope to keep the update process active and able to retain a certain degree of negative values ​​flowing into it.

[0075] Step S3-4-2: Representation of neighbors of the head entity at layer k-1 It is through the formula Calculated, e t (k-1) It indicates that the tail entity t stores the neighbor information from the k-1th layer.

[0076] Step S3-4-3: Calculate the embedding of entities in multi-layer information propagation, through Calculated.

[0077] Step S3-5: After the connection operation, get the last item of the current session The embedding representation of Also called the local representation of the session S l :

[0078]

[0079] Here, || represents a connection operation. At this time, the last item of the current session is obtained. The embedding representation of Also called the local representation of the session S l .

[0080] Step S4: Combine the dynamic global embedding S of the session g and the local embedding S of the last session item l Generate the final session mixture embedding S emb :

[0081] S emb =W3[S l ; S g ]

[0082] Among them, W3 is the parameter matrix.

[0083] Step S5: Embed the hybrid session into S emb The inner product is calculated with the embedding of each item, so that the softmax function can obtain the final click probability of each item, that is, the probability that each candidate item will be interacted with in the next step. The one with the highest probability is recommended.

[0084] The step S5 further comprises:

[0085] Step S5-1: After obtaining the mixed embedding S of the current session emb After that, we need to calculate the score of each candidate item.

[0086]

[0087] in is the embedding representation of the item obtained in step S2-4.

[0088] Step S5-2: Use a softmax function to get the output vector of the model That is, the candidate item appears in the current session s i The probability of the next interaction in .

[0089]

[0090] in, Indicates that the candidate item appears in the current session s i The probability of the next interaction in .

[0091] In the implementation manner of the present invention, the pseudo code implementation process of the conversation recommendation method based on graph neural network and knowledge graph is expressed as follows:

[0092]

[0093]

[0094] In the pseudo-code description, the statements in bold have conventional meanings known in the field of computer science and related fields. The variables or symbols in the pseudo-code description and their meanings are shown in Table 1.

[0095] Table 1 Variables or symbols in pseudocode and their meanings

[0096]

[0097]

[0098] The embodiment of the present invention also provides a conversation recommendation system based on graph neural network and knowledge graph, including: conversation graph construction module, graph convolution operation module, knowledge graph aggregation module, embedding combination module, recommendation probability output module, these modules correspond to steps S1 to S5 in the above method embodiment in sequence. Figure 2 To vividly explain the implementation of each module of the recommendation system and the coordination relationship between them. Figure 2 As shown in the figure, the conversation graph construction module models all conversation sets S consisting of item sets V as conversation graphs G s , and according to the session graph G s Get the feature matrix, i.e., the item node vector. Specifically, the session graph building module consists of an item set V{v 1 ,v 2 ,...v i ,...,v p The set of all sessions S = {s1,s2,...s i ...,s q} is modeled as a conversation graph G s , where p represents the total number of items and q represents the total number of sessions in the session graph. These items are sorted by timestamp as a representation of a session: in Indicates that the user is in session s i In and items The conversation graph is traversed to obtain the adjacency matrix A and degree matrix D of the conversation graph, and then a randomly initialized feature matrix X is set for the set of item nodes in the conversation graph. A linear transformation is performed on the feature matrix X to obtain the transformed feature matrix, which is recorded as H. (0) :H (0) =WX+b, where W represents the parameter matrix and b represents the bias vector. (0) , adjacency matrix A and degree matrix D are used as input of the graph convolutional neural network (GCN).

[0099] Next, the graph convolution operation module uses the graph convolution neural network to perform graph convolution operations on the session graph, assigns time and popularity weights to obtain the embedding vector of each item node in the current session, and uses the attention mechanism to obtain the embedding representation S of the entire session. g Specifically, the graph convolution operation module includes:

[0100] The GCN learning unit converts the H obtained in the previous step (0) , adjacency matrix A and degree matrix D are used as inputs of graph convolutional neural network (GCN) through formula Conduct dissemination learning, including Where I is the identity matrix, W (l) H represents the weight matrix of the lth layer, and σ represents the nonlinear activation function. (l+1) H represents the result of propagating the item node vector in the l+1th layer of the graph convolutional neural network. (l+1) It also means the final feature matrix obtained after learning The initialization embedding representation vector of the jth item node in the i-th session is defined as:

[0101] The node weight calculation unit includes a popularity weight calculation unit and a time weight calculation unit. The popularity weight calculation unit uses the frequency of occurrence of each node in the session graph to calculate the popularity weight of the session node. in, Represents a single session node v j The item popularity weight, Indicates the total number of times the item node appears in all sessions. The time weight calculation unit uses the timestamp of each node in the session graph to calculate the time weight of the session node. in, Represents a single session node v j The item popularity weight, Represents the timestamp of the item node in the current session.

[0102] The session embedding representation unit multiplies the popularity weight and time weight of the session node by the updated node embedding representation in, represents the initialization embedding representation vector of a node, Represents the embedding representation of the session node that is assigned a total weight value; finally, the attention mechanism is used to obtain the embedding representation S of the entire session g .

[0103] The knowledge graph aggregation module uses the graph attention network to aggregate the k-hop neighborhood of the item entity in the item knowledge graph, thereby obtaining the local embedding representation S of the last item in the current session.l Specifically, the knowledge graph aggregation module includes:

[0104] Initialize the vector representation unit and use the TransR model to represent the head entity h and the tail entity t in the item knowledge graph and the relationship r between them as the initial embedding vector: the embedding of the head entity is represented by e h , the embedding of the tail entity is represented as e t , the embedding of the relation is represented as e r , where entity h refers to s in the current session i The last item

[0105] The multi-layer attention embedding propagation unit performs multi-layer attention embedding propagation operations, including the first step: the knowledge-based attention mechanism to obtain the weight π(h, r, t) in information propagation; the second step: message propagation to obtain a further embedding representation of the head entity h Step 3: Information aggregation, get the embedding representation e of the head entity h after aggregating neighbor information h (k) ;

[0106] The local embedding representation unit is connected to get the last item of the current session. The embedding representation of Also called the local representation of the session S l .

[0107] Embedding composition module, through the dynamic global embedding S of the composition session g and the local embedding S of the last session item l Generate the final session mixture embedding S emb .

[0108] The recommendation probability output module embeds the mixed session into S emb The inner product is calculated with the embedding of each item, so that the softmax function can obtain the final click probability of each item, that is, the probability that each candidate item will be interacted with in the next step. The one with the highest probability is recommended.

[0109] The present invention makes substantial improvements in many aspects to the traditional session-based recommendation system, so that the last click generates a mixed feature of current interest and general interest, and then combines the knowledge graph to enhance the local representation of the last item in the session, so that the dynamic global embedding and the static local embedding can be combined and learned simultaneously in a unified model. In order to verify the performance of the method, the Last.FM dataset is selected in the embodiment for comparative experiments. The Last.FM dataset can be obtained on the website https: / / grouplens.org / datasets / hetrec-2011 / , and contains 3846 items. The knowledge graph dataset involved in the dataset can be obtained on the website https: / / github.com / xiangwang1223 / knowledge_graph_attention_network / tree / master / Data / Last.FM, and the knowledge graph dataset contains 9366 entities, 60 relationships, 15518 triples, and a sparsity of 3.704%. It is randomly divided into a training set and a test set according to a ratio of 70% and 30% for experiments. It is compared with four baseline methods: SR-GNN, NARM, FPMC, and RippleNet. The comparison results are shown in Table 2.

[0110] Table 2 Comparison of several methods

[0111] Method Name Recall@20 MRR@20 SR-GNN 12.007 2.844 NARM 11.990 3.370 FPMC 7.437 0.801 RIPPLENET 7.910 1.903 Method of the present invention 14.490 3.899

[0112] The experimental results show that the performance (i.e., Recall and MRR values) of the proposed method are significantly higher than those of the other four baseline methods, which proves the effectiveness of the proposed method and the accuracy of the recommendations.

[0113] An embodiment of the present invention also provides a computer device, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the programs are executed by the processors, the steps of the conversation recommendation method based on graph neural network and knowledge graph as described in the method embodiment are implemented.

[0114] An embodiment of the present invention provides a computer storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the conversation recommendation method based on a graph neural network and a knowledge graph as described in the method embodiment are implemented.

[0115] In summary, it can be understood from the above technical solutions and specific implementation methods of the present invention that the beneficial technical effects of the present invention mainly include four aspects: (1) A conversation recommendation method based on graph convolutional neural network and knowledge graph is proposed, which comprehensively considers the time weight of items and jointly obtains the global embedding of the conversation. This novel item representation mechanism encodes the dynamic global relationship between conversation items, which helps to improve the accuracy of recommendations; (2) By associating the item entity in the knowledge graph with the last conversation item to obtain the k-th hop neighbor semantic knowledge, the use of the most advanced knowledge graph attention network on external knowledge is explored for conversation-based recommendation; (3) Dynamic global knowledge and static local knowledge are combined and learned simultaneously in a unified model to achieve more comprehensive and accurate recommendations; (4) The provided method has broad application prospects in fields such as big data analysis.

[0116] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0117] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0118] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0119] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0120] 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, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A conversation recommendation method based on graph neural network and knowledge graph, characterized in that: The method comprises the following steps: Step S1: Model all conversation sets S consisting of item sets V as conversation graph G s , traverse the session graph to obtain the adjacency matrix A and degree matrix D of the session graph, and set a randomly initialized feature matrix X for the set of item nodes in the session graph, perform a linear transformation on the feature matrix X, and obtain the transformed feature matrix H (0) ; Step S2: H (0) , adjacency matrix A and degree matrix D are used as the input of the graph convolutional neural network. The graph convolutional neural network is used to perform graph convolution operations on the session graph, and time and popularity weights are assigned to obtain the embedding vector of each item node in the current session. The dynamic global embedding vector S of the session is obtained using the attention mechanism. g ; Step S3: Use the graph attention network to aggregate the k-hop neighborhood of the item entity in the item knowledge graph and obtain the local embedding vector S of the last item in the current session. l ; Step S4: Combine the dynamic global embedding vector S g and the local embedding vector S l , generate the final session mixed embedding vector S emb ; Step S5: embed the session mixture vector S emb The inner product is calculated with the embedding of each item, and the softmax function is used to obtain the click probability of each item, that is, the probability that each candidate item will be interacted with in the next step. According to probability Get the final recommendation result; Wherein, the step S1 comprises: Step S1-1: Let V = {v 1 ,v 2 ,...v m ,...,v p } represents the total set of items contained in all sessions, where v m represents the mth item, p represents the total number of items; let S = {s1, s2, ...s i ...,s q } represents the total set of all sessions in the session graph, where s i represents a session, q represents the total number of sessions included in the session graph; a session s i It consists of multiple items, which are sorted by timestamp as a representation of a session: in Indicates that the user is in session s i The jth interaction with an item in session s, 1≤j≤n, n represents the number of times the user interacted with an item in session s i There are n interactions in total; Step S1-2: Model the session set S as a session graph G s =(V s ,E s ), where V s Represents the set of session graph nodes, E s Represents a collection of edges in the session graph, where each node represents an item Each edge Indicates that the user is in a session i Zhongxian and items Interacted with the item An interaction occurred; Step S1-3: traverse the session graph to obtain the adjacency matrix A and degree matrix D of the session graph; Step S1-4: Set a randomly initialized feature matrix X for the set of item nodes in the conversation graph, also called the feature vector of the node Step S1-5: Perform a linear transformation on the randomly initialized feature vector X to obtain the transformed feature matrix, denoted as H (0) , H (0) =WX+b, where W represents the parameter matrix and b represents the bias vector; The step S2 comprises: Step S2-1: H (0) , adjacency matrix A and degree matrix D are used as inputs of graph convolutional neural network, through formula Conduct dissemination learning, including Where I is the identity matrix, W (l) represents the weight matrix of the lth layer, σ represents the nonlinear activation function; H (l+1) H represents the result of propagating the item node vector in the l+1th layer of the graph convolutional neural network. (l+1) It also represents the final feature matrix obtained after learning The initialization embedding representation vector of the jth item node in the i-th session is defined as: Step S2-2: Calculate the popularity weight of the item node using the frequency of occurrence of each node in the conversation graph Step S2-3: Use the timestamp of each node in the session graph to calculate the time weight of the item node Step S2-4: Obtain the popularity weight of the item node and time weight Multiply by the initial node embedding representation Get the embedding representation of the item node with the total weight assigned Step S2-5: Use the attention mechanism to obtain the embedding representation S of the entire session g ; The step S3 comprises: Step S3-1: Use the TransR model to represent the head entity h and tail entity t in the item knowledge graph, as well as the relationship r between them, as initial embedding vectors: The embedding of the head entity is represented as e h , the embedding of the tail entity is represented as e t , the embedding of the relation is represented as e r , where the header entity h is the current session s i The last item in Step S3-2: The first step of performing the multi-layer attention embedding propagation operation: based on the knowledge-based attention mechanism, the weight π(h, r, t) in the information propagation is obtained; Step S3-3: Perform the second step of the multi-layer attention embedding propagation operation: message propagation to obtain a further embedding representation of the head entity h Step S3-4: The third step of the multi-layer attention embedding propagation operation: information aggregation, obtain the embedding representation e of the head entity h after aggregating neighbor information h (k) ; Step S3-5: After the connection operation, get the last item of the current session The embedding representation of Also called the local representation of the session S l ; The step S5 comprises: Step S5-1: After obtaining the mixed embedding S of the current session emb Then, calculate the score of each candidate item in Is the current session S i The embedding representation of the j-th item node in; Step S5-2: Use a softmax function to get the output vector of the model That is, the candidate item appears in the current session s i The probability of the next interaction in .

2. The conversation recommendation method based on graph neural network and knowledge graph according to claim 1, characterized in that: The calculation formula in step S2-2 is as follows: in, Represents a single item node v j The item popularity weight, Represents the total number of times the item node appears in all sessions.

3. The conversation recommendation method based on graph neural network and knowledge graph according to claim 1, characterized in that: The calculation formula in step S2-3 is as follows: Among them, W t j Represents a single item node v j The time weight, Represents the timestamp of the item node in the current session.

4. A conversation recommendation system based on graph neural network and knowledge graph, characterized in that: include: Session graph building module: used to model all session sets S consisting of item sets V as session graphs G s , traverse the session graph to obtain the adjacency matrix A and degree matrix D of the session graph, and set a randomly initialized feature matrix X for the set of item nodes in the session graph, perform a linear transformation on the feature matrix X, and obtain the transformed feature matrix H (0) ; Graph convolution operation module: used to convert H (0) , adjacency matrix A and degree matrix D are used as the input of the graph convolutional neural network. The graph convolutional neural network is used to perform graph convolution operations on the session graph, and time and popularity weights are assigned to obtain the embedding vector of each item node in the current session. The dynamic global embedding vector S of the session is obtained using the attention mechanism. g ; Knowledge graph aggregation module: used to aggregate the k-hop neighborhood of item entities in the item knowledge graph using the graph attention network to obtain the local embedding vector S of the last item in the current session l ; Embedding combination module: used to combine dynamic global embedding vector S g and the local embedding vector S l , generate the final session mixed embedding vector S emb ; Recommendation probability output module: used to embed the session mixture vector S emb The inner product is calculated with the embedding of each item, and the softmax function is used to obtain the click probability of each item, that is, the probability that each candidate item will be interacted with in the next step. According to probability Get the final recommendation result; The specific processing steps of the session graph construction module include: Step S1-1: Let V = {v 1 ,v 2 ,...v m ,...,v p } represents the total set of items contained in all sessions, where v m represents the mth item, p represents the total number of items; let S = {s1, s2, ...s i ...,s q } represents the total set of all sessions in the session graph, where s i represents a session, q represents the total number of sessions included in the session graph; a session s i It consists of multiple items, which are sorted by timestamp as a representation of a session: in Indicates that the user is in session s i The jth interaction with an item in session s, 1≤j≤n, n represents the number of times the user interacted with an item in session s i There are n interactions in total; Step S1-2: Model the session set s as a session graph G s =(V s ,E s ), where V s Represents the set of session graph nodes, E s Represents a collection of edges in the session graph, where each node represents an item Each edge Indicates that the user is in a session i Zhongxian and items Interacted with the item An interaction occurred; Step S1-3: traverse the session graph to obtain the adjacency matrix A and degree matrix D of the session graph; Step S1-4: Set a randomly initialized feature matrix X for the set of item nodes in the conversation graph, also called the feature vector of the node Step S1-5: Perform a linear transformation on the randomly initialized feature vector X to obtain the transformed feature matrix, denoted as H (0) , H (0) =WX+b, where W represents the parameter matrix and b represents the bias vector; The specific processing steps of the graph convolution operation module include: Step S2-1: H (0) , adjacency matrix A and degree matrix D are used as inputs of graph convolutional neural network, through formula Conduct dissemination learning, including Where I is the identity matrix, W (l) represents the weight matrix of the lth layer, σ represents the nonlinear activation function; H (l+1) H represents the result of propagating the item node vector in the l+1th layer of the graph convolutional neural network. (l+1) It also means the final feature matrix obtained after learning The initialization embedding representation vector of the jth item node in the i-th session is defined as: Step S2-2: Calculate the popularity weight of the item node using the frequency of occurrence of each node in the conversation graph Step S2-3: Use the timestamp of each node in the session graph to calculate the time weight of the item node Step S2-4: Obtain the popularity weight of the item node and time weight Multiply by the initial node embedding representation Get the embedding representation of the item node with the total weight assigned Step S2-5: Use the attention mechanism to obtain the embedding representation S of the entire session g ; The specific processing steps of the knowledge graph aggregation module include: Step S3-1: Use the TransR model to represent the head entity h and tail entity t in the item knowledge graph, as well as the relationship r between them, as initial embedding vectors: The embedding of the head entity is represented as e h , the embedding of the tail entity is represented as e t , the embedding of the relation is represented as e r , where the header entity h is the current session s i The last item in Step S3-2: The first step of performing the multi-layer attention embedding propagation operation: based on the knowledge-based attention mechanism, the weight π(h, r, t) in the information propagation is obtained; Step S3-3: Perform the second step of the multi-layer attention embedding propagation operation: message propagation to obtain a further embedding representation of the head entity h Step S3-4: The third step of the multi-layer attention embedding propagation operation: information aggregation, obtain the embedding representation e of the head entity h after aggregating neighbor information h (k) ; Step S3-5: After the connection operation, get the last item of the current session The embedding representation of Also called the local representation of the session S l ; The specific processing steps of the recommendation probability output module include: Step S5-1: After obtaining the mixed embedding S of the current session emb Then, calculate the score of each candidate item in Is the current session S i The embedding representation of the j-th item node in; Step S5-2: Use a softmax function to get the output vector of the model That is, the candidate item appears in the current session s i The probability of the next interaction in .

5. A computer device, characterized in that: include: one or more processors; Memory; as well as One or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and when the programs are executed by the processors, the steps of the conversation recommendation method based on graph neural network and knowledge graph as described in any one of claims 1-3 are implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the conversation recommendation method based on graph neural network and knowledge graph are implemented as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Hybrid recommendation algorithm based on local and global representation model joint learning

    CN112733027A

  • Recommendation method for aggregating knowledge graph neural network and adaptive attention

    CN112989064A