Conversation recommendation method, system and device based on gated pulse neural P system
By introducing a gated pulsed neural P system in a conversation recommendation system, combining a gated graph neural network, soft attention mechanism, self-attention network and EBGSNP model, it solves the problem of existing technology to capture the rapid changes in user interests and complex conversation history. The problem is to achieve more refined and real-time processing of session recommendations.
Patent Information
- Application Number
- CN202410467838.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-18
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-04-18
AI Technical Summary
Existing conversation recommendation techniques are difficult to effectively capture the rapid changes in user interests and complex conversation history, and have limitations in dealing with the relationship between long-term interests and short-term interests, which cannot completely solve the drift problem in conversation recommendations.
Using a method based on the gated pulse neural P system, discrete session data is converted into continuous vector representation through the gated graph neural network and soft attention mechanism. Combining the self-attention network and feedforward network, the overall interests of users are balanced and Relationships between current interests and dynamically update the changes in long-term interests through the EBGSNP model.
It realizes a more efficient understanding of the context information of session recommendations, balances global preferences and current interests, dynamically updates long-term interests, alleviates drift problems in session recommendations, and can adjust recommendation results in real time.
Smart Images

Figure CN118520100B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of conversation recommendation, and in particular to a conversation recommendation method, system and device based on a gated pulse neural P system. Background Art
[0002] As an effective information filtering tool, recommendation systems are widely used in e-commerce, music and video streaming, social media, and financial services. They aim to provide users with personalized suggestions, recommended items, or content based on their interests and historical behaviors. They mainly analyze users' historical behaviors and interests based on user behavior data, item data, social connections, and contextual information.
[0003] The field of recommender systems is an evolving and developing field, and conversational recommendations are gradually emerging as technology continues to advance. Conversational recommendations provide personalized suggestions based on the user's online conversations or chats. This recommendation is commonly used in various online communication platforms, including social media, chat applications, email clients, forums, etc.
[0004] Early conversational recommendations mainly relied on manually written rules to make recommendations based on the user's historical behavior and specific rules. These rules may include time-based recommendations and popular content recommendations. These conversational recommendations include recommendation methods based on the co-occurrence relationship of items and methods based on Markov chains. User-based collaborative filtering methods make recommendations by finding similarities between users, while item-based collaborative filtering finds the correlation between items for recommendation. Such methods include FPMC and collaborative filtering recommendation systems based on Bayesian probability models. Breakthroughs at this stage make recommendation systems more personalized. With the development of deep learning technology, neural networks have begun to be applied to recommendation systems. As a result, methods such as convolutional neural networks (CNNs), recurrent neural networks (RNNs), and attention mechanisms have gradually been applied to conversational recommendations. These methods model the relationship between users and items through neural networks, introducing multi-layer network structures and activation functions. Therefore, they can capture complex data relationships and thus improve the accuracy of recommendations.
[0005] In recent years, graph neural networks have been used in conversational recommendation systems. Graph neural networks are used to process user behavior sequences in conversational data and model user conversational data as a graph structure. In the graph, nodes represent different conversations or topics, and edges represent different relationships or connections, which are used to capture the complex relationship between users and conversations. Time factors are also taken into account, and conversations and topics are arranged in chronological order to better capture the changes in user behavior and interests over time. The advantage of the SRGNN model is that it can effectively handle the dynamic changes of conversational data and user interests, while also considering the complex relationship between users and conversations.
[0006] The Chinese patent "CN116737907A A personalized conversation recommendation method for extracting long-term and short-term interests" applies the deep convolution model to conversation recommendation. First, the conversation sequence corresponding to the user is extracted, and then the processed conversation sequence is input into the deep convolution model to extract the corresponding features, thereby obtaining a fused feature vector. Finally, items are recommended to the user based on the obtained feature vector. This method can overcome the limitations of traditional recommendation algorithms in the face of changes in user interests to a certain extent.
[0007] Among them, the use of graph neural networks to implement conversational recommendations cannot fully express the sequential information of the conversation. If the user's interests change very quickly, the model may not be able to adapt to this change quickly. In addition, graph neural networks still have great limitations in dealing with the relationship between long-term interests and short-term interests. The model has not yet effectively solved the drift problem in conversational recommendations (users' short-term behavior does not necessarily represent their real interests).
[0008] The deep convolutional models used are usually used to capture local features. In conversational recommendations, contextual information may need to span multiple conversations or topics. That is, the model may not be able to effectively capture long-term contextual information and the evolution of user interests, especially for complex conversation histories. And the convolutional model usually cannot capture the rapid changes in user interests, especially in applications that need to consider real-time events or news. User interests may change in a short period of time, and the deep convolutional model may need to be retrained periodically to adapt to user dynamic changes, which will increase the computational complexity of the model. Summary of the invention
[0009] The present invention provides a conversation recommendation method, system and device based on a gated pulse neural P system, which are used to more effectively understand the context information of conversation recommendation, balance the relationship between global preference and current interest, and dynamically update the changes in long-term interests, thereby alleviating the drift problem of conversation recommendation.
[0010] In order to achieve the above object, the technical solution of the present invention is as follows: In a first aspect, a conversation recommendation method based on a gated pulse neural P system is provided, comprising the following steps:
[0011] S1: Describe item embedding, gated graph neural network and soft attention mechanism, transform discrete session data into continuous vector representation, process the graph structure in the session data, obtain the latent matrix and local embedding of the session data, and then integrate the user's interests and context information into the recommendation process to obtain the global embedding of the session;
[0012] S2: Input the global embedding matrix into the self-attention network and the feedforward network respectively to obtain the long-term dependency features, and input the global embedding and local embedding into the EBGSNP model together to balance the relationship between the user's overall interest and current interest;
[0013] S3: The output of the self-attention network, feedforward network, EBGSNP model and local embedding are fused, and a hybrid embedding is obtained through linear transformation. The score of each candidate item is calculated through the hybrid embedding and the recommendation probability of the next item is obtained.
[0014] S4: Build a GAN-GSNP model based on deep learning technology, obtain user session sequences, and output prediction scores and the recommendation probability of the next item.
[0015] Furthermore, S1 includes:
[0016] S1-1: V = {v 1 ,v 2 ,...,v m} is defined as the set of unique items designed in all sessions, and s = [v s1 ,v s2 ,...,v sn ] is defined as an anonymous session sequence, where v si ∈V,v si v s1 ,v s2 ,...,v sn The i-th session of , represents the item clicked by the user in session s;
[0017] Define the global embedding of the output of the soft attention mechanism as s g , the local embedding in the latent matrix is s l ; Model each session sequence s as a corresponding directed graph G s =(V s ,E s ), where V si ∈V s , V s is the vertex set, E s is a set of edges, each edge <V si-1 ,V si >∈E s For the user who clicked V in session s si-1 After the project, click Project V si ;
[0018] The items in the directed graph corresponding to each session are embedded into a unified embedding space, and the node vector represents the latent vector of item v learned by graph neural network, where represents the session of the i-th item at time t, d is the dimension, R d is a d-dimensional space vector;
[0019] S1-2: Concatenate the outputs of the item embeddings to form the concatenated matrix A si ∈R 1×2n , where A si It is an out-degree directed graph. and in-degree directed graph Get a two-dimensional matrix, R 1×2n is a 1×2n space vector; it is used to control the update and transmission of information, and finally obtain the potential vector of item v The relevant formula is as follows:
[0020]
[0021]
[0022]
[0023]
[0024]
[0025] in: is the matrix A si The result of weighted connection, T represents transposition, b is the one-dimensional bias, H∈R d×2d Represents a weight matrix of size d×2d; and are the update gate and reset gate at time t, respectively, which determine the information to be retained and discarded, W z , W r , U z , U r are modifiable training parameters; is a list of node vectors, tanh(.) is a nonlinear activation function, represents the session of the i-th item at time t-1, ρ(.) is the sigmoid function; W 0 , U 0 is a modifiable training parameter, ⊙ is an element-wise multiplication operator, represents the internal neuron state at time t;
[0026] S1-3: Utilize the latent vector to get the global embedding s for each session through the soft attention mechanism g and local embeddings l , according to the definition of local embedding, the last click v in the session sn Defined as local embedding, s l =vsn , the session directed graph G is obtained by weighted information aggregation of latent vectors s The global embedding of is defined as follows:
[0027] β i =q T ρ(W β1 v sn +W β2 v si +c)
[0028]
[0029] Where: q∈R d and W β1 , W β2 ∈R d×d is the weight of the item embedding vector, W β1 , W β2 is a two-dimensional matrix of size d×d, q is a one-dimensional matrix of size d, ρ(.) is the sigmoid function; v si represents the session of the i-th item, v sn represents the session of the nth item, also the last clicked item, c is the bias parameter; the global embedding s g By the soft attention score β i The weighted sum of and the i-th project session is obtained.
[0030] Further, S2 includes:
[0031] S2-1: The global embedding is input into both networks to obtain different long-term interest features, which are defined as follows:
[0032]
[0033]
[0034]
[0035] F=Relu(HeadW f1 +b f1 )
[0036] F j =SAN(F j-1 )
[0037] in: is the global embedding s g The matrix obtained by linear projection, softmax(.) is the activation function, The transposed matrix is activated with softmax and then multiplied by To get the attention score attention is a scaling factor to avoid excessive inner product values, T represents transposition; head i Indicates the calculation of the i-th attention score. Similarly, head j It represents the jth attention score calculation, and Head represents multiple attention score calculations. i Start to head j End, splice to form multi-head attention, where the formula Concat represents splicing; Relu(.) is the activation function, F is the global embedded feature obtained by the Relu(.) activation function, and W f1 ,b f1 are the weight matrix of size d×d and the bias vector of dimension d, respectively. j represents the number of layers of the self-attention network. SAN is the self-attention network. j represents the global embedding feature obtained by the j-th layer self-attention network;
[0038] The final self-attention output is defined as F att , that is, F att =F j ;
[0039] F relu =Relu(s g W f2 +b f2 )
[0040] Where W f2 ,b f2 are the weight matrix and d-dimensional bias vector of size d×d, respectively, relu The result of feature re-extraction using the Relu(.) activation function for global embedding;
[0041] S mix =Concat(F att ,F relu )
[0042] Where S mix is the mixed long-term interest feature, F att It is a multi-head self-attention network feature;
[0043] S2-2: The output gate o is introduced to control the neuron output and the reset gate r is used to modify the pulse generation formula and the state of the hidden layer at the previous moment. The EBGSNP model is described as follows:
[0044] r t =ρ(W r ·x t +U r ·h t-1 +br )
[0045] o t =ρ(W o ·x t +U o ·h t-1 +b o )
[0046] a t =tanh(W a ·x t +U a ·(r t ⊙h t-1 )+b a )
[0047] h t =o t ⊙a t
[0048] Among them: t is the output gate o at time t, r t is the reset gate r at time t, ⊙ represents the vector inner product, W r ,U r ,b r W o ,U o ,b o ,W a ,U a ,b a is an adjustable training parameter, ρ(.) is the sigmoid function, x t and h t-1 Represent the input of the model and the internal neuron state at the previous moment, respectively. t is the pulse state at time t, h t is the internal neuron state at time t; for the EBGSNP model, it first adds the tanh nonlinear activation function outside the GSNP model to obtain a fixed local embedding s l The features of the local embedding s are then processed by the sigmoid function. l The equilibrium state characteristic S is calculated by combining the characteristic and the internal neuron state at time t u,t , and finally obtain the final balance characteristics through S2-3
[0049] S2-3: The final balanced feature is obtained by combining the features The specific description is as follows:
[0050] h u =tanh(s l )
[0051] S u,t =σ(W d h u +W' d h t )
[0052]
[0053] Where: σ(.) is the sigmoid function, h u is the local embedding s l The local embedding feature obtained by the tanh activation function, h t From the above, it can be concluded that it is the internal neuron state at time t; S u,t is the local embedding feature h u and the internal neuron state h at time t t The equilibrium state characteristics; the symbol ⊙ is the dot multiplication operation, W d and W' d is a random weight matrix.
[0054] Furthermore, S3 includes:
[0055] S3-1: Fusion of the outputs of the self-attention network, feedforward network, EBGSNP model, and local embedding to calculate the score of each candidate Apply the softmax function to get the recommendation probability of the next item The relevant formula is as follows:
[0056]
[0057]
[0058]
[0059] Where: Matrix W all ∈R d×2d , indicating that the weight parameter is a two-dimensional matrix of size d×2d; S t is the local embedding s l , Balance Characteristics and mixed long-term interest features S mix The mixed characteristics of is the mixed feature S t The transpose of and i candidates v si The product of is also the candidate score, and finally the softmax function is used to normalize the candidate score to get the recommendation probability
[0060] S3-2: Use the cross entropy loss function to train the model, which is expressed as follows:
[0061]
[0062] Where: y si represents the one-hot encoded vector of the real term, is the recommendation probability calculated by S3-1, and m represents the weighted sum of the losses of the first m predicted items.
[0063] Furthermore, S4 includes:
[0064] S4-1: Build the GAN-GSNP model based on the Keras framework of TensorFlow and use Adam optimization for training;
[0065] S4-2: Use two real datasets, yoochoose and Diginetica, for training and testing, and use the latest 1 / 64 and 1 / 4 parts of the yoochoose dataset as experimental datasets for the GAN-GSNP model.
[0066] In a second aspect, a conversation recommendation system based on a gated pulse neural P system is provided, including:
[0067] The session embedding layer is used to embed description items into the gated graph neural network and soft attention mechanism, convert discrete session data into continuous vector representation, and process the graph structure in the session data to obtain the latent matrix and local embedding of the session data. Then, the user's interests and context information are integrated into the recommendation process to obtain the global embedding of the session.
[0068] The session representation learning layer is used to input the global embedding matrix into the self-attention network and the feedforward network respectively to obtain long-term dependency features, and input the global embedding and local embedding into the EBGSNP model together to balance the relationship between the user's overall interest and current interest;
[0069] The prediction layer is used to fuse the output of the self-attention network, feedforward network, EBGSNP model and local embedding, obtain the mixed embedding through linear transformation, and then calculate the score of each candidate item through the mixed embedding to obtain the recommendation probability of the next item;
[0070] The GAN-GSNP model is used to obtain user session sequences and output prediction scores and the recommendation probability of the next item.
[0071] According to a third aspect, a conversation recommendation device based on a gated pulse neural P system is provided, comprising a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes any one of the above-mentioned conversation recommendation methods based on a gated pulse neural P system.
[0072] The above scheme has the following beneficial effects:
[0073] The present invention aggregates self-attention network, feedforward network and gated pulse neural P system variants. The self-attention network and feedforward network model the global embedding to capture the long-term and short-term dependencies of the global embedding, thereby enhancing the contextual understanding ability of the conversational recommendation. The gated pulse neural P system with a balancing effect models both local embedding and global embedding, balancing the relationship between overall interest and current interest, thereby alleviating the drift problem in conversational recommendation (the feature distribution of the data changes over time, resulting in the mismatch between the features used in the model during training and the actual features). Compared with the prior art, the recommendation results can be adjusted in real time according to the changes in overall interest and current interest.
[0074] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 is a flow chart of an embodiment of the present invention;
[0076] Figure 2 Schematic diagram of the GAN-GSNP model framework of an embodiment of the present invention;
[0077] Figure 3 A schematic diagram of a GSNP model according to an embodiment of the present invention;
[0078] Figure 4 This is a schematic diagram of the EB-GSNP model of an embodiment of the present invention;
[0079] Figure 5 Schematic diagram of the device structure of an embodiment of the present invention. DETAILED DESCRIPTION
[0080] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0081] The following is further described in detail through specific implementation methods:
[0082] Embodiment 1:
[0083] As attached Figure 1-Figure 4 As shown: The conversation recommendation method based on the gated pulse neural P system includes the following steps:
[0084] S1: The description items are embedded into a gated graph neural network and a soft attention mechanism to convert discrete session (behavior and item) data into a continuous vector representation. The graph structure in the session data is processed to obtain the latent matrix and local embedding of the session data. The user’s interests and context information are then integrated into the recommendation process to obtain the global embedding of the session.
[0085] Specifically, S1 includes:
[0086] S1-1: V = {v 1 ,v 2 ,...,v m} is defined as the set of unique items designed in all sessions, and s = [v s1 ,v s2 ,...,v sn ] is defined as an anonymous session sequence, where v si ∈V,v si v s1 ,v s2 ,...,v sn The i-th session of , represents the item clicked by the user in session s; define the global embedding output by the soft attention mechanism as s g , the local embedding in the latent matrix is s l .
[0087] Usually, the interaction between a user and an item within a period of time can be called a session, and each session sequence s is modeled as a corresponding directed graph G s =(V s ,E s ), where V si ∈V s , V s is a set of vertices, E s is a set of edges; each edge <V si-1 ,V si >∈E s For the user who clicked V in session s si-1 After the project, click Project V si . The items in the directed graph corresponding to each session are embedded into a unified embedding space, and the node vector represents the latent vector of item v learned by the graph neural network, where d is the dimension, represents the session of the ith item at time t, R d is a d-dimensional space vector.
[0088] S1-2: In the gated graph neural network, the representation of the node is updated by aggregating the node and neighbor information to capture the structure and relationship between the nodes. In-degree directed graph ) are connected to form the concatenated matrix A si ∈R 1×2n , R 1×2n is a space vector of size 1×2n.
[0089] The gated graph neural network contains a reset gate and an update gate, which are used to control the update and transmission of information, and finally derive the potential vector of the item v. The relevant formula is as follows:
[0090]
[0091]
[0092]
[0093]
[0094]
[0095] in: is the matrix A si The result of weighted connection, T represents transposition, b is the one-dimensional bias, H∈R d×2d Represents a weight matrix of size d×2d; and are the update gate and reset gate at time t, respectively, which determine the information to be retained and discarded, W z , W r , U z , U r are modifiable training parameters; is a list of node vectors, tanh(.) is a nonlinear activation function, represents the session of the i-th item at time t-1, ρ(.) is the sigmoid function; W 0 , U 0 is a modifiable training parameter, ⊙ is an element-wise multiplication operator, represents the internal neuron state at time t.
[0096] S1-3: Utilize the latent vector to get the global embedding s for each session through the soft attention mechanism g and local embeddings l , according to the definition of local embedding, the last click v in the session sn Defined as local embedding, s l =v sn , for global embedding, the session directed graph G is obtained by weighted information aggregation of latent vectors s The global embedding of is defined as follows:
[0097]
[0098] where q∈R d and W β1 , W β2 ∈R d×d is the weight of the item embedding vector, W β1 , W β2 is a two-dimensional matrix of size d×d, q is a one-dimensional matrix of size d, ρ(.) is the sigmoid function; v si represents the session of the i-th item, v sn represents the session of the nth item, also called the last clicked item, and c is the bias parameter. From the above, the global embedding s g is the soft attention score β i The weighted sum of and the i-th project session is obtained.
[0099] S2: The self-attention network, feedforward network and gated spiking neural network P system with additional balancing effect are described: the global embedding matrix is input into the self-attention network and the feedforward network respectively to obtain the long-term dependency relationship features, and the global embedding and local embedding are input into the EBGSNP model together to balance the relationship between the user's overall interest and current interest.
[0100] Specifically, S2 includes:
[0101] S2-1: The self-attention network can capture the dependencies between different positions in a sequence without being restricted by distance, so as to better understand the contextual information in the sequence. The feedforward network can model complex nonlinear relationships by introducing nonlinear activation functions, so that the grid can capture high-order features and patterns in the data. The global embedding is input into both networks at the same time to obtain different long-term interest features, which are defined as follows:
[0102]
[0103]
[0104]
[0105] F=Relu(HW f1 +b f1 )
[0106] F j =SAN(F j-1 )
[0107] in: is the global embedding s g The matrix obtained by linear projection, softmax(.) is the activation function, The transposed matrix is activated with softmax and then multiplied by To get the attention score attention is a scaling factor to avoid excessive inner product values, T represents transposition; head i Indicates the calculation of the i-th attention score. Similarly, head j It represents the jth attention score calculation, and Head represents multiple attention score calculations (from head i Start to head j End) is concatenated to form a multi-head attention, where the formula Concat represents concatenation; Relu(.) is the activation function, F is the global embedded feature obtained by the Relu(.) activation function, and W f1 ,b f1 are the weight matrix of size d×d and the bias vector of dimension d, respectively. j represents the number of layers of the self-attention network. SAN is the self-attention network. j Represents the global embedding feature obtained by the j-th layer self-attention network.
[0108] The final self-attention output is defined as F att , that is, F att =F j .
[0109] F relu =Relu(s g W f2 +b f2 )
[0110] Where W f2 ,b f2 are the weight matrix and d-dimensional bias vector of size d×d, respectively, relu The result of feature re-extraction of ReLU activation function for global embedding;
[0111] S mix =Concat(F att ,F relu )
[0112] Where S mix is a mixed long-term interest feature; F att It is a multi-head self-attention network feature;
[0113] S2-2: The gated pulse neural P system with additional balancing effect is a variant of the gated pulse neural P system GSNP. The GSNP model is a cyclic model (see attached Figure 3 As shown), it introduces the output gate o (i.e., o at time t below). tcontrol neuron output) and reset gate r (i.e., r at time t in the following text) t Modify the pulse generation formula and the state of the hidden layer at the previous moment), the EBGSNP model is described as follows:
[0114] r t =ρ(W r ·x t +U r ·h t-1 +b r )
[0115] o t =ρ(W o ·x t +U o ·h t-1 +b o )
[0116] a t =tanh(W a ·x t +U a ·(r t ⊙h t-1 )+b a )
[0117] h t =o t ⊙a t
[0118] Among them: t is the output gate o at time t, r t is the reset gate r at time t, ⊙ represents the vector inner product, W r ,U r ,b r W o ,U o ,b o ,W a ,U a ,b a is an adjustable training parameter, ρ(.) is the sigmoid function, x t and h t-1 Represent the input of the model and the internal neuron state at the previous moment, respectively. t is the pulse state at time t, h t is the internal neuron state at time t; for the EBGSNP model, it first adds the tanh nonlinear activation function outside the GSNP model to obtain a fixed local embedding s l The features of the local embedding s are then processed by the sigmoid function. l The equilibrium state characteristic S is calculated by combining the characteristic and the internal neuron state at time t u,t, and finally obtain the final balance characteristics through S2-3
[0119] S2-3: The final balanced feature is obtained by combining the features The specific description is as follows:
[0120] h u =tanh(s l )
[0121] S u,t =σ(W d h u +W' d h t )
[0122]
[0123] Where: σ(.) is the sigmoid function, h u is the local embedding s l The local embedding feature obtained by the tanh activation function, h t From the above, it can be concluded that it is the internal neuron state at time t; S u,t is the local embedding feature h u and the internal neuron state h at time t t The equilibrium state characteristics; the symbol ⊙ is the dot multiplication operation, W d and W' d is a random weight matrix.
[0124] S3: The output of the self-attention network, feedforward network, EBGSNP model and local embedding are fused, and a hybrid embedding is obtained through linear transformation. The score of each candidate item is calculated through the hybrid embedding and the recommendation probability of the next item is obtained.
[0125] Specifically, S3 includes:
[0126] S3-1: After obtaining the long-term interest mixed features and balanced features, the output of the self-attention network, feedforward network, EBGSNP model and local embedding are fused to calculate the score of each candidate Apply the softmax function to get the recommendation probability of the next item In the model of this embodiment, the accuracy of the top 20 product recommendations is calculated, and the relevant formula is as follows:
[0127]
[0128]
[0129]
[0130] Where: Matrix W all ∈R d×2d , indicating that the weight parameter is a two-dimensional matrix of size d×2d; S t is the local embedding s l , Balance Characteristics and mixed long-term interest features S mix The mixed characteristics of is the mixed feature S t The transpose of and i candidates v si The product of is also the candidate score, and finally the softmax function is used to normalize the candidate score to get the recommendation probability
[0131] S3-2: For each session directed graph, the cross entropy loss function is used to train the model, which is expressed as follows:
[0132]
[0133] Where: y si represents the one-hot encoded vector of the real term, is the recommendation probability calculated by S3-1, and m represents the weighted sum of the losses of the first m predicted items.
[0134] S4: Build a GAN-GSNP model based on deep learning technology, obtain user session sequences, and output prediction scores and the recommendation probability of the next item.
[0135] Specifically, S4 includes:
[0136] S4-1: Build the GAN-GSNP model based on the Keras framework of TensorFlow and use Adam optimization for training.
[0137] S4-2: Use two real datasets, yoochoose and Diginetica, for training and testing, and use the latest 1 / 64 and 1 / 4 parts of the yoochoose dataset as experimental datasets for the GAN-GSNP model.
[0138] In order to demonstrate the effectiveness of the GAN-GSNP model, this example uses two real datasets, Yoochoose and Diginetica, to verify the effectiveness of the proposed model and the accuracy of the recommendations. The model is evaluated on these two datasets and compared with some common baseline methods.
[0139] In the experiment, this embodiment will use two evaluation indicators (Precision, Mean Reciprocal Rank) to evaluate the accuracy of the recommendation list. Pre@K is used to measure the accuracy of the model in predicting positive samples. It is a precision measure of the proportion of target items in the top K positions in the recommendation list. Moreover, this indicator does not care about the position of the target item in the recommendation list. As long as the target item is in the recommendation list, it can become a correct positive sample. The higher its value, the better the accuracy of the evaluation indicator. The calculation method of Mrr@K is to find the position (Rank) of the first correct answer in the results returned by the model for each user query, and then calculate its reciprocal ranking (1 / Rank). Finally, the reciprocal rankings of all queries are averaged to obtain the Mrr value. The higher the value, the better the sorting effect. In this embodiment of the entire experiment, K is set to 20, that is, the accuracy of the top-20 product recommendations is calculated.
[0140] The quantitative evaluation results are shown in the following table:
[0141] Table 1: Performance comparison of all methods on three datasets (the best is in bold, the second best is underlined)
[0142]
[0143]
[0144] Note: In Table 1, the traditional popularity-based model POP, the improved popularity-based model S-POP method, collaborative filtering methods (K-nearest neighbor model Item-KNN, matrix decomposition model BPR-MF based on Bayesian personalized ranking), matrix decomposition methods (based on factor probability matrix decomposition model FPMC), deep learning methods (gated recurrent unit model GRU4REC, attention-based recursive model NARM, spatial-temporal attention model STAMP) and graph neural network methods (SR-GNN) were used in the experiment as comparison methods, where Pre@20 and Mrr@20 indicators are the Precision and MeanReciprocal Rank indicators described above.
[0145] Embodiment 2:
[0146] The conversational recommendation system based on the gated spiking neural P system includes:
[0147] The session embedding layer is used to embed description items into the gated graph neural network and soft attention mechanism, convert discrete session data into continuous vector representation, and process the graph structure in the session data to obtain the latent matrix and local embedding of the session data. Then, the user's interests and context information are integrated into the recommendation process to obtain the global embedding of the session.
[0148] The session representation learning layer is used to input the global embedding matrix into the self-attention network and the feedforward network respectively to obtain long-term dependency features, and input the global embedding and local embedding into the EBGSNP model together to balance the relationship between the user's overall interest and current interest;
[0149] The prediction layer is used to fuse the output of the self-attention network, feedforward network, EBGSNP model and local embedding, obtain the mixed embedding through linear transformation, and then calculate the score of each candidate item through the mixed embedding to obtain the recommendation probability of the next item;
[0150] The GAN-GSNP model is used to obtain user session sequences and output prediction scores and the recommendation probability of the next item.
[0151] Embodiment 3:
[0152] As attached Figure 5 As shown, a conversation recommendation device based on a gated pulse neural P system is an electronic device 500, which includes an external device 501, an acquisition device 502, a storage device 503, a processing device 504 and a display device 505.
[0153] The external device 501 is used to train a conversation recommendation method based on a gated pulse neural P system with an additional balancing effect, which requires corresponding deep learning equipment. The common deep learning GPUs at this stage include NVIDIA RTX series and Tesla P100 GPU for training.
[0154] The acquisition device 502 of this embodiment generally refers to tools and techniques for acquiring text data. Common acquisition devices 502 include: web crawlers and crawler frameworks, application programming interfaces (APIs), social media platforms, mobile applications, open data sources, and speech recognition devices. Web crawlers and crawler frameworks (Scrapy, Beautiful Soup, and Selenium) are programs for automatically acquiring text data on the Internet. They can access web pages, extract text content and tags, and then store the data in a local or cloud database. Application programming interface (API) is used to programmatically acquire text data. Social media platforms such as Twitter, Facebook, news agencies, translation services, and search engines all provide APIs to access content. Mobile applications are used to collect user-generated text data, such as user comments, social media posts, and in-app chat records. This requires the development of applications suitable for mobile platforms so that users can generate text data. Open data sources are data sets provided by some public institutions, research institutions, and cloud computing providers for research and application development. These data sources include large-scale text corpora, geographic data, social media data, and multilingual translation data. Speech recognition devices convert spoken language into text data, such as smart assistants, speech recognition software, and phone recordings. The acquisition device 502 of the conversation recommendation method of the gated pulse neural P system with additional balancing effect uses an open data source, and then performs data cleaning and preprocessing on it after acquisition to ensure the quality and consistency of the data.
[0155] The storage device 503 is usually a hardware and storage solution for storing and managing text data, and generally includes a cloud storage service, a database management system, a network file system, and an external hard disk and tape storage. The storage device 503 is a computer-readable storage medium, which stores instructions, and when it is run on a computer, the computer executes a conversation recommendation method based on a gated pulse neural P system. The storage device 503 using an external hard disk and tape storage generally adopts a mobile hard disk, a USB flash drive, a read-only memory (ROM), and a random access memory (RAM).
[0156] The processing device 504 can be processed by a central processing unit (CPU). Due to the complexity of the model calculation and high computing power requirements, it is recommended to use a CPU Intel i5 series with 4GB of RAM.
[0157] The display device 505 uses a USB display, an external computer display screen, etc.
[0158] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.
Claims
1. A conversation recommendation method based on a gated pulse neural P system, characterized in that: The steps include: S1: Describe item embedding, gated graph neural network and soft attention mechanism, transform discrete session data into continuous vector representation, process the graph structure in the session data, obtain the latent matrix and local embedding of the session data, and then integrate the user's interests and context information into the recommendation process to obtain the global embedding of the session; S2: Input the global embedding matrix into the self-attention network and the feedforward network respectively to obtain the long-term dependency features, and input the global embedding and local embedding into the EBGSNP model together to balance the relationship between the user's overall interest and current interest; S3: The output of the self-attention network, feedforward network, EBGSNP model and local embedding are fused, and a hybrid embedding is obtained through linear transformation. The score of each candidate item is calculated through the hybrid embedding and the recommendation probability of the next item is obtained. S4: Build a GAN-GSNP model based on deep learning technology, obtain user session sequences, and output prediction scores and the recommendation probability of the next item; Specifically, S1 includes: S1-1: Set V = {v1,v2,...,v m } is defined as the set of unique items designed in all sessions, and s = [v s1 ,v s2 ,...,v sn ] is defined as an anonymous session sequence, where v si ∈V,v si v s1 ,v s2 ,...,v sn The i-th session of , represents the item clicked by the user in session s; Define the global embedding of the output of the soft attention mechanism as s g , the local embedding in the latent matrix is s l ; Model each session sequence s as a corresponding directed graph G s =(V s ,E s ), where V si ∈V s , V s is the vertex set, E s is a set of edges, each edge <V si-1 ,V si >∈E s For the user who clicked V in session s si-1 After the project, click Project V si ; The items in the directed graph corresponding to each session are embedded into a unified embedding space, and the node vector represents the latent vector of item v learned by graph neural network, where represents the session of the i-th item at time t, d is the dimension, R d is a d-dimensional space vector; S1-2: Concatenate the outputs of the item embeddings to form the concatenated matrix A si ∈R 1×2n , where A si It is an out-degree directed graph. and in-degree directed graph Get a two-dimensional matrix, R 1×2n is a 1×2n space vector; it is used to control the update and transmission of information, and finally obtain the potential vector of item v The relevant formula is as follows: in: is the matrix A si The result of weighted connection, T represents transposition, b is the one-dimensional bias, H∈R d×2d Represents a weight matrix of size d×2d; and are the update gate and reset gate at time t, respectively, which determine the information to be retained and discarded, W z , W r , U z , U r are modifiable training parameters; is a list of node vectors, tanh(.) is a nonlinear activation function, represents the session of the i-th item at time t-1, ρ(.) is the sigmoid function; W0, U0 are modifiable training parameters, ⊙ is the element-by-element multiplication operator, represents the internal neuron state at time t; S1-3: Utilize the latent vector to get the global embedding s for each session through the soft attention mechanism g and local embeddings l , according to the definition of local embedding, the last click v in the session sn Defined as local embedding, s l =v sn , the session directed graph G is obtained by weighted information aggregation of latent vectors s The global embedding of is defined as follows: β i =q T ρ(W β1 v sn +W β2 v si +c Where: q∈R d and W β1 , W β2 ∈R d×d is the weight of the item embedding vector, W β1 , W β2 is a two-dimensional matrix of size d×d, q is a one-dimensional matrix of size d, ρ(.) is the sigmoid function; v si represents the session of the ith item, v sn represents the session of the nth item, also the last clicked item, c is the bias parameter; the global embedding s g By the soft attention score β i The weighted sum of the i-th project session is obtained; Specifically, S2 includes: S2-1: The global embedding is input into both networks to obtain different long-term interest features, which are defined as follows: F=Relu(HeadW f1 +b f1 ) F j =SAN(F j-1 ) in: is the global embedding s g The matrix obtained by linear projection, softmax(.) is the activation function, The transposed matrix is activated with softmax and then multiplied by To get the attention score is a scaling factor to avoid excessive inner product values, T represents transposition; head i Indicates the calculation of the i-th attention score. Similarly, head j It represents the jth attention score calculation, and Head represents multiple attention score calculations. i Start to head j End, splice to form multi-head attention, where the formula Concat represents splicing; Relu(.) is the activation function, F is the global embedded feature obtained by the Relu(.) activation function, and W f1 ,b f1 are the weight matrix of size d×d and the bias vector of dimension d, respectively. j represents the number of layers of the self-attention network. SAN is the self-attention network. j represents the global embedding feature obtained by the j-th layer self-attention network; The final self-attention output is defined as F att , that is, F att =F j ; F relu =Relu(s g IN f2 +b f2 ) Where W f2 ,b f2 are the weight matrix of size d×d and the d-dimensional bias vector, F relu The result of feature re-extraction using the Relu(.) activation function for global embedding; S mix =Concat(F att ,F relu ) Where S mix is the mixed long-term interest feature, F att It is a multi-head self-attention network feature; S2-2: The output gate o is introduced to control the neuron output and the reset gate r is used to modify the pulse generation formula and the state of the hidden layer at the previous moment. The EBGSNP model is described as follows: r t =ρ(W r ·x t +U r ·h t-1 +b r ) the t =ρ(W o ·x t +U o ·h t-1 +b o ) a t =tanh(W a ·x t +U a ·(r t ⊙h t-1 )+b a ) h t =o t ⊙a t Among them: t is the output gate o at time t, r t is the reset gate r at time t, ⊙ represents the vector inner product, W r ,U r ,b r W o ,U o ,b o ,W a ,U a ,b a is an adjustable training parameter, ρ(.) is the sigmoid function, x t and h t-1 Represent the input of the model and the internal neuron state at the previous moment, respectively. t is the pulse state at time t, h t is the internal neuron state at time t; for the EBGSNP model, it first adds the tanh nonlinear activation function outside the GSNP model to obtain a fixed local embedding s l The features of the local embedding s are then processed by the sigmoid function. l The equilibrium state characteristic S is calculated by combining the characteristic and the internal neuron state at time t u,t , and finally obtain the final balance characteristics through S2-3 S2-3: The final balanced feature is obtained by combining the features The specific description is as follows: h u =tanh(s l ) S u,t =σ(W d h u +W' d h t ) Where: σ(.) is the sigmoid function, h u is the local embedding s l The local embedding feature obtained by the tanh activation function, h t From the above, it can be concluded that it is the internal neuron state at time t; S u,t is the local embedding feature h u and the internal neuron state h at time t t The equilibrium state characteristics; the symbol ⊙ is the dot multiplication operation, W d and W' d is a random weight matrix.
2. The conversation recommendation method based on the gated pulse neural P system according to claim 1, characterized in that S3 include: S3-1: Fusion of the outputs of the self-attention network, feedforward network, EBGSNP model, and local embedding to calculate the score of each candidate Apply the softmax function to get the recommendation probability of the next item The relevant formula is as follows: Where: Matrix W all ∈R d×2d , indicating that the weight parameter is a two-dimensional matrix of size d×2d; S t is the local embedding s l , Balance Characteristics and mixed long-term interest features S mix The mixed characteristics of is the mixed feature S t The transpose of and i candidates v si The product of is also the candidate score, and finally the softmax function is used to normalize the candidate score to get the recommendation probability S3-2: Use the cross entropy loss function to train the model, which is expressed as follows: where y si represents the one-hot encoded vector of the real term, is the recommendation probability calculated by S3-1, and m represents the weighted sum of the losses of the first m predicted items.
3. The conversation recommendation method based on the gated pulse neural P system according to claim 2, characterized in that S4 include: S4-1: Build the GAN-GSNP model based on the Keras framework of TensorFlow and use Adam optimization for training; S4-2: Use two real datasets, yoochoose and Diginetica, for training and testing, and use the latest 1 / 64 and 1 / 4 parts of the yoochoose dataset as experimental datasets for the GAN-GSNP model.
4. A conversational recommendation system based on a gated pulse neural P system, characterized in that: include: The session embedding layer is used to embed description items into the gated graph neural network and soft attention mechanism, convert discrete session data into continuous vector representation, and process the graph structure in the session data to obtain the latent matrix and local embedding of the session data. Then, the user's interests and context information are integrated into the recommendation process to obtain the global embedding of the session. The session representation learning layer is used to input the global embedding matrix into the self-attention network and the feedforward network respectively to obtain long-term dependency features, and input the global embedding and local embedding into the EBGSNP model together to balance the relationship between the user's overall interest and current interest; The prediction layer is used to fuse the output of the self-attention network, feedforward network, EBGSNP model and local embedding, obtain the mixed embedding through linear transformation, and then calculate the score of each candidate item through the mixed embedding to obtain the recommendation probability of the next item; GAN-GSNP model, which is used to obtain user session sequences and output prediction scores and the probability of recommending the next item; Specifically, the session embedding layer is used to transform V = {v1, v2, ..., v m } is defined as the set of unique items designed in all sessions, and s = [v s1 ,v s2 ,...,v sn ] is defined as an anonymous session sequence, where v si ∈V,v si v s1 ,v s2 ,...,v sn The i-th session of , represents the item clicked by the user in session s; Define the global embedding of the output of the soft attention mechanism as s g , the local embedding in the latent matrix is s l ; Model each session sequence s as a corresponding directed graph G s =(V s ,E s ), where V si ∈V s , V s is the vertex set, E s is a set of edges, each edge <V si-1 ,V si >∈E s For the user who clicked V in session s si-1 After the project, click Project V si ; The items in the directed graph corresponding to each session are embedded into a unified embedding space, and the node vector represents the latent vector of item v learned by graph neural network, where represents the session of the i-th item at time t, d is the dimension, R d is a d-dimensional space vector; Concatenate the outputs of the item embeddings to form the concatenation matrix A si ∈R 1×2n , where A si It is an out-degree directed graph. and in-degree directed graph Get a two-dimensional matrix, R 1×2n is a 1×2n space vector; it is used to control the update and transmission of information, and finally obtain the potential vector of item v The relevant formula is as follows: in: is the matrix A si The result of weighted connection, T represents transposition, b is the one-dimensional bias, H∈R d×2d Represents a weight matrix of size d×2d; and are the update gate and reset gate at time t, respectively, which determine the information to be retained and discarded, W z , W r , U z , U r are modifiable training parameters; is a list of node vectors, tanh(.) is a nonlinear activation function, represents the session of the i-th item at time t-1, ρ(.) is the sigmoid function; W0, U0 are modifiable training parameters, ⊙ is the element-by-element multiplication operator, represents the internal neuron state at time t; The latent vector is used to obtain the global embedding s for each session through the soft attention mechanism. g and local embeddings l , according to the definition of local embedding, the last click v in the session sn Defined as local embedding, s l =v sn , the session directed graph G is obtained by weighted information aggregation of latent vectors s The global embedding of is defined as follows: β i =q T ρ(W β1 v sn +W β2 v si +c Where: q∈R d and W β1 , W β2 ∈R d×d is the weight of the item embedding vector, W β1 , W β2 is a two-dimensional matrix of size d×d, q is a one-dimensional matrix of size d, ρ(.) is the sigmoid function; v si represents the session of the i-th item, v sn represents the session of the nth item, also the last clicked item, c is the bias parameter; the global embedding s g By the soft attention score β i The weighted sum of the i-th project session is obtained; Specifically, the session representation learning layer is used to input the global embedding into the two networks simultaneously to obtain different long-term interest features, which are specifically defined as follows: F=Relu(HeadW f1 +b f1 ) F j =SAN(F j-1 ) in: is the global embedding s g The matrix obtained by linear projection, softmax(.) is the activation function, The transposed matrix is activated with softmax and then multiplied by To get the attention score is a scaling factor to avoid excessive inner product values, T represents transposition; head i Indicates the calculation of the i-th attention score. Similarly, head j It represents the jth attention score calculation, and Head represents multiple attention score calculations. i Start to head j End, splice to form multi-head attention, where the formula Concat represents splicing; Relu(.) is the activation function, F is the global embedded feature obtained by the Relu(.) activation function, and W f1 ,b f1 are the weight matrix of size d×d and the bias vector of dimension d, respectively. j represents the number of layers of the self-attention network. SAN is the self-attention network. j represents the global embedding feature obtained by the j-th layer self-attention network; The final self-attention output is defined as F att , that is, F att =F j ; F relu =Relu(s g IN f2 +b f2 ) Where W f2 ,b f2 are the weight matrix of size d×d and the d-dimensional bias vector, F relu The result of feature re-extraction using the Relu(.) activation function for global embedding; S mix =Concat(F att ,F relu ) Where S mix is the mixed long-term interest feature, F att It is a multi-head self-attention network feature; The output gate o is introduced to control the neuron output and the reset gate r is used to modify the pulse generation formula and the state of the hidden layer at the previous moment. The EBGSNP model is described as follows: r t =ρ(W r ·x t +U r ·h t-1 +b r ) the t =ρ(W o ·x t +U o ·h t-1 +b o ) a t =tanh(W a ·x t +U a ·(r t ⊙h t-1 )+b a ) h t =o t ⊙a t Among them: t is the output gate o at time t, r t is the reset gate r at time t, ⊙ represents the vector inner product, W r ,U r ,b r W o ,U o ,b o ,W a ,U a ,b a is an adjustable training parameter, ρ(.) is the sigmoid function, x t and h t-1 Represent the input of the model and the internal neuron state at the previous moment, respectively. t is the pulse state at time t, h t is the internal neuron state at time t; for the EBGSNP model, it first adds the tanh nonlinear activation function outside the GSNP model to obtain a fixed local embedding s l The features of the local embedding s are then processed by the sigmoid function. l The equilibrium state characteristic S is calculated by combining the characteristic and the internal neuron state at time t u,t , and finally obtain the final balance characteristics through S2-3 The final balanced feature is obtained by combining the features The specific description is as follows: h u =tanh(s l ) S u,t =σ(W d h u +W' d h t ) Where: σ(.) is the sigmoid function, h u is the local embedding s l The local embedding feature obtained by the tanh activation function, h t From the above, it can be concluded that it is the internal neuron state at time t; S u,t is the local embedding feature h u and the internal neuron state h at time t t The equilibrium state characteristics; the symbol ⊙ is the dot multiplication operation, W d and W' d is a random weight matrix.
5. A conversation recommendation device based on a gated pulse neural P system, characterized in that: The invention comprises a computer-readable storage medium, in which instructions are stored, and when the computer-readable storage medium is run on a computer, the computer is enabled to execute the conversation recommendation method based on the gated pulse neural P system as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Personalized session recommendation method for long-term and short-term interest extraction
CN116737907A
Session recommendation method based on graph neural network and interest attention network
CN115658864A
Session-based recommendation method and device
US20220374962A1