Knowledge graph dynamic extension method based on knowledge graph and user behavior fusion
Through a dynamic expansion method based on LSTM and graph neural network, combined with the BERT model, a knowledge graph node that meets user interests is generated, which solves the cold start problem of traditional knowledge graphs in dynamic expansion, and realizes personalized spatial and temporal navigation path recommendations.
Patent Information
- Application Number
- CN202510544688.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-08-01
AI Technical Summary
Traditional knowledge graphs cannot be dynamically expanded to adapt to users' dynamic interests and multi-grained narrative needs. Rule-driven methods are costly to maintain and lack personalized adaptation. The collaborative filtering method ignores spatial and temporal consistency, and the user interest vector is not jointly optimized with the spatial and temporal attributes of the knowledge graph.
By collecting multi-dimensional user behavior data, capturing time dependence using LSTM network, generating user behavior feature vectors, filtering and adding nodes that meet user interests, updating the graph using graph neural network and attention mechanism, initializing unknown node features in combination with BERT model, and dynamically expanding the knowledge graph.
It realizes personalized spatial and temporal navigation path recommendation, solves the cold start problem of traditional knowledge graphs in dynamic expansion, and improves the user experience and personalized adaptability of the path.
Smart Images

Figure CN120407861A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of immersive interaction methods, and particularly relates to a method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior. Background Art
[0002] With the rapid development of knowledge graph technology and immersive interaction devices, cultural heritage digital tour systems have gradually shifted from static information display to dynamic personalized storytelling. Traditional tour systems mostly rely on predefined knowledge graphs and rule engines to implement path recommendations.
[0003] Early knowledge graphs used fixed ontology modeling, predefined entity relationships and could not be dynamically expanded. For example: when users focus on "the Silk Road in the Tang Dynasty", the system cannot dynamically load situational attributes such as economic policies and poetic images, resulting in rigid knowledge associations. Although the knowledge graphs established by such methods can ensure the rigor of knowledge logic, it is difficult to adapt to users' dynamic interests and multi-granularity narrative requirements. Traditional path generation technologies can be divided into two categories: rule-driven methods and collaborative filtering recommendation methods. Rule-driven methods are based on expert experience to predefine association rules to ensure the coherence of paths, but the cost of maintaining the rule base is high and they lack personalized adaptation capabilities; collaborative filtering methods recommend popular paths with high similarity to user behavior. Although such methods can capture the preferences of user groups, they ignore spatio-temporal consistency. Chen et al. proposed a user interest model based on LSTM, but its interest vector was not jointly optimized with the spatio-temporal attributes of the knowledge graph, resulting in the disconnection of the recommendation results from the knowledge logic. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior, which can dynamically generate spatio-temporal tour paths that meet the user's interest preferences.
[0005] The technical solution adopted by the present invention is a method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior, which is specifically implemented according to the following steps: Step 1, collect multi-dimensional user behavior data and perform cleaning and standardization; Step 2, use the long short-term memory neural network LSTM to model the data processed in Step 1, capture the time dependence and long-term relationship of user behavior, and generate a feature vector containing the user's historical behavior; Step 3, encode the existing nodes in the graph, initialize the features of the nodes not added to the graph, calculate the similarity between the user's historical behavior vector and all nodes, and select K nodes that meet the user's interest and add them to the candidate set; Step 4, add the new nodes and edges in the candidate set to the existing graph and train and update the parameters of the nodes in the new graph; Step 5: Output personalized path recommendations that match the user's interests and generate the final knowledge graph.
[0006] The features of the present invention also lie in: Specifically, Step 1 is: Read the data of the order in which the user clicks on the knowledge nodes in the knowledge graph and the user's stay time on a certain knowledge node, perform data cleaning and outlier processing, and aim to solve the problems of data scale difference and modality alignment. Perform multi-modal feature encoding and normalization on the cleaned data to obtain the user's historical behavior sequence data.
[0007] Specifically, data cleaning is: Convert the disordered time stream into a time-sequential behavior chain to ensure that the click sequence and the stay duration sequence are strictly aligned, delete the samples with null values or broken sequences, and determine the events with <100ms as misclicks, and determine the events with >10min as extreme values of non-active stays and delete them; specifically, multi-modal feature encoding is: Set the maximum sequence length according to the sample values , pad the sequences shorter than with trailing zeros, truncate the long sequences, perform embedding encoding on the knowledge nodes, count the occurrence frequencies of all nodes, construct a mapping table from nodes to integer encodings, and perform a normalization operation. , and perform normalization operations.
[0008] Specifically, Step 2 is: Encode the user's click sequence through the embedding layer to form an embedding vector; normalize the user's stay duration sequence into a weight value and concatenate it with the embedding vector to form the input vector of the LSTM. The specific formula is: (1) where, represents the embedding vector of node , represents the time the user stays on node , represents the normalized stay time weight, represents the concatenation operation, represents the input vector of the LSTM at time step formed by concatenating the node embedding and the stay time; The core of the LSTM cell is to update the hidden state through the gating mechanism and generate the output . The state update of the LSTM can be expressed as: (2) where, represents the hidden state of the previous time step, represents the hidden state of the current time step; capture the hidden state of the user's historical behavior data through the LSTM network, and take the hidden state of the last time step as the user interest vector: (3).
[0009] In step 3, the encoding of the existing nodes is specifically as follows: Assume that the known graph is represented as: , where represents the set of n existing nodes in the graph, represents the set of timestamped edges, is the interaction time; gradually update the feature representation of the known nodes through a multi-layer graph neural network. Each layer l corresponds to a process of updating node features. Its core role is to generate spatio-temporal aware node features by aggregating neighbor information and temporal features. The specific formula is: (4) represents the time encoding function, which converts the time difference into a vector using sine encoding: (5) represents the scaling factor, which is used to control the time sensitivity; represents the learnable parameter matrix; finally generate , representing the message vector from node containing node features and time information to node in the
[0010] Step 3 uses the attention mechanism to enable the model to dynamically adjust the contributions of different neighbor nodes: (6) (7) Among them, represents the learnable attention parameter vector, represents the attention weight of node to its neighbor node , represents node 's set of neighbors, represents the node features after aggregating neighbor messages; finally, use the GRU gating mechanism to balance the node's historical state and its neighbor-aggregated messages, so that while retaining the long-term dependence relationship, new information is incorporated to obtain .
[0011] The initialization of the unknown node features in step 3 is specifically as follows: The remaining nodes that are not connected to the graph are used to generate initial feature vectors through pre-trained text embeddings, enabling them to perform similarity calculations with the user interest vectors in step 2. The specific calculation is as follows: (8) Among them, represents the text description of node . represents the semantic vector generated by the BERT model. BERT maps the text to a semantic space aligned with the known node embeddings, making nodes with similar texts close in the vector space. Calculate the similarity between the generated semantic vector and the user interest vector and select the top K similar nodes. The similarity calculation formula is: (9) Among them, represents the similarity between node and the user interest vector. The higher the similarity, the more interested the user is in this node.
[0012] The method for screening candidate nodes of user interest in step 3 is: Set a threshold . When node , add node vi to the set of extended candidate nodes: (10)
[0013] Step 4 is specifically as follows: Add the nodes in the candidate set to the graph set and update the total number of nodes; Establish new edges based on user behavior: If the user clicks on candidate node , then add edge . If has a similarity exceeding the threshold with the known node , then add edge and update the adjacency matrix of the original edges and update the embeddings of the nodes connected to the new node through lightweight training: (11) Among them, is the learning rate, is the local loss function that only considers the influence of new edges: (12) Finally, update the message generation matrix : (14) Only need to adjust the subset of parameters related to the new node to avoid global retraining.
[0014] The beneficial effects of the present invention are The present invention is a knowledge graph dynamic expansion method based on the fusion of knowledge graph and user behavior. It uses LSTM network to encode the user's historical browsing trajectory and touch click sequence to generate a user behavior feature vector. Through this vector, nodes that meet the user's interests are screened and added to the knowledge graph, and a spatiotemporal navigation path that meets the user's interest preferences is dynamically generated. First, the user behavior sequence is generated by the order in which the user clicks on the knowledge nodes and the user's residence time on a certain knowledge node. Secondly, the user behavior sequence data is selected and forgotten using the LSTM long short-term memory network, and finally a feature vector containing the user's historical behavior is generated. The existing nodes in the graph are encoded, the unknown nodes are initialized, and the generated user interest vector is used to calculate its similarity with the unknown nodes. Similar nodes are added to the graph as new nodes and new edges are generated. Finally, the edge adjacency matrix and the message generation matrix are updated. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is a flow chart of the knowledge graph dynamic expansion method based on the fusion of knowledge graph and user behavior of the present invention. DETAILED DESCRIPTION
[0016] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0017] The present invention provides a knowledge graph dynamic expansion method based on the fusion of knowledge graph and user behavior, such as Figure 1 As shown, the specific implementation steps are as follows: Step 1: Data preprocessing Collect multi-dimensional user behavior data and clean and standardize it; Step 2: User behavior capture Use the long short-term memory (LSTM) neural network to model the data processed in step 1, capturing the temporal dependencies and long-term relationships of user behaviors and generating a feature vector containing the user's historical behaviors. Step 3: Candidate node calculation Encode the existing nodes in the graph, initialize the features of the nodes that have not been added to the graph, calculate the similarity between the user's historical behavior vector and all nodes, and select K nodes that meet the user's interests to add to the candidate set; Step 4: Dynamic expansion and update of the graph Add the new nodes and edges in the candidate set to the existing graph and train and update the parameters of the nodes in the new graph; Step 5: Output the results Output personalized path recommendations that meet user interests and generate the final graph.
[0018] Example 1 A dynamic expansion method of knowledge graph based on the fusion of knowledge graph and user behavior, in which step 1 is specifically: reading the data of the order in which users click on knowledge nodes in the graph and the time users stay on a certain knowledge node, and performing data cleaning and outlier processing, with the goal of solving data scale differences and modal alignment problems, performing multimodal feature encoding and normalization on the cleaned data to obtain user historical behavior sequence data.
[0019] Multi-dimensional user behavior data, including: the order in which users click on knowledge nodes; the time users stay on a certain knowledge node. All data are cleaned, the data with missing features are removed, and then the numerical features are normalized. The normalized user behavior data is used as input data, i.e. training data, and the training data is used. represents the set of normalized user click sequence encodings, Represents the set of normalized user stay duration sequence codes.
[0020] Data cleaning is specifically to convert disordered time streams into time-series behavior chains to ensure click sequences and dwell time sequence Strict alignment, delete samples with null values or broken sequences, Events <100ms are considered accidental clicks. Events >10 minutes are considered as extreme values of inactive stay and are deleted; multimodal feature encoding is specifically as follows: the maximum sequence length is set according to the sample value , for shorter than The sequence is padded with zeros at the end, long sequences are truncated, knowledge nodes are embedded and coded, the frequencies of all nodes are counted, a mapping table from nodes to integer codes is constructed, and normalization is performed, specifically: (1) in, Indicates the The frequency value of the knowledge node, Represents the normalized click sequence data. Distribution calibration to obtain pre-processed user click event sequence data Sequence data of user stay time .
[0021] Example 2 The knowledge graph dynamic expansion method based on the fusion of knowledge graph and user behavior, wherein step 2 is specifically: convert the user click sequence Encode through the embedding layer to form an embedding vector; Sequence the user's stay time Normalize it into weight values and concatenate them with the embedding vectors to form the input vector of the LSTM. The specific formula is as follows: (2) Among them, represents the embedding vector of node , represents the time the user stays on node , represents the normalized weight of the stay time, represents the concatenation operation, represents the input vector of the LSTM at time step , which is composed of the node embedding and the stay time concatenated; The LSTM consists of a forget gate, an input gate, and an output gate. Its core is to selectively forget historical information through the gate unit, update the hidden state, and capture the time dependencies of long sequences. The specific formula is as follows: (3) Among them, represents the memory cell at time t, represents the output of the forget gate, represents the output of the input gate, represents the output of the output gate, represents the element-wise product. Through the LSTM network, the hidden state of the user's historical behavior data is captured. This state contains the user's behavior information at this moment and the previous time steps, updates the hidden units at each moment of the sequence, and takes the hidden state of the last time step as the user interest vector: (4).
[0022] Example 3 A method for dynamically expanding a knowledge graph based on the fusion of a knowledge graph and user behavior. In step 3, based on the temporal interaction data of the dynamic knowledge graph, candidate node representations with fused timeliness characteristics are generated through a multi-layer spatio-temporal graph neural network. The core processing flow is as follows: Construct initial features containing static attributes and dynamic contexts for each graph node: Assume that the known graph is represented as: , where represents the set of n existing nodes in the graph, represents the set of timestamped edges, The interaction time. The graph neural network is used to iteratively optimize the node features. Each layer of the network integrates the structural association and interaction time-effect information of neighboring nodes through a spatio-temporal fusion mechanism. Specifically: calculate the time difference between the current time and the historical interaction time, and use a periodic sine function to map the time difference into a high-dimensional vector. This encoding process can capture the time decay effect. For example, the time encoding value of recent interactions is larger, while the encoding value of long-term interactions gradually decays with the periodic fluctuations. Then, concatenate the current node features, neighbor node features, and the time encoding vector, and perform a non-linear transformation on the concatenated information through a trainable weight matrix to generate a message vector containing both spatio-temporal attributes. This process enables the message to not only express the semantic association between nodes but also quantify the newness and oldness of interaction behaviors. The specific calculation is as follows: (5) (6) Among them, represents the feature vector of node in the th layer and node ; represents the difference between the current time and the interaction time of edge ; represents the time encoding function, represents the scaling factor used to control the time sensitivity; represents the learnable parameter matrix; finally generate , which represents the message vector from node containing node features and time information to node in the th layer.
[0023] Example 4 A method for dynamically expanding a knowledge graph based on the fusion of a knowledge graph and user behavior. In step 3, according to the semantic importance of spatio-temporal messages, adaptively adjust the contribution weights of different neighbors: perform a non-linear transformation on the message vector of each neighbor, take the inner product with the learnable attention parameter vector, and obtain the weight value through normalization. Based on the attention weights, perform a weighted sum of the neighbor messages to generate an aggregated feature representation. This feature not only retains local structural information but also strengthens the interaction patterns with strong timeliness. The specific calculation process is as follows: (7) (8) Among them, represents the learnable attention parameter vector, represents the attention weight of node to neighbor node , represents node Set of neighbors of Represents the node features after aggregating neighbor messages. Finally, the GRU gating mechanism is used to balance the node's historical state and the current spatio-temporal aggregation information to achieve dynamic feature update: (9) Represents the final node output, Encoding the importance of the node in the graph structure and temporal evolution.
[0024] Example 5 A method for dynamically expanding a knowledge graph based on the fusion of a knowledge graph and user behavior. In step 3, according to the existence state of the node in the graph, the correlation between it and the user interest vector is calculated differentially: for known nodes, the spatio-temporal perception feature vector is generated using step 3, and for unknown nodes, BERT is used to generate an initial semantic vector, and feature initialization is achieved through semantic alignment and similarity matching. The specific process is as follows: For nodes not connected to the graph, a pre-trained language model (BERT) is used to encode their text description information to generate a semantic vector with the same dimensionality as the feature space of known nodes: (10) Represents the node Text description of Represents the semantic vector generated by the BERT model. The output layer of the BERT encoder is fine-tuned so that the generated text vector is in the same metric space as the user interest vector and the feature vectors of known nodes in the graph in step 2, and similarity calculation can be directly performed. The similarity between the generated semantic vector and the user interest vector is calculated and the top K similar nodes are selected. The similarity calculation formula is: (11) Where, Represents the user interest vector in step 2. Since the nodes in the graph have been accessed by the user, the K nodes with the highest similarity are selected from the remaining nodes to enter the candidate set. The screening method is: set a similarity threshold , when the similarity of the node is higher than this threshold, it means that the node may meet the user's interest, and thus the node is selected as a candidate expansion node. This screening process ensures that only those nodes most relevant to the user's interest are selected to enter the expansion candidate set: (12) Among the nodes screened by the threshold, the top-K nodes with the highest similarity are selected and added to the candidate set.
[0025] Example 6 A method for dynamically expanding a knowledge graph based on the fusion of a knowledge graph and user behavior. In step 4, the selected Top-K candidate nodes are added to the graph node set, the global node scale is expanded, and new edges are established according to the real-time behavior of the user: If the user clicks on a candidate node then an edge is added , if the similarity with a known node exceeds the threshold, then an edge is added and the adjacency matrix of the original edge is updated. Finally, the constructed new graph is updated, and the method initialized in step 3 is used to generate an initial embedding for the new node, and the embeddings of the nodes connected to the new node are updated through lightweight training: (13) is the learning rate, is the local loss function that only considers the influence of new edges: (14) Finally, update the message generation matrix : (15).
[0026] Example 7 A method for dynamically expanding a knowledge graph based on the fusion of a knowledge graph and user behavior. In step 5, based on the user behavior trajectory and the structure of the dynamically expanded graph, a user-specific temporal knowledge graph is generated in real time, including: the weight of the newly added edge reflects the latest interaction intensity, and the newly established implicit edge reveals potential interest associations.
[0027] By deeply mining the implicit association between user behavior characteristics and the knowledge graph, the present invention establishes a knowledge expansion mechanism based on dynamic attention weights, which can realize the adaptive evolution of the graph structure and effectively solve the cold start problem faced by traditional knowledge graphs in the process of dynamic expansion. Establishing a knowledge expansion mechanism based on dynamic attention weights can realize the adaptive evolution of the graph structure and effectively solve the cold start problem faced by traditional knowledge graphs in the process of dynamic expansion. It can provide dynamic knowledge support for fields such as intelligent recommendation, multi-, and decision support systems.
Claims
1. A method for dynamically expanding a knowledge graph based on the fusion of a knowledge graph and user behavior, characterized in that The implementation is specifically carried out according to the following steps: Step 1: Collect multi-dimensional user behavior data and perform cleaning and standardization; Step 2: Use the long short-term memory neural network (LSTM) to model the data processed in Step 1, capture the temporal dependence and long-term relationships of user behavior, and generate a feature vector containing the user's historical behavior; Step 3: Encode the existing nodes in the graph, initialize the features of the nodes not yet added to the graph, calculate the similarity between the user's historical behavior vector and all nodes, and select K nodes that match the user's interests and add them to the candidate set; Step 4: Add the new nodes and edges in the candidate set to the existing graph and train to update the parameters of the nodes in the new graph; Step 5: Output personalized path recommendations that match the user's interests and generate the final graph.
2. The method for dynamically expanding a knowledge graph based on the fusion of a knowledge graph and user behavior according to claim 1, wherein Specifically, Step 1 is as follows: Read the data of the order in which the user clicks on the knowledge nodes in the graph and the user's stay time on a certain knowledge node, and perform data cleaning and outlier processing. Aiming to solve the problems of data scale difference and modal alignment, perform multi-modal feature encoding and normalization on the cleaned data to obtain the user's historical behavior sequence data.
3. The method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior according to claim 2, wherein The specific data cleaning process is as follows: convert the unordered time stream into a time-series behavior chain to ensure that the click sequence and the dwell time sequence are strictly aligned, delete samples with null values or broken sequences, and events less than 100ms are determined as misclicks, and events greater than 10 minutes are determined as extreme values of non-active dwell and deleted; the multi-modal feature encoding is specifically as follows: set the maximum sequence length according to the sample value , for sequences shorter than , pad the sequences with trailing zeros, truncate long sequences, perform embedding encoding on knowledge nodes, count the occurrence frequencies of all nodes, construct a mapping table from nodes to integer encodings, and perform a normalization operation.
4. The method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior according to claim 1, wherein The specific content of step 2 is as follows: the user click sequence is encoded through the embedding layer to form an embedding vector; the user stay duration sequence is normalized into a weight value and concatenated with the embedding vector to form an input vector of the LSTM. The specific formula is as follows: (1) Among them, represents the embedding vector of the node , represents the time the user stays at the node , represents the normalized time-stay weight represents the concatenation operation represents the input vector of the LSTM at time step , which is composed of the concatenation of the node embedding and the time stay The core of the LSTM cell updates the hidden state through a gating mechanism and generates an output , and the state update of the LSTM can be expressed as: (2) Among them, represents the hidden state of the previous time step, represents the hidden state of the current time step; capture the hidden state of the user's historical behavior data through the LSTM network, and take the hidden state of the last time step as the user interest vector: (3)。 5. The method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior according to claim 1, characterized in that In step 3, the existing node codes are specifically as follows: Assume that the known graph is represented as: , where represents the set of n existing nodes in the graph, represents the set of edges with timestamps, is the interaction time; the feature representation of the known nodes is gradually updated through a multi-layer graph neural network. Each layer l corresponds to a process of updating node features. Its core function is to generate spatio-temporal aware node features by aggregating neighbor information and temporal features. The specific formula is: (4) Represents a time encoding function that converts the time difference into a vector using sine encoding: (5) Represents a scaling factor used to control time sensitivity; Represents a learnable parameter matrix; finally generated , represents the slave node in the layer that contains node features and time information message vector to node 6. The method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior according to claim 1, characterized in that In Step 3, the attention mechanism is used to enable the model to dynamically adjust the contributions of different neighbor nodes: (6) (7) Among them, represents a learnable attention parameter vector, represents the node 's attention weight for neighbor nodes . represents the set of neighbors of the node ; represents the node feature after aggregating neighbor messages; finally, the GRU gating mechanism is used to balance the node's historical state and its neighbor-aggregated messages, so that while retaining long-term dependencies, new information is incorporated to obtain .
7. The method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior according to claim 1, characterized in that Specifically, the initialization of the features of the unknown nodes in Step 3 is as follows: Generate the initial feature vectors for the remaining nodes not connected to the graph through pre-trained text embeddings, so that they can calculate the similarity with the user interest vector in Step 2. The specific calculation is as follows: (8) Among them, represents the text description of the node, represents the semantic vector generated by the BERT model. BERT maps the text to a semantic space aligned with the known node embeddings, so that nodes with similar texts are close in the vector space; calculate the similarity between the generated semantic vector and the user interest vector and select the top K similar nodes. The similarity calculation formula is: (9) Among them, represents the similarity between a node and the user interest vector. The higher the similarity, the more interested the user is in the node.
8. The method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior according to claim 6, characterized in that The method of screening candidate nodes of interest to the user in step 3 is as follows: Set a threshold value , when the node , add the node vi to the set of extended candidate nodes: (10)。 9. The method for dynamically expanding a knowledge graph based on the integration of a knowledge graph and user behavior according to claim 1, wherein Step 4 specifically includes: adding the nodes in the candidate set to the graph set and updating the total number of nodes; establishing new edges based on user behavior: if the user clicks on a candidate node then add an edge , if the similarity with a known node exceeds the threshold, then add an edge and update the adjacency matrix of the original edges and update the embeddings of the nodes connected to the new node through lightweight training: (11) Among them, is the learning rate, is the local loss function that only considers the influence of new edges: (12) Final update message generation matrix : (14) Only need to adjust the subset of parameters related to the new nodes to avoid global retraining.
Citation Information
Cited By
Manual navigation method and system based on knowledge graph
CN120975202A
Regional culture visual element dynamic reconstruction method and system based on mapping knowledge domain
CN121009963A