An interpretable sequential recommendation method fusing time awareness and path reasoning
By constructing a temporal collaborative knowledge graph and a path reasoning system, and combining time awareness and path reasoning, the problems of dynamic changes in user interests and insufficient interpretability in existing recommendation systems are solved, achieving more accurate and interpretable recommendation results.
Patent Information
- Application Number
- CN202411368321.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2044-09-29
AI Technical Summary
Existing recommendation systems fail to effectively utilize the dynamic changes in user interests and behaviors, resulting in inaccurate and uninterpretable recommendation results. Furthermore, existing methods fail to fully leverage temporal information for reasoning.
An interpretable sequence recommendation system integrating time awareness and path reasoning is designed. By constructing a temporal collaborative knowledge graph and combining it with the TransE model for entity and relation embedding, a time awareness system and a path reasoning system are used to complement each other. A reinforcement learning framework is used for path reasoning and item prediction to simulate human thought processes.
It improves the accuracy and interpretability of the recommendation system and enhances the persuasiveness of the recommendation results by capturing the time-dependent features of user purchasing behavior.
Smart Images

Figure CN119415766B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the fields of knowledge graph, graph neural network, recommendation system, etc., and particularly provides an interpretable sequence recommendation method fusing time perception and path reasoning. BACKGROUND
[0002] With the rapid development of Internet technology, the amount of information available to users has increased dramatically, leading to an increasingly serious "information overload" problem. How to find content of interest to users in the vast amount of information and improve information acquisition efficiency has become a problem to be solved. A recommendation system intelligently filters out the content of most interest to users by analyzing the behavior preferences of users, thereby improving user experience.
[0003] A knowledge graph is a semantic network, whose nodes represent entities or concepts, and edges represent various semantic relationships between entities / concepts. A knowledge graph consists of a number of triples (h, r, t), where h and t represent the head node and the tail node, and r represents the relationship. A recommendation model based on a knowledge graph is to introduce a knowledge graph (KG) as auxiliary information into a recommendation system, to mine the potential relationship between users and objects through the rich semantic association and structural information in the knowledge graph, thereby improving the performance of recommendation, mainly including an embedding-based recommendation system, a path-based recommendation system, and a propagation-based recommendation system.
[0004] An embedding-based recommendation system uses a knowledge graph embedding algorithm to preprocess the KG, and merges the learned entity embedding into the recommendation framework. CKE (Proceedings of the 37th international ACM SIGIR conference on Research&development in information retrieval, 2014) combines the CF module with the knowledge embedding, text embedding, and image embedding of items in a unified Bayesian framework. DKN (IEEE Transactions on Knowledge and Data Engineering, 2017) treats entity embedding and word embedding as different channels, and then designs a CNN framework to combine them together for news recommendation. KTUP (Proceedings of the World Wide Web Conference, 2019) migrates the learned relationship embedding and entity embedding from KG to TUP, while training the integrity of KG and the recommendation task. The representations of user, item, entity, and relationship are jointly learned. TUP and TransH are jointly learned.
[0005] Path-based recommendation systems provide additional guidance for recommendation by exploring various connection patterns between items in KG. PER (ACM International Conference on Web Search and Data Mining, 2014) treats KG as a heterogeneous network and extracts latent features based on meta-paths to represent the connectivity between users and items along different types of relationship paths. Hete-CF (IEEE International Conference on Data Mining, 2014) computes the preference degree of users to unrated items by obtaining the regularization term of meta-path similarity between various types of entities. KPRN (AAAI Conference on Artificial Intelligence, 2019) enumerates all qualified paths between each user-item pair, and then trains a sequence RNN model from the extracted paths to predict the ranking score of these pairs. PGPR (ACM SIGIR Conference on Research and Development in Information Retrieval, 2019) replaces the enumeration method with a reinforcement reasoning method to determine the meta-path suitable for scalability. TMER (ACM International Conference on Web Search and Data Mining, 2021) further models temporal meta-paths by capturing historical item features and context information defined by attention networks.
[0006] Propagation-based method recommendation systems enhance entity representations by aggregating features of multi-hop neighbors in a knowledge graph. RippleNet (ACM International Conference on Information and Knowledge Management, 2018) draws on the "ripple effect" in physics, believing that users' interest in goods will spread like ripples. By constructing a user-goods interaction graph, learning the latent features of users and goods using a graph neural network, and simulating the interaction process of users with goods, an individualized recommendation list is generated. KGCN (World Wide Web Conference, 2019) uses a graph convolution network to aggregate neighbor information of nodes, and iteratively obtains the final entity vector to capture high-order information. KGAT (ACM Knowledge Discovery and Data Mining, 2019) uses a graph attention network to assign different weights to relationships to capture users' preferences and interests. CKAN (ACM SIGIR Conference on Research and Development in Information Retrieval, 2020) proposes a heterogeneous propagation strategy, encodes two types of information, and then applies a knowledge-aware attention mechanism to distinguish the contributions of different knowledge-based neighbors.
[0007] However, existing recommendation systems only use static knowledge graph feature information and do not focus on the dynamic changes in user interest and behavior. They also cannot model the dynamics of user historical behavior, leading to inaccurate recommendations and a lack of convincing explanations. Although some methods consider time information, they are mainly used to enhance data representation rather than reasoning on a knowledge graph, which makes them unable to infer more information from time series information. SUMMARY
[0008] In order to overcome the shortcomings of the prior art and improve the accuracy and explainability of the recommendation system, the present application proposes an explainable sequence recommendation system that combines time perception and path reasoning. Drawing on the dual-process theory of cognitive science, a time perception system and a path reasoning system are designed. The time perception system models temporal dependencies through temporal perception, and the path reasoning system selects appropriate associated paths as recommendation reasons through path reasoning. The two systems work iteratively and complement each other, further improving the accuracy and explainability of the recommendation results.
[0009] The technical scheme adopted by the application to solve its technical problems is:
[0010] An explainable sequence recommendation method that combines time perception and path reasoning, the method comprising the following steps:
[0011] (1) Constructing the time-aware collaborative knowledge graph
[0012] According to the historical interaction information of the user, the collaborative knowledge graph is sliced to obtain a series of ordered snapshots, and a time-aware collaborative knowledge graph is established, which is represented as TCKG Wherein represents the snapshot of CKG at time τ, wherein h represents the head entity, t represents the tail entity, and r τ represents the relationship at time τ, and ε represents the entity set, represents the relationship set;
[0013] (2) Time-aware collaborative knowledge graph representation learning
[0014] The TransE translation model is used for entity and relationship embedding of TCKG. For a given triple (h, r τ , t) in TCKG τ , h, r h , and t all have d-dimensional embeddings, i.e. The scoring function is defined as the distance between e τ and e t , and the formula is as follows:
[0015]
[0016] A smaller score indicates that the triple is more likely to be correct, and vice versa;
[0017] The loss function of the relative order between positive triplets and negative triplets is defined as:
[0018]
[0019] Wherein and (h, r, t') is a negative example triplet obtained by replacing the tail entity with a random entity t', and σ(·) is a sigmoid function.
[0020] Through training, a user vector set {h u}, an item vector set {h v}, and a relationship vector set {h r} are obtained.
[0021] (3) Designing a time-aware system
[0022] The time-aware system takes the item vector, user vector, and multiple path vectors at the current time as input to generate an item prediction vector.
[0023] (4) Designing a path reasoning system
[0024] The path reasoning system performs associated path reasoning under the guidance of the item prediction vector generated by the time-aware system, and obtains the above plurality of path vectors through path representation learning. The system uses a reinforcement learning framework to establish a reasoning environment, which provides the current environment state and information of executable operations in the TCKG to the policy decision module, and rewards the decision module according to the matching degree of the current policy and user interaction;
[0025] (5) Model training
[0026] The two systems work iteratively and complement each other. The item prediction vector output by the time-aware system is transmitted to the path reasoning system for associated path reasoning, and then the plurality of path vectors output by the path reasoning system and the item vector and user vector of the current time step are input to the time-aware system to obtain the item prediction vector.
[0027] The trained model is obtained, and accurate recommendation results are provided for users.
[0028] Further, the process of (3) is as follows:
[0029] First, the plurality of path vectors are transmitted to the time-aware system. These paths reflect different purchase preferences of the user. The path attention mechanism is used to aggregate the plurality of path vectors, and the obtained multi-path aggregation vector can better represent the complex relationship between entities. The calculation formula of the path attention mechanism is:
[0030] MultiHead(Q φ ,K φ ,V φ )=Concat(head1,...,head1)W O (3)
[0031]
[0032] Where head i is f(·) is a softmax function, Q, K, and V are self-attention variables associated with the path φ, W is a weight matrix, d k is the dimension, and Concat(·) is a concatenation operation.
[0033] After obtaining the multi-path aggregation vector, the item attention mechanism is used to combine the current item's own information with the path aggregation vector to incorporate historical time series information and update the item vector at the current time. The calculation formula of the item attention mechanism is:
[0034]
[0035] Where pi denotes the initial representation of the current item, φ i-1→i is the path instance from the i-1th item to the i th item, W is the weight matrix, b is the bias, g(·) is the ReLU function;
[0036] The user vector and the item vector are spliced, and the spliced vector is input into a multilayer perception to generate an item prediction vector at the moment, and the calculation formula is:
[0037]
[0038] Since there is no historical time sequence information before the first item, the user vector and the first item vector are spliced, and the spliced vector is input into a multilayer perception to generate an item prediction vector at the moment, and the calculation formula is:
[0039] h1=MLP(Concat(h u ,h1)) (7)
[0040] The generated item prediction vector is input into a path inference system for associated path inference.
[0041] Further, the process of (4) is as follows:
[0042] (4.1) State: the initial state is s0=[u,u,φ,φ], and the state s t at the time step t is [u,h t ,e t ,e’ t+1 ], wherein u represents a user entity, h t represents a history record (e0,e1,...,e t ) containing t steps, e t represents an entity at the current step, and e’ t+1 represents an entity estimation vector generated by the time-aware system for the time step t+1;
[0043] (4.2) Action: at the time step t, the action is represented as wherein e t+1 represents the next entity to be accessed, and r t+1 represents the relationship between the current entity and e t+1 ;
[0044] (4.3) Pruning strategy: in order to improve the efficiency of the model and control the space complexity at the same time, effective inference needs to be performed while maintaining the maximum out-degree benchmark of the action space, and a score function is used to calculate the score of each action, and the definition is as follows:
[0045]
[0046] where <·,·> denotes the dot product operation, r t′ ∈ {r kg ∪ r interact} is the relational embedding at t' th time step, ranking all actions in the action space by scores and keeping top-∈ actions in the pruned action space where is defined as:
[0047]
[0048] where ∈ is a predefined action space size to limit the number of actions after pruning.
[0049] (4.4) State transition: given state s t and action a t and the item representation passed by the time-aware system, the state transition is represented as:
[0050] s k+1 = δ(s t , a t ) = [u, h t+1 , e t+1 , e' t+2 ] (10)
[0051] (4.5) Reward function: the goal of reinforcement learning is to find user-item path instances and item-item path instances, in order to evaluate the quality of different paths and the flexibility of selection, a soft reward is used to achieve the above goal, the reward function is defined as:
[0052]
[0053] where v represents an item entity, V represents a set of item entities, T represents the maximum number of steps for path search; if the target entity is found before T steps, the reward is calculated, otherwise the reward is 0;
[0054] (4.6) Optimization strategy: the state information and action space are used to parameterize the path inference strategy, the state s t at time step t is [u, h t , e t , e' t+1 ], which contains the search history h t , a bidirectional LSTM is used to encode the state vector s t , the formula is as follows:
[0055]
[0056] where W1 is a linear parameter, the policy network π outputs the probability of each action in the pruned space
[0057]
[0058] where W a are linear parameters to be learned, in policy gradient methods, one hopes to optimize the policy by maximizing the cumulative reward. To improve training efficiency, a baseline is introduced to reduce variance, the value network M(s t ) maps the state vector x t to a real value in reinforcement learning as a baseline:
[0059] M(s t ) = x t W c (14)
[0060] where W c are linear parameters to be learned, the two networks are trained by maximizing the expected reward of any user u, which is optimized by the REINFORCE algorithm, which uses the following policy gradient update model parameters Θ:
[0061]
[0062] where R T denotes the discounted cumulative reward from state s t to the terminal state;
[0063] (4.7) Path representation learning: obtain candidate user-item and item-item path instances, represent the path data as where p i1 denotes the feature vector of path i at time step t, T i is the length of path i, the path data is input to the LSTM layer, the LSTM maps the input sequence to a fixed size embedding vector, whose calculation formula is as follows:
[0064]
[0065] where W LSTM is the weight matrix, h t-1 is the hidden state of the previous time step, the last hidden state output by the LSTM layer is represented as a path vector, and the path vector is transmitted to the time perception system as guidance information.
[0066] In the (5), the item prediction vector and the user vector finally obtained after multiple iterations are input into the multilayer perceptron to calculate the predicted score of the user-item:
[0067] r u,v = MLP (Concat (h u , h v(17) where MLP contains two hidden layers, using ReLU as activation function, and Sigmoid function as output layer;
[0068] The implicit feedback loss using negative sampling is used as the whole loss function:
[0069]
[0070] where represents the calculation of the expected value on the negative sample set, where P neg represents the distribution of negative samples, and j represents the sample drawn from the distribution.
[0071] The beneficial effects of the present application mainly manifest in: in view of the problems that the existing recommendation system ignores the historical dynamic time information and the insufficient explainability, the present application proposes an explainable sequence recommendation system fusing time perception and path reasoning, by introducing the dual-process theory, simulating the reasoning process of human thinking, capturing the time dependence characteristics in user purchase behavior, and further enhancing the accuracy and explainability of the recommendation system. BRIEF DESCRIPTION OF DRAWINGS
[0072] Figure 1 is a time sequence collaborative knowledge graph.
[0073] Figure 2 is a schematic diagram of the framework of the recommendation system. DETAILED DESCRIPTION
[0074] The present application will be further described below in conjunction with the drawings.
[0075] Referring to Figure 1 and Figure 2 , an explainable sequence recommendation method fusing time perception and path reasoning, comprising the following steps:
[0076] (1) Constructing a time sequence collaborative knowledge graph
[0077] According to the time stamp of the interaction record, the knowledge graph is sorted and sliced to form a series of ordered time snapshots, and these snapshots together constitute the time sequence collaborative knowledge graph. For example, Figure 1 shows the time sequence collaborative knowledge graph constructed based on the Amazon Beauty dataset, wherein each interaction record is accompanied by a time stamp, such as (B001MW1MK2, A2GJX2KCUSR0EI, 5, 1422316800), the interaction records are sorted by these time stamps, and the time snapshots are generated according to the time sequence interaction records of the user.
[0078] (2) Time sequence collaborative knowledge graph representation learning
[0079] The TransE is used for representing learning of the time sequence collaborative knowledge graph. Firstly, the normal distribution is used for initializing the parameter, the relation vector and the entity vector. Then, in the iterative training process, the closeness between the head entity vector plus the relation vector and the tail entity vector is evaluated according to formula (1), and then the vectors of the entity and the relation are updated according to the comparison result of the energy value and the preset threshold, and the vectors are optimized through formula (2). In each iteration, the gradient descent method is used to update the vectors, and when the preset number of iterations is reached, the training is stopped.
[0080] (3) Designing a time-aware system
[0081] The input path inference system generates multiple path vectors, the current time item vector and the user vector. The multiple path vectors are input into the path attention mechanism network, and the multi-path aggregation vector is obtained according to formulas (3) and (4). The learned multi-path aggregation vector and the item vector are input into the item attention mechanism network, and the time sequence features of the item are learned according to formula (5). The updated n-dimensional feature vector and the user vector are input into the MLP layer according to formula (6) to generate the item prediction vector and transmit it to the path inference system.
[0082] In particular, since there is no historical time sequence information before the first item, the user vector and the item vector are spliced according to formula (7), and the spliced vector is input into the MLP layer to generate the item prediction vector at this time.
[0083] (4) Designing a path inference system
[0084] The item prediction vector generated by the time-aware system is spliced with the search history vector, and the current state is input into the bidirectional LSTM to encode the state vector s t according to formula (12). The action a t is selected according to the current state s t and the strategy formula (13). The score function is used to calculate the score of each action, and all actions in the action space are sorted according to the score. The top ∈ actions are reserved in the pruned action space . The action is executed, and the agent executes the action a t in the environment. The environment returns the next state s t+1 according to formula (10), and calculates the reward of executing the current action according to formula (11). The obtained path is input into the LSTM network, and the path vector is obtained according to formula (16). The REINFORCE algorithm is used to calculate the policy gradient according to formula (15), and the policy network parameters are updated.
[0085] (5) Model training
[0086] First, the item prediction vector output by the time-aware system is transmitted to the path inference system for associated path inference, and then the multiple path vectors output by the path inference system, the item vector and the user vector of the current time step are input to the time-aware system to obtain the item prediction vector. The two systems work iteratively and complement each other to obtain the final item prediction vector. The vector is input into formula (17) to obtain the recommendation probability. Secondly, according to the loss function of formula (18), the loss between the calculated probability and the correct label in formula (17) is reduced, so that the calculated probability constantly approximates the correct label, thereby making the user and item prediction vectors more accurate. Then, the training process is continuously cycled, the loss is continuously reduced, the model converges, and finally the converged user vector and item prediction vector are used for recommendation.
[0087] The embodiments of the present specification are merely enumerations of implementation forms of the inventive concept, and are only used for the purpose of description. The protection scope of the present application should not be regarded as being limited to the specific forms presented in the present embodiments, and the protection scope of the present application also extends to equivalent technical means that can be thought of by those skilled in the art according to the inventive concept.
Claims
1. An interpretable sequence recommendation method integrating time awareness and path reasoning, characterized in that, The method includes the following steps: (1) Constructing a temporal collaborative knowledge graph The collaborative knowledge graph is sliced based on users' historical interaction information to obtain a series of ordered snapshots, thus establishing a temporal collaborative knowledge graph. The temporal collaborative knowledge graph TCKG is represented as follows: ,in This indicates that CKG is at time A snapshot, in which Indicates the head entity. Represents a set of entities. Represents a set of relations; (2) Learning the representation of knowledge graphs in a temporal collaborative manner The TransE translation model is used to embed entities and relations in TCKG. For a given... triples in ,in All have Dimensional embedding, i.e. Define the scoring function as follows: arrive The distance between them is calculated using the following formula: (1); The loss function for the relative order between positive and negative triples is defined as: (2); in ,and It replaces the tail entity with a random entity. The subsequent negative triplet, It is the sigmoid function; A set of user vectors is obtained through training. Item vector set { and relation vector set { ; (3) Design a time-aware system First, multiple path vectors are passed to the time-aware system. These paths reflect different user purchase preferences. A path attention mechanism is then used to aggregate these path vectors. The resulting aggregated multi-path vector better represents the complex relationships between entities. The calculation formula for the path attention mechanism is as follows: (3); (4); in yes , It is the softmax function. , , It is a path Related self-attention variables, It is a weight matrix. It is a dimension. It is a connection operation; After obtaining the multi-path aggregation vector, an item attention mechanism is used to combine the current item's own information with the path aggregation vector to incorporate historical time-series information and update the item vector at the current moment. The calculation formula for the item attention mechanism is as follows: (5); in This represents the initial representation of the current item. From the first The item to the A path instance for an item. It is a weight matrix. It's a deviation. yes ; The user vector and item vector are concatenated, and the concatenated vector is input into a multilayer perceptron to generate the item prediction vector for that moment. The calculation formula is as follows: (6); (4) Design a path reasoning system Guided by the item prediction vectors generated by the time-aware system, the path reasoning system performs associated path reasoning and then obtains the aforementioned multiple path vectors through path representation learning. The system uses a reinforcement learning framework to establish a reasoning environment, which provides the policy decision module with information on the current environment state and executable operations in the TCKG, and rewards the decision module based on the degree of matching between the current policy and user interaction. (5) Model training The two systems work iteratively and complement each other. The item prediction vector output by the time-aware system is passed to the path reasoning system for associated path reasoning. Then, the multiple path vectors output by the path reasoning system, along with the item vector and user vector at the current time step, are input into the time-aware system to obtain the item prediction vector. Once a well-trained model is obtained, accurate recommendation results can be provided to users.
2. The interpretable sequence recommendation method integrating time awareness and path reasoning as described in claim 1, characterized in that, In step (3), since there is no historical time sequence information before the first item, the user vector and the first item vector are concatenated, and the concatenated vector is input into the multilayer perceptron to generate the item prediction vector at that moment. The calculation formula is as follows: (7); The generated item prediction vectors are input into the path reasoning system for associated path reasoning.
3. The interpretable sequence recommendation method integrating time awareness and path reasoning as described in claim 1 or 2, characterized in that, The process described in (4) is as follows: (4.1) State: The initial state is In time step status ],in Represents the user entity. Indicates inclusion Step history ( , ), Indicates the entity in the current step. This indicates that the time-aware system is aware of time steps. The generated entity estimation vector; (4.2) Action: In time step The action is represented as ,in Indicates the next entity to be visited. Indicates the current entity and The relationship between them; (4.3) Pruning strategy: In order to improve model efficiency and control space complexity, it is necessary to perform effective inference while maintaining the maximum out-degree baseline of the action space. A scoring function is used to calculate the score for each action, defined as follows: (8); in This represents the dot product operation. yes Relational embedding during jumps involves sorting all actions in the action space according to their scores and retaining the top-ranked actions. The movement in the trimmed movement space In the context of , it is defined as: (9); in It is a predefined action space size used to limit the number of actions after pruning; (4.4) State transition: Given a state and actions And the state transition representation of the items transmitted by the time-aware system is as follows: [ ](10); (4.5) Reward Function: The goal of reinforcement learning is to find user-item path instances and item-item path instances. To evaluate the quality of different paths and the flexibility of selection, soft rewards are used to achieve the above goal. The reward function is defined as: (11); in Represents the physical entity of an item. Represents a set of item entities. This indicates the maximum number of steps in the path search; if in If the target entity is found before the step is taken, a reward will be calculated; otherwise, the reward will be 0. (4.6) Optimization Strategy: Parameterize the path reasoning strategy using state information and action space, time step status [Includes search history] A bidirectional LSTM is used to encode the state vector. The formula is as follows: (12); in It is a linear parameter, policy network Output in pruning space The probability of each action: (13); in These are linear parameters that need to be learned. In the policy gradient method, the aim is to optimize the policy by maximizing the cumulative reward. To improve training efficiency, a baseline is introduced to reduce variance. (Value network) The state vector Mapping to real values as a baseline in reinforcement learning: (14); in These are the linear parameters that need to be learned. Both networks are trained by maximizing the expected reward for any user u and optimized using the REINFORCE algorithm, which updates the model parameters Θ using gradients with the following strategy: (15); in Indicates from state The cumulative discount reward from start to finish; (4.7) Path Representation Learning: Obtain candidate user-item and item-item path instances, and represent the path data as follows: ,in Representing a path At time step eigenvectors, It is a path Given the length of the path data, the LSTM layer maps the input sequence to a fixed-size embedding vector. The calculation formula is as follows: (16); in It is a weight matrix. It is the hidden state of the previous time step, the last hidden state output by the LSTM layer. It is represented as a path vector, and the path vector is transmitted to the time-aware system as guidance information.
4. The interpretable sequence recommendation method integrating time awareness and path reasoning as described in claim 1 or 2, characterized in that, In step (5), the item prediction vector and user vector obtained after multiple iterations are input into the multilayer perceptron to calculate the user-item prediction score: (17); The MLP contains two hidden layers, using ReLU as the activation function and the Sigmoid function as the output layer; The implicit feedback loss using negative sampling is used as the entire loss function: ](18); in This indicates that the expected value is calculated over the negative sample set, where This represents the distribution of negative samples. This represents a sample drawn from the distribution.
Citation Information
Patent Citations
Multi-view attention recommendation algorithm based on binary information network
CN110968794A
Knowledge graph and time sequence feature fused interpretable interest point recommendation method
CN113656709A