A Method for Constructing a Spatiotemporal Knowledge Graph Oriented to User Intentions

By building a space-time knowledge graph for user intentions, combining user travel intentions and mobile behavior laws, unified preference characteristics are generated, and the problem of data sparseness and intention fusion in the existing model is solved, and a higher accuracy of position prediction is achieved.

CN115827898BActive Publication Date: 2025-07-29NANKAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211692521.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-28
Publication Date
2025-07-29
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

The existing location prediction model cannot effectively integrate user travel intentions, resulting in data sparseness problems and affecting prediction accuracy.

Method used

Build a space-time knowledge graph for user intentions, combine user travel intentions and mobile behavior laws through attention networks to generate unified preference characteristics, and use the translated knowledge graph model to predict positions.

Benefits of technology

It improves the accuracy of location prediction, alleviates data sparseness, and accurately matches user travel goals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115827898B_ABST
    Figure CN115827898B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of data mining, and specifically relates to spatio-temporal data of social networks based on location services, especially a method for constructing a spatio-temporal knowledge graph oriented to user intentions. The method includes the following steps: Step 1, data collection and preprocessing thereof, and then constructing IDs of users, locations, categories, time slots, and geographical location encodings that can be directly input into the model; Step 2, using the preprocessed data to establish an access sequence vector and construct a user travel intention vector; Step 3, constructing a spatio-temporal knowledge graph model to generate corresponding triples (u, (rseq, rpur), v), which are used to record that after the user u has a mobile behavior rseq, according to the travel intention purpose rpur, the location v is accessed; Step 4, performing location prediction according to the historical access sequence and travel intention of a given user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data mining, and specifically relates to spatio-temporal data of social networks based on location services, and particularly to a method for constructing a spatio-temporal knowledge graph for user intentions. Background Art

[0002] With the increasing development and popularity of intelligent devices, mobile communication has penetrated all aspects of daily life. People can share experiences or obtain required information on social networks at any time. By using intelligent mobile terminals with GPS positioning, 3 / 4 / 5G / Wifi signal sensing functions, it has become simple and convenient to obtain and record the current location coordinates. Many users like to publish their physical locations in the form of "check-ins". And many mobile terminal applications, such as taxi rides, food delivery, and online shopping, etc., require users to provide personal location information. Therefore, in location-based service social networks, a large amount of user footprint data is being generated and collected. Such data contains rich spatio-temporal attributes and reflects diverse movement behavior patterns of the crowd. These data are widely applied in fields such as smart cities, mobile computing, and trajectory prediction, attracting the enthusiastic attention of researchers in academia and industry. The semantic information carried by spatio-temporal data reflects the travel purpose of users during the activity process, that is, the driving factors for users to move between different locations. Therefore, modeling and learning the change patterns of these behaviors can effectively help people predict mobile locations, thereby optimizing various location-aware services and applications in life, such as public health epidemic prevention, location recommendation, route planning, and user behavior prediction, etc.

[0003] Location prediction is a common and important branch in spatio-temporal data mining. Its goal is to capture various different forms of movement behaviors and personal access preferences of users based on the user's historical access records and other relevant information, so as to predict the locations that the user may visit in the future. Location prediction includes a series of subtasks, such as traditional location prediction, next access location prediction, trajectory prediction, location prediction in known regions, etc. These tasks mainly learn the preferences on the entire location candidate set, ignoring the user's current travel intention and the personalized characteristics of different types of locations, while users usually filter out locations irrelevant to the selected type according to the target they hope to visit.

[0004] In addition, the multi-source heterogeneity of spatio-temporal data, the sparse distribution of user check-in records, and the complexity of mobile behavior patterns limit the location prediction method to a certain extent. The problems of low utilization and insufficient mining of spatio-temporal attributes lead to the inability of the data structure of existing models to fully display the behavior patterns of users, resulting in less satisfactory prediction results. Therefore, how to better utilize spatio-temporal attributes and how to solve data sparsity remain key issues that cannot be ignored in location prediction. Knowledge graph is a mainstream branch technology of current artificial intelligence, which encodes the structured information of entities and their relationships in the form of triples (head entity, relation, tail entity). The knowledge graph model based on translation satisfies the condition of the triangle inequality and can greatly alleviate the problem of data sparsity. In the location prediction scenario, both users and locations can be regarded as entities, and spatio-temporal context can be modeled as translation vectors operating on user and location entities. However, the current location prediction model based on knowledge graph cannot fuse the travel intentions of users.

[0005] In summary, the construction of a spatio-temporal knowledge graph oriented to user intentions is an innovative research idea with important research significance and application value. Summary of the Invention

[0006] The purpose of the present invention is to start from the actual application of the location prediction task in real life, and in view of the needs of user travel intentions and the diversity of individual mobile behavior patterns, a method for constructing a mobile behavior knowledge graph integrating spatio-temporal information is proposed. This method takes the knowledge graph based on translation as the framework, and at the same time considers user travel intentions and mobile behavior patterns, so as to achieve the purpose of improving the accuracy of predicting the future visited locations of users.

[0007] A method for constructing a spatio-temporal knowledge graph oriented to user intentions, which constructs a knowledge graph mobile behavior graph integrating spatio-temporal information. First, the spatio-temporal data in the geographical social network is formed into a graph representation integrating multiple attributes, and at the same time, the travel intentions of users and the patterns of mobile behavior are captured. The attention network combines these two parts to generate unified preference features, and based on this feature and historical visit records, the locations that users may visit in the future are predicted.

[0008] To achieve the above object, the present invention provides the following technical solutions:

[0009] A method for constructing a spatio-temporal knowledge graph oriented to user intentions, the specific steps are as follows:

[0010] Step 1: Collect data and preprocess it, and then construct IDs for users, locations, categories, time slots, and geographical location encodings that can be directly input into the model;

[0011] Step 2: Use the preprocessed data to establish an access sequence vector and construct a user travel intention vector;

[0012] Step 3: Construct a spatio-temporal knowledge graph model to generate corresponding triples (u, (r seq , r pur ), v), which are used to record that after user u performs movement behavior r seq , according to travel intention purpose r pur , location v is visited;

[0013] Step 4: Perform location prediction based on the historical access sequence and travel intention of a given user.

[0014] For further optimization of this technical solution, the specific steps of the first step are as follows:

[0015] Step 1.1: Data collection, obtaining data from a location-based social network;

[0016] Step 1.2: Data processing. After data collection, the original data needs to be preprocessed. The attribute information involved in the preprocessed check-in records includes: user ID, location ID, category ID, time slot ID, and geographical location vector;

[0017] Step 1.3: Data reconstruction

[0018] Definition 1: Embedding vector of spatio-temporal knowledge graph nodes, defined as follows:

[0019] Set U = {u1, u2,..., u |U|}, V = {v1, v2,..., v |V|}, and C = {c1, c2,..., c |C|} respectively represent the vector sets of users, locations, and location categories. Among them, vectors and d u , d v , d c are the dimensions of the three types of vectors respectively;

[0020] Definition 2: Each location represents a specific geographical location, and each location belongs to a category

[0021] Definition 3: Check-in record. Each check-in activity is a triple (u, v, t), representing that user u visits location v at time t;

[0022] Definition 4: Check-in sequence. The check-in sequence is a set of check-in records of a specific user arranged in chronological order.

[0023] For further optimization of this technical solution, the specific steps of the second step are as follows:

[0024] Step 2.1: Establish an access sequence vector using the preprocessed historical check-in records

[0025] Personalized attention is used to capture the different attentions of users to different historical check-ins. For each record in the user check-in sequence, it is defined as follows:

[0026]

[0027] where v i and t i represent the location and time visited by the user in this record s respectively, concat(·) is a concatenation function, w represents the trained parameter, and loc(·) is a geocoding method;

[0028] Since the number of a user's historical records is too large and cannot reflect the current mobility of the user, the most recent n fixed historical record windows are intercepted. Given the most recent check-in record The current historical record of the user can be uniquely encoded as:

[0029]

[0030] where f(·) represents an aggregation operation used to aggregate L historical records into a vector representation, and α represents a trainable vector independent of the user to obtain a global transfer bias;

[0031] Step 2.2: Construct a user travel intention vector

[0032] When a user decides on a travel destination, they often choose a type, and each location in the dataset has an associated category c i , which exactly matches the user's travel purpose requirements. Therefore, it can be directly used as the user travel intention vector, and the category is represented as follows:

[0033]

[0034] where n c represents the number of user travel intention vectors, and d represents the vector dimension. Therefore, the user travel purpose r pur can be expressed as:

[0035] r pur = c i .

[0036] For further optimization of this technical solution, the specific steps of the third step are as follows:

[0037] Step 3.1: Construct a spatio-temporal knowledge graph model

[0038] The knowledge graph model based on translation treats entities and relationships in the knowledge graph as two matrices. The entity matrix structure is n×d, where n represents the number of entities and d represents the dimension of each entity vector. Each row in the matrix represents the word vector of an entity; while the relationship matrix structure is r×d, where r represents the number of relationships and d represents the dimension of each relationship vector. In the ideal state of the model after training, a vector is extracted from the entity matrix and the relationship matrix respectively, and the L2 norm operation is performed:

[0039]

[0040] a i can represent any vector;

[0041] The knowledge graph model embeds the triple (h, r, t) into a transition space that satisfies h + r ≈ t, where h, r, and t represent the head, relationship, and tail entities. In the mobile behavior learning scenario, both the user and the location can be regarded as "entities". Therefore, the relationship between user u and location v is defined as:

[0042]

[0043] To avoid overfitting and the problem of too large learning model parameter values, a constrained canonical embedding is added: v, r, with ||u||2 ≤ 1, ||v||2 ≤ 1, and ||r||2 ≤ 1;

[0044] According to the above access sequence vector representing the user's movement behavior and the user travel intention vector of the travel purpose, the corresponding triple (u, (r seq , r pur ), v) can be generated, which is used to record that after user u's movement behavior r seq , according to the travel intention purpose r pur , the location v is visited;

[0045] Step 3.2, Representation of User Check-in Behavior and Travel Purpose

[0046] To capture the importance of two relationships, relational-level attention is applied to calculate the influence of weights:

[0047]

[0048] Among them, MLP r (·) is a two-layer neural network that takes the concatenation of the user vector and the relationship vector as input, and then obtains the degree of importance that the user attaches to this relationship;

[0049] Step 3.3, User Location Prediction Learning Objective

[0050] Given the defined score function fr (u, v), the goal of user location prediction learning is:

[0051]

[0052] where γ is the margin, D and D' are sets of positive and negative samples of triples, and u, u' and v, v' represent positive / negative users and positive / negative locations respectively. Negative samples are obtained by randomly replacing the user or location in the positive sample.

[0053] For further optimization of this technical solution, the specific steps of the 4th step are as follows.

[0054] Predict the location v of user u visiting category c according to the historical visit sequence and travel intention of the given user u c The probability of is:

[0055]

[0056] By calculating the probabilities of all locations under category c, the probability of the user's interest in each location can be obtained, and thus the n locations that it may be most interested in can be obtained, which are returned as the location prediction result.

[0057] Different from the prior art, the above technical solution has the following beneficial effects:

[0058] 1) The present invention creatively proposes a method for constructing a spatio-temporal knowledge graph for user travel intentions. Compared with the previous method of modeling the input of the location prediction model by taking check-in records in matrix form or graph structure, the present invention uses the unique triple form of the knowledge graph to represent each record, greatly alleviating the data sparsity problem.

[0059] 2) The present invention conducts unique encoding and parsing for geographical locations respectively. This encoding can uniquely represent any location on the earth, and the encoding sequences of locations closer to each other are more similar. It is more accurate in capturing longitude and latitude positions than previous models, facilitating fitting the characteristics of the user's activity range around a location center.

[0060] 3) The present invention considers the time periodicity of user movement behavior, models time as 24*7 vectors, and independently represents the characteristics of 24 hours of each day in a week, covering time attributes more comprehensively.

[0061] 4) Considering user travel intentions, the present invention more accurately matches real-world needs. Using the movement behavior graph to model the attention network and the corresponding location prediction model, it realizes the construction of the behavior movement graph for user travel goals. Relevant experiments prove that this model can improve the accuracy of location prediction. Description of the Drawings

[0062] Figure 1Schematic diagram of a spatio-temporal knowledge graph oriented to user intentions;

[0063] Figure 2 Schematic diagram of the knowledge graph joint attention network model framework for location prediction;

[0064] Figure 3 Flowchart of the method for constructing a spatio-temporal knowledge graph oriented to user intentions;

[0065] Figure 4 User statistics in the cities of New York, Tokyo, and Istanbul in the location service dataset Foursquare;

[0066] Figure 5 Schematic diagram of the sequence-aware personalized attention network;

[0067] Figure 6 Schematic diagram of relation-level attention learning;

[0068] Figure 7 Schematic diagram for comparing location prediction results of three cities. Detailed implementation manners

[0069] To elaborate in detail on the technical content, structural features, achieved objectives, and effects of the technical solution, the following will be described in detail in conjunction with specific embodiments and with reference to the accompanying drawings.

[0070] The construction of the spatio-temporal knowledge graph mainly includes two parts. One is to construct a graph representation of user movement behaviors using spatio-temporal data. Refer to Figure 1 as shown, which is a schematic diagram of a spatio-temporal knowledge graph oriented to user intentions; the other is to construct a location prediction model based on the spatio-temporal knowledge graph. This model consists of a translation-based knowledge graph and a sequence-aware attention network. The framework of the model is as Figure 2 shown, which is a schematic diagram of the knowledge graph joint attention network model framework for location prediction.

[0071] From the collection of user check-in data to the generation of the final location prediction results, it is divided into 4 steps in total. The flowchart is as Figure 3 shown, which is the flowchart of the method for constructing a spatio-temporal knowledge graph oriented to user intentions. The following will further illustrate the implementation process of this patent in conjunction with specific datasets.

[0072] Step 1: Collection and preprocessing of location service data

[0073] 1.1 Data collection

[0074] Using the data of three cities (New York, Tokyo, and Istanbul) in the location-based social network Foursquare as the object of training and prediction, the user check-in records are extracted as the original data for constructing the mobile behavior map. Among them, the Foursquare data uses the dataset provided by Dingqi Yang et al. This dataset provides user check-in data from April 2012 to January 2014, and the data of three of these cities are selected as the research object. Refer to Figure 4 As shown, it is a schematic diagram of the user data situation in the three cities.

[0075] 1.2 Data Processing

[0076] After data collection, the original data needs to be preprocessed for input into the model. Since the spatio-temporal knowledge graph for user intent is constructed on a user-by-user basis, the check-in records can be grouped by user ID. The specific process is as follows:

[0077] - The check-in time is sliced into different time intervals, i.e., time slots, according to the selected granularity. Each specific time can be mapped to the corresponding time slot, and finally, the check-in specific time can be represented by the time slot ID.

[0078] - The location information of the check-in location is represented by a unique encoded sequence. Based on the longitude and latitude involved in all check-in locations in the obtained data, the longitude and latitude are respectively input into the encoder, and then a unique sequence is obtained. The closer the locations are, the more similar the sequences are.

[0079] - The attribute information involved in the preprocessed check-in records includes: user ID, location ID, category ID, time slot ID, and geographical location vector.

[0080] In each dataset, the time slots are divided and the geographical location vectors are obtained according to the above method. The specific method is to divide the time into 168 time slots with a weekly cycle (24 * 7 = 168). The specific access time in the user check-in records is mapped to the time slots, and the check-in time information is represented by the corresponding time slot ID. The longitude and latitude are input into the encoder to generate a twelve-digit location sequence, and then the time sequence is input into the neural network to generate a unique vector to represent the location information.

[0081] 1.3 Data Reconstruction

[0082] In the three datasets, the proportions of the training set and the test set are 80% and 20% respectively. And to ensure the task requirements of predicting future visited locations, for the access records that appear in the test set, their locations will not appear in the training set, and the access times are all after the training set.

[0083] Definition 1: The embedding vector of the spatio-temporal knowledge graph node is defined as follows:

[0084] The set U = {u1, u2, …, u |U|}, V = {v1, v2, …, v |V|}, and C = {c1, c2, …, c |c|} represent the vector sets of users, locations, and location categories (user intentions) respectively. Among them, the vectors and d u 、d v 、d c are the dimensions of the three vectors respectively.

[0085] Definition 2: Each location represents a specific geographical location (e.g., XX Restaurant or XX Museum). Each location belongs to a category

[0086] Definition 3: Check-in record. Each check-in activity is a triple (u, v, t), representing that user u visits location v at time t.

[0087] Definition 4: Check-in sequence. The check-in sequence is a set of check-in records of a specific user arranged in chronological order.

[0088] Step 2: Establish the sequence access vector and travel intention vector

[0089] In the scenario of spatio-temporal movement behavior modeling considered in the present invention, each user corresponds to a set of graphs. According to the settings in Step 1, the information of each user in each dataset is composed of all the check-in records of the user. And in each record, the historical sequence representation of the user's visit and the user's travel intention are an indispensable part of the user portrait. Therefore, the key problem lies in how to better combine the spatio-temporal context in the historical trajectory and the user's intention.

[0090] Therefore, this part will be described from two parts: the construction of the historical access vector and the construction of the user travel intention vector.

[0091] Step 2.1: Establish the access sequence vector using the preprocessed historical check-in records

[0092] The sequential regularity of the user's visit is of great significance for learning their personalized preferences. The more recent the historical record, the greater the impact on the result of predicting the user's location, that is, the impact of the historical record on the user's current visit is negatively correlated with the interval time. Inspired by the success of the user-item interaction representation in the project recommendation field, the historical sequence behavior is considered here to construct a vector with an adaptive relationship.

[0093] The attention mechanism is a resource allocation scheme that, in the case of limited computing power, allocates computing resources to more important tasks while solving the problem of information overload. In neural network learning, generally speaking, the more parameters a model has, the stronger its expressive power and the larger the amount of information it stores. However, this will bring the problem of information overload. By introducing the attention mechanism, focusing on the information that is more crucial for the current task among numerous input information, reducing the attention to other information, and even filtering out irrelevant information, the problem of information overload can be solved, and the efficiency and accuracy of task processing can be improved.

[0094] By adopting personalized attention, the model can capture the different attentions of users to different historical check-ins, so as to more comprehensively learn the impact of the user's historical access sequence on location prediction. The overall processing flow is as Figure 5 shown. Each record in the user check-in sequence needs to be constructed according to the following method:

[0095]

[0096] where v i and t i represent the location and time visited by the user in this record s respectively. concat(·) is a concatenation function, and w represents the trained parameter. loc(·) is a geocoding method. Here, the encoding method of open location code is adopted. First, the latitude and longitude location is converted into a string sequence, and then the recurrent neural network is used to learn this sequence to obtain a unique n-dimensional vector encoding as the representation of the geographical location.

[0097] In reality, there are many users who have visited hundreds or thousands of locations. Historical records that are too old may not have reference value. This is the classic long-tail problem. Since the number of a user's historical records is too large and cannot reflect the current mobility of the user, the historical sequence intercepts the most recent n fixed historical record windows. Given the most recent check-in record the user's current historical record can be uniquely encoded as:

[0098]

[0099] where f(·) represents an aggregation operation used to aggregate L historical records into a vector representation, and α represents a trainable vector independent of the user to obtain a global transfer bias to make the result more accurate. There are various ways to choose for the aggregation operation. In order to capture the different importance of historical records in different orders, an adaptive and position-aware personalized attention mechanism is adopted. The overall processing flow is as Figure 5 shown, which can take into account both the location necklace and the sequence order, and finally can obtain the dynamic preference of the user.

[0100] Step 2.2: Construct the user travel intention vector

[0101] Before a user travels, there is always a final destination. For example, when the movie "Harry Potter" is re-released, Xiaoming wants to find a cinema, so the location prediction problem only needs to consider locations of the cinema type. This scenario has been widely applied in real life. Mobile applications such as Meituan and Dianping have included a large number of location type information options and placed them in prominent positions for users to select in advance.

[0102] When a user decides on a travel destination, it is often to select a type, such as: restaurant, cinema, bar, etc. And each location in the dataset has a category c i , which exactly matches the user's travel purpose requirements. Therefore, it can be directly used as the user travel intention vector. The category set is represented as follows:

[0103]

[0104] where, n c represents the number of user travel intention vectors, d represents the vector dimension. Therefore, the user travel purpose r pur can be expressed as:

[0105] r pur = c i

[0106] Step 3: Mine the user preferences and mobile behavior patterns of the spatio-temporal knowledge graph

[0107] The main goal of a knowledge graph is to describe various entities and concepts existing in the real world and the relationships between them. Therefore, it can be considered a semantic network. Its basic building units are "entity - relationship - entity" triples, as well as key-value pairs of entities and their related attributes. Entities are connected to each other through relationships, forming a network-like knowledge structure.

[0108] Step 3.1: Construct the spatio-temporal knowledge graph

[0109] The knowledge graph based on translation (TranE) regards entities and relationships in the knowledge graph as two matrices. The entity matrix structure is n×d, where n represents the number of entities, d represents the dimension of each entity vector, and each row in the matrix represents the word vector of an entity; while the relationship matrix structure is r×d, where r represents the number of relationships, d represents the dimension of each relationship vector. In the ideal state of the model after training, a vector is extracted from each of the entity matrix and the relationship matrix for L2 norm operation:

[0110]

[0111] a iIt can represent the value on the i-th dimension of vector a. The obtained result is approximately the vector of another entity in the entity matrix, so as to represent the relationship of the existing triples in the knowledge graph through word vectors.

[0112] TransE is a typical method among various knowledge graph-based technologies. It embeds the triple (h, r, t) into a transition space that satisfies h + r ≈ t, where h, r, and t represent the head, relation, and tail entities. In the mobile behavior learning scenario, both users and locations can be regarded as "entities". Therefore, the relationship between user u and location v is defined as:

[0113]

[0114] r represents the relationship between the user and the location, that is, the spatio-temporal context, which will be described in detail below. To avoid the problems of overfitting and too large values of the learning model parameters, a constrained canonical embedding is added: For u, v, r, there are ||u||2 ≤ 1, ||v||2 ≤ 1, and ||r||2 ≤ 1.

[0115] It should be noted that there are various current translation-based methods that can model different relationship patterns, such as symmetric / asymmetric, composition, and inversion, etc. Since the present invention mainly focuses on using historical record sequences and user travel intentions for mobile behavior modeling. Therefore, the key issue is to master the relationship vector r in the model and encode it as the fusion of the user's continuous check-in behavior and user travel intention.

[0116] According to the above access sequence vector representing the user's mobile behavior and the user travel intention vector of the travel purpose, the corresponding triple (u, (r seq , r pur ), v) can be generated, which is used to record that after the user u performs the mobile behavior r seq , according to the travel intention purpose r pur , accesses the location v. For the fusion of r seq , r pur information, it is an operation that needs to be considered in the next step.

[0117] Step 3.2: Representation of user check-in behavior and travel purpose

[0118] In the spatio-temporal mobile behavior graph modeling field considered in the present invention, each user corresponds to a set of graphs. According to the settings in step 1, the information graph of each user in each dataset is composed of all the check-in records of the user. In each record, the user and the location can be regarded as the head and tail nodes of the knowledge graph respectively, and the historical sequence representation of the user's access and the user's travel intention can be used as the relationship of the triple. Therefore, the key to constructing the spatio-temporal knowledge graph lies in how to better combine the spatio-temporal context in the historical trajectory and the user's intention.

[0119] To capture the importance of the two relationships, relational-level attention is applied to calculate the impact of weights:

[0120]

[0121] where MLP r (·) is a two-layer multi-layer perceptron that takes the concatenation of the user vector and the relationship vector as input to obtain the degree of importance the user attaches to this relationship. r i represents the access timing vector or travel intention vector, and the attention degree of the user to the two is obtained by calculating the weights of the two. The most typical MLP includes three-layer structure: input layer, hidden layer and output layer. The different layers of the MLP neural network are fully connected (fully connected: any neuron in the upper layer is connected to all neurons in the lower layer). Refer to Figure 6 as shown, for the schematic diagram of relational-level attention learning.

[0122] Step 3.3, User Location Prediction Learning Objective

[0123] Given the defined score function f r (u, v), the objective (loss function) of user location prediction learning is:

[0124]

[0125] where γ is the margin, D and D’ are the sets of positive and negative samples of the triples, and u, u' and v, v' represent positive / negative users and positive / negative locations respectively. The negative samples are obtained by randomly replacing the users or locations in the positive samples. The training objective is to maximize the distance between positive and negative samples, and the convergence of the loss function indicates that the model training is completed.

[0126] Step 4, Location Prediction Based on the New User's History

[0127] Based on the historical access sequence and travel intention of the given user u, the present invention can predict the probability that the user u visits the location v of category c as: c For:

[0128]

[0129] By calculating the probabilities of all locations under category c, the probability that the user is interested in each location can be obtained, so as to obtain the n locations that it may be most interested in, which are returned as the location prediction results.

[0130] In the prediction stage, the historical check-in records of each user are first converted into translation vectors; then the user's travel intention is used as the input of the network, and through the attention mechanism, recurrent neural network, and location prediction network based on the knowledge graph, the probability distribution of locations is finally obtained as the location prediction result.

[0131] The updated node vectors are further used as the input of the location prediction network. According to the above method, first, the attention information of all nodes in the graph is added to each graph node vector, then all the graph nodes are accumulated as the overall vector representation of the graph, and then they are multiplied by all location vectors respectively. The product is finally used as the location prediction result by calculating the scoring function of the TransE model.

[0132] In the training stage of the model, for the check-in records corresponding to each user, the locations of all records whose check-in time in the training data occurs after the construction of the graph records are used as the ground truth, and are represented in the form of knowledge graph triples. The overall model uses MarginLoss as the objective function. The location prediction model proposed in the present invention compares 6 location prediction models in the Foursquare datasets of three cities, and the method of the variant of this model (excluding the user's travel intention, replacing the personalized attention network with LSTM / RNN) is used as the comparison model. Its prediction results are evaluated by 4 evaluation metrics: precision, recall, mean average precision, and normalized discounted cumulative gain. The results are compared as Figure 7 shown. Each row corresponds to an evaluation metric, where the left side is the result of the NYC dataset, the middle is the result of the TKY dataset, and the right side is the result of the IST dataset. The models corresponding to each result are as Figure 7 shown, where the six comparison models are SAE-NAD, LGLMF, APOIR, STA, SUCP, and ContextsPOI, and the last one represents the location prediction model of the spatio-temporal knowledge graph oriented to user intention proposed in the present invention. It can be seen from the figure that the performance of the model proposed in the present invention is better than that of the comparison models, which verifies that the present invention improves the prediction effect in the location prediction task.

[0133] It should be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising..." or "including..." does not exclude the existence of additional elements in the process, method, article or terminal device comprising the said element. In addition, in this text, "greater than", "less than", "more than" etc. are understood not to include the present number; "above", "below", "within" etc. are understood to include the present number.

[0134] Although the above-described embodiments have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept. Therefore, the above are only embodiments of the present invention, and do not limit the patent protection scope of the present invention. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be included in the patent protection scope of the present invention by the same token.

Claims

1. A method for constructing a spatio-temporal knowledge graph oriented to user intentions, characterized in that The specific steps of this method are as follows: Step 1: Collect data and preprocess it, and then construct IDs for users, locations, categories, time slots, and geographical location encodings that can be directly input into the model. Step 2: Use the preprocessed data to establish an access sequence vector and construct a user travel intention vector. Step 3: Construct a spatio-temporal knowledge graph model to generate corresponding triples (u, (r seq , r pur ), v), which are used to record that after user u performs movement behavior r seq , according to travel intention purpose r pur , location v is visited; Step 4: Perform location prediction based on the historical access sequence and travel intention of a given user. The specific steps of Step 3 are as follows: Step 3.1: Construct a spatio-temporal knowledge graph model In the knowledge graph model based on translation, entities and relationships in the knowledge graph are regarded as two matrices. The entity matrix structure is n×d, where n represents the number of entities and d represents the dimension of each entity vector. Each row in the matrix represents the word vector of an entity; while the relationship matrix structure is r×d, where r represents the number of relationships and d represents the dimension of each relationship vector. In the ideal state of the model after training, a vector is extracted from the entity matrix and the relationship matrix respectively for L2 norm operation: a i can represent any vector; The knowledge graph model embeds the triple (h, r, t) into a transition space that satisfies h + r ≈ t, where h, r, and t represent the head, relationship, and tail entities. In the scenario of mobile behavior learning, both users and locations can be regarded as "entities". Therefore, the relationship between user u and location v is defined as: where r represents the relationship between the user and the location, i.e., spatio-temporal context and travel intention. To avoid overfitting and the problem of too large learning model parameter values, a constrained canonical embedding is added: There are ||u||2 ≤ 1, ||v||2 ≤ 1 and ||r||2 ≤ 1; According to the access sequence vector representing the user's movement behavior and the user travel intention vector of the travel purpose above, a corresponding triple (u, (r seq , r pur ), v) can be generated, which is used to record that after the user u's movement behavior r seq , according to the travel intention purpose r pur , the location v is visited; Step 3.2: Representation of user check-in behavior and travel purpose To capture the importance of two relationships, relational-level attention is applied to calculate the influence of weights: Among them, MLP r (·) is a two-layer neural network that takes the concatenation of the user vector and the relationship vector as input and then obtains the degree of importance the user attaches to this relationship; r i represents the historical access sequence vector or the user travel intention vector; Step 3.3: Learning objective of user location prediction Given the defined fractional function f r (u, v), the goal of user location prediction learning is as follows: Where γ is the margin, D and D’ are the sets of positive and negative samples of triples, and u, u' and v, v' represent positive / negative users and positive / negative locations respectively. Negative samples are obtained by randomly replacing users or locations in positive samples.

2. The method for constructing a spatio-temporal knowledge graph oriented to user intentions according to claim 1, wherein: The specific steps of Step 1 are as follows: Step 1.1: Data collection, obtaining data from a location-based social network. Step 1.2: Data processing. After data collection, the original data needs to be preprocessed. The attribute information involved in the preprocessed check-in records includes: user ID, location ID, category ID, time slot ID, geographical location vector. Step 1.3: Data reconstruction Definition 1: Embedding vector of spatio-temporal knowledge graph nodes, defined as follows: The set U = {u1, u2, …, u |U|}, V = {v1, v2, …, v |V|}, and C = {c1, c2, …, c |c|} respectively represent the vector sets of users, locations, and location categories. Among them, the vectors and d u 、d v 、d c are the dimensions of three kinds of vectors respectively; Definition 2: Each location represents a specific geographical position, and each location belongs to a category Definition 3: Check-in record. Each check-in activity is a triple (u, v, t), representing that user u visits location v at time t. Definition 4: Check-in sequence. A check-in sequence is a set of check-in records of a specific user arranged in chronological order.

3. The method for constructing a spatio-temporal knowledge graph oriented to user intentions according to claim 1 or 2, characterized in that: The specific steps of Step 2 are as follows: Step 2.1: Use the preprocessed historical check-in records to establish an access sequence vector Personalized attention is used to capture the differential attention of users to different historical check-ins. For each record in the user check-in sequence, it is defined as follows: where v i and t i represent the location and time accessed by the user in the record s respectively, concat(·) is a concatenation function, w represents the parameters of training, and loc(·) is a geocoding method; Since the number of a user's historical records is too large and cannot reflect the current mobility of the user, the most recent n fixed historical record windows are intercepted, given the most recent check-in records The current historical record of the user can be uniquely encoded as: Where f(·) represents an aggregation operation used to aggregate L historical records into a vector representation, and α represents a trainable vector independent of the user to obtain a global transfer bias. Step 2.2: Construct a user travel intention vector The user's decision on the travel goal often involves selecting a type, and each location in the dataset has an associated category c i , which happens to match the user's travel purpose requirement. Therefore, it can be directly used as the user's travel intention vector, and the category representation is as follows: where n c represents the number of user travel intention vectors, and d represents the vector dimension. Therefore, the user travel purpose r pur can be expressed as: r pur =c i 。 4. The method for constructing a spatio-temporal knowledge graph oriented to user intentions according to claim 1, wherein: The specific steps of Step 4 are as follows: Predict the location \(v\) of the access category \(c\) for the user \(u\) based on the historical access sequence and travel intention of the given user \(u\). c The probability is as follows: By calculating the probabilities of all locations under category c, the probability of a user's interest in each location can be obtained, and thus the n locations that it may be most interested in can be obtained, which are returned as the location prediction results.

Citation Information

Patent Citations

  • Target trajectory prediction method and system based on knowledge graph, and storage medium

    CN112052339A

  • Mobile behavior map construction method for spatio-temporal data

    CN112749209A